(Work-in-progress, but mostly done)
InvokeMethod and friends no longer take a continuation, but are instead
primitives bound by LetPrim.
This touches a lot of code. Some general housekeeping came along in the
process.
InvokeMethod has a "calling convention" enum on it to enable
dartReceiver and getDartArgument convenience methods.
There is a new UnsafePrimitive class to help type propagation
constant-fold InvokeMethods. I expect the class will go away after
some changes to type propagation.
Most optimizations work exactly as before, but not all are 100%
consistent. The consecutive push rewrite was removed entirely because
V8 does not like that.
BUG=
R=kmillikin@google.com, sra@google.com
Review URL: https://codereview.chromium.org/1458703007 .
This fixes a bug in batch-mode.
Selectors are canonicalized upon construction, so two equal selectors
are always the same object.
To avoid memory leaks in batch mode, the compiler clears the canonical
cache before each run.
However, some selectors were stored in static fields and thus shared
between runs. These selectors lost their canonical status when the
cache was cleared. This patch "fixes" that by reinserting them in
the cache after clearing it.
BUG=
R=johnniwinther@google.com
Review URL: https://codereview.chromium.org/1457733002 .
This enforces one of the guidelines that is described in the documentation for 'JS' in js_runtime/lib/foreign_helper.dart
The JS code should be rewritten to explicitly capture the values in JS.
// Dart 'a' might change after it is closed over.
JS('', 'function(){return #;}', a);
-->
// Immediately bind Dart 'a' to JS 'a' and then close over JS 'a':
//
JS('', '(function(a){return function(){return a;};})(#)', a);
R=sigmund@google.com
Review URL: https://codereview.chromium.org/1436263002 .
Previously, torn off super methods would be registered by emulating a
dynamic getter call using an exact TypeMask for the super class as the
receiver.
If the super class was abstract (or just not instantiated), using an
exact TypeMask is absurd since there are no objects with that exact
class.
Now, methods that have been registered as "needing super getter" are
always considered to have their getter invoked, removing the need to
emulate the dynamic getter call.
BUG=
R=johnniwinther@google.com
Review URL: https://codereview.chromium.org/1418573011 .
Container type masks depend on the allocation site of an object, but the
allocation site "key" is an AST node. We need to assign types to nodes
in the type propagation pass where the AST nodes are (and should be)
inaccessible, so we cannot directly query the type inference from there.
The key could be changed to an opaque "AllocationSiteID" object with no
members (just a key), but for now, we're just preserving the type mask
for container types from build-time.
Also has some other type propagation improvements related to containers.
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org/1416723008 .
At construction time, jumps from within the try block of a try/catch are
marked as ones that exit the try block. This is relied on for correctness.
Specifically, it prevents moving code from outside the try into the scope of
the try.
Return jumps were from within the try were not marked because it was
unnecessary. In the presence of inlining, returns are turned into jumps to a
local join-point continuation. These jumps must be marked for correctness.
R=asgerf@google.com
BUG=
Review URL: https://codereview.chromium.org/1414043011 .
This fixes an issue in the bounds checker that made it think a nested
loop had side effects.
In the first pass, the bounds checker would conservatively assume
each loop had side effects, but then mark it as effect-free for the
next pass if it did not see any effects in the loop. For nested loops
however, the "conservative" side effect of the inner loop would prevent
the outer loop from being marked as effect-free.
A separate pass now analysis loops for side effects.
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org/1426633005 .