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 .
Values assigned to a local variable are assumed to satisfy the type
annotation if --trust-type-annotations is given.
Bounds checks are omitted if --trust-primitives is given.
BUG=
R=sra@google.com
Review URL: https://codereview.chromium.org/1408783004 .
Final fields always yield the same value. Replace GetField operations with references to pevious in-scope GetField operations. If it is safe, hoist the GetField to the loop where the input is defined.
This is a temporary pass while I continue on load elimination.
R=asgerf@google.com
Review URL: https://codereview.chromium.org/1415923012 .
When the result of getInterceptor is either null or a known constant,
it is compiled to `x && const` or `x == null ? x : const` depending
on whether there are any other falsy values for that type.
This required some changes to share_interceptors so it can share/hoist
the constant subexpression separately from the whole expression.
The Interceptor root class is removed from the intercepted classes of
getInterceptor when it is "shadowed" by all the other intercepted classes.
E.g. if the input is a number or a string, there is no need
to intercept for {JSNumber, JSString, Interceptor}, because JSNumber
and JSString collectively shadow Interceptor.
R=sra@google.com
Review URL: https://codereview.chromium.org/1409803003 .
If the JS ast contains an initializer list:
var x = foo(), y = await x;
It would be retained as a single statement and generate invalid output
that awaits 'x' before it has been defined.
CLOSES=23997
BUG=
R=sigurdm@google.com
Review URL: https://codereview.chromium.org/1427593003 .
Main changes:
Moved native/jsinterop members from
elements/elements.dart, (interface)
elements/modelx.dart, (implementation)
native/native.dart (implementation)
to
common/backend_api.dart (interface)
js_backend/backend.dart (implementation)
Removed LibraryElement.canUseNative and added BackendApi.canUseNative to
common/backend_api.dart
to encapsulate the maybeEnableNative function in
native/native.dart
Added ScannerOptions to
parser/element_listener.dart
as a required argument of ElementListener
and added Parsing.getScannerOptionsFor to
common/resolution.dart (interface)
compiler.dart (implementation)
to allow the `native` pseudo keyword in
native/scanner.dart
The remaining changes are side-effects of the changes above.
R=jacobr@google.com, sigurdm@google.com
Review URL: https://codereview.chromium.org/1408043002.
Strings were not sometimes not considered indexables because
[subtype=String] is not reduced to [exact=JSString].
We now rewrite the index-set operator to direct access even when the
receiver object is potentially null (but is otherwise a mutable
indexable).
BUG=
R=sra@google.com
Review URL: https://codereview.chromium.org/1420563002 .
this is necessary because the type of elements will not be
set unless the typechecker runs on the element. You need
the type to be set even when suppressWarnings is on because
in checked mode it is an error to declare a compiled constant
with inconsistent field types
Fixes#24653
BUG=
R=sigmund@google.com
Review URL: https://codereview.chromium.org/1411153005 .