Inlining H.S(x) can lead to code like:
x === 0 ? 1 / x < 0 ? "-0.0" : "" + x : "" + x
It does not help much to inline this and it can block more useful
inlinings because the extra code brings the caller over the inlining
threshold.
H.S(x) is replaced with x.toString$0(0) if x is a self-interceptor, and
the inliner is then allowed to continue inlining on that.
BUG=
R=kmillikin@google.com, sigmund@google.com
Review URL: https://codereview.chromium.org/1689933002 .
After calling a non-intercepted method on an object, that object is
known to be self-interceptor:
x.foo$1()
getInterceptor(x).$eq(x, y)
==>
x.foo$1()
x.$eq(0, y)
Type propagation would handle this if TypeMasks could represent a
type containing all self-intercepting classes (see issue #25646).
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org/1655183002 .
Inline more unsafe operator calls, and insert more checks accordingly.
When "num" is the only receiver that does not respond with NSM, insert
a check and use the builtin operator. Previously we only did this when
the receiver was a number or null. For example:
if (typeof x !== "number") return x.$lt();
result = x < 4;
When the argument might have the wrong type, insert an argument check
and use the builtin operator. Previously we never did this if the
argument might have the wrong type. For example:
if (typeof x !== "number") return H.iae(x);
result = 4 < x;
If both receiver and argument need checks, we join the two checks and
use a one-shot interceptor to throw the error:
if (typeof x !== "number" || typeof y !== "number")
return J.$lt(x, y);
result = x < y;
NullCheck has been generalized to a ReceiverCheck instruction to
support "x.$lt()" above, that throws even if x is a non-null value.
BUG=
R=sigmund@google.com
Review URL: https://codereview.chromium.org/1668913002 .
Closes#25680
- This CL fixes the handling of inapplicable noSuchMethod methods on superclasses (see issue 25671) for both SSA and CPS.
- The CPS implementation for normal noSuchMethod calls on super was wrong is fixed with this CL, including the addition the missing visitUnresolvedSuperSet method on the SemanticSendVisitor.
- An error (presumably in type inference) affecting SSA was found with the added tests (Issue 25716 filed)
R=asgerf@google.com, het@google.com
Review URL: https://codereview.chromium.org/1678053002.
+ update annotations to make nodes without information more visible
+ add annotation for unused source information
+ use source information from subnodes in variable declarations, assignments and expression statements (a fix triggered by showing unused information)
+ support source information for initial variable declarations
+ new source info is now comparable to the old; need to check source locations before switch to the new
R=sigmund@google.com
Review URL: https://codereview.chromium.org/1678043003.
Because we search for new redexes while performing reductions, we can't
always assert that a term is well-formed.
In this case, it's not true that all invocations of a continuation will have
the same number of arguments while we are in the middle of performing a dead
parameter reduction.
BUG=
R=asgerf@google.com
Review URL: https://codereview.chromium.org/1641073003 .
Shrinking reductions uses a null parent of a potential redex to detect that
the redex occurs in an already-deleted subterm, to avoid performing such
reductions. (They are not safe because the term structure of deleted
subterms, e.g., use lists, might not be consistent.)
R=asgerf@google.com
BUG=
Review URL: https://codereview.chromium.org/1645933002 .
There is a 'const' Symbol constructor that is not expressible as a Dart
const constructor because it performs validation of its input. This is
implemented in the libraries by using a dummy const constructor definition
that does not validate its input and replacing calls to 'new Symbol' with
calls to 'new Symbol.validated' in the compiler.
Without replacing calls to 'new Symbol', the non-validating dummy
implementation will be used, which is not correct.
Closes#24878.
R=asgerf@google.com
BUG=https://github.com/dart-lang/sdk/issues/24878
Review URL: https://codereview.chromium.org/1639313002 .
JSArray<E>.typed has a specially generated body. We should be able to inline this. This makes all of the "new List.xxx()" paths work.
Literal lists are treated like maps - we generate a call to JSArray<E>.typed. I need to change that to JSArray<E>.markGrowable.
R=asgerf@google.com
Review URL: https://codereview.chromium.org/1642493002 .
Use TypeExpression to create the 'headless flat' type term that is used for the instance's reified type.
This is a step towards placing the type term on JSArray.
There is also some modest GVN benefits where repeated terms are shared.
R=asgerf@google.com
Review URL: https://codereview.chromium.org/1637843002 .
Treating the values double.INFINITY and -double.INFINITY as if they were int
at compile time also affects the SSA compiler's range analysis pass. This
change restores the former behavior that those values were unbounded ranges.
R=floitsch@google.com
BUG=
Review URL: https://codereview.chromium.org/1639193003 .
Shrinking reductions would miss some redexes that were created during
a reduction. It now finds more redexes and has a self-checking mode
that can be enabled when working on the pass.
Also adds some general debugging utility functions to the CPS IR.
The root class Node now has "debugString" and "debugPrint" methods for
conveniently getting its SExpression.
The CpsFunctionCompiler now has a method "debugCpsPass" which runs
a CPS pass while checking that it is idempotent for that input. Most passes
are not yet idempotent, but this utility should help us get there.
BUG=
Review URL: https://codereview.chromium.org/1616673002 .
The predicate would answer incorrectly when asked if subclasses of A
is disjoint from subtypes of B, where B is a subtype of A.
Example from the compiler:
abstract class _MinifiedFieldNamer implements Namer
class MinifyNamer extends Namer with _MinifiedFieldNamer
[subclass=Namer] vs [subtype=_MinifiedFieldNamer] were found to be
disjoint, even though the MinifyNamer class exists.
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org/1631093004 .
The variable merger pass now prioritizes register allocations that
remove a moving assignment "v1 = v2" or enable a compoundable assignment
"v1 = v2 + E" to become "v1_2 += E".
When minifying, we now allow merging differently named variables.
Previously, preserving the variable names was important to get a good
register allocation, but that heuristic is no longer needed.
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org/1625643002 .
Implement switches with continue to their labels by a first 'non-recursive'
switch followed by a second (only) 'recursive' switch inside a loop.
Continue is implemented by assignment to a state variable that the second
switch switches over.
R=asgerf@google.com
Review URL: https://codereview.chromium.org/1585503002 .