For some reason html.Element's static const _tagsForWhichCreateContextualFragmentIsNotSupported is inferred to dynamic instead of a ContainerTypeMask.
This change will also 'do the right thing' if we turn off type inference.
R=asgerf@google.com
Review URL: https://codereview.chromium.org/1490923003 .
- renames the existing AbstractValue in cps_ir/type_propagation.dart to AbstractConstant
- introduces AbstractValue as an empty superinterface of TypeMask, and
- lift the interface of TypeMaskSystem to the superinterface AbstractValueDomain.
In follow-ups:
- change simple uses from TypeMask(System) to AbstractValue(Domain)
- update names and comment in AbstractValueDomain to more precisely reflect the abstraction
- update the complex uses (mainly type_propagation.dart) to use AbstractValue(Domain)
R=asgerf@google.com
Review URL: https://codereview.chromium.org/1415883005.
The sign of a +/- operation is computed, which can help in cases where
the result could not be proven to be within 53-bit range.
Also added rules for ~/, %, >>, &, and unary negation operators.
BUG=
R=sra@google.com
Review URL: https://codereview.chromium.org/1479193002 .
Primitives now have a getter 'hasValue' to distinguish primitives that
don't return a value, such as SetField.
The interceptor for TypeTestViaFlag is now inserted on-demand.
Non-instantiated intercepted classes are removed the set of
intercepted classes. This avoids an assertion failure, although it
would be better to avoid adding them in the first place.
The type of closure fields for boxes and type variables no longer go
through the global type inference.
A test fails because the type inference infers an empty type for a
closure field for a torn-off `.call` method. It's an existing problem
that we now have at least one failing test for.
CreateFunction has been removed from CPS and Tree.
BUG=
R=sra@google.com
Review URL: https://codereview.chromium.org/1474713002 .
Calls to numeric operators where the receiver might be null will now
insert a specialized null check, like this:
if (typeof x !== 'number') return x.$lt();
BUG=
R=sra@google.com
Review URL: https://codereview.chromium.org/1474373002 .
The cycle detection assumed that positive-weight cycles could safely be
ignored while searching for a negative-weight cycle, but this broke the
memoization in the DFS.
Do not try to use DFS to find shortest paths in cyclic graphs.
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org/1474133002 .
This test fails:
tools/test.py -mrelease -cdart2js -rd8 --cps-ir language/invocation_mirror_invoke_on2_test
The reason is unrelated: because String.codeUnitAt, the only reference
is the call on Proxy. There appears to be a bug with recognizing this.
TBR=asgerf@google.com
Review URL: https://codereview.chromium.org/1475513009 .
There is a new pass for doing GVN and LICM.
The 'share interceptors' pass previously GVN'ed and LICM'ed interceptors
but now only constifies them and lets GVN handle the rest. The pass
has been renamed to optimize_interceptors.
The 'share final fields' pass has been removed since GVN does the same.
A new pass 'remove redundant refinements' removes some refinement nodes
that contribute no information. These would sometimes block code motion
for no good reason. This pass is should go away once GVN is able to
hoist expressions across refinement guards.
BUG=
R=sra@google.com
Review URL: https://codereview.chromium.org/1444363002 .
(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 .