Commit Graph

4698 Commits

Author SHA1 Message Date
Asger Feldthaus 8568b9e4df dart2js cps: Narrow the receiver mask on InvokeMethod.
Improves tree shaking in cases where we infer better
types than the original type inference.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1407743002 .
2015-11-05 19:45:32 +01:00
Stephen Adams 7b48eb2b7f dart2js cps_ir: propagate constant field values
The effect is to remove endianness logic in SHA1.

Mark some single-call methods as @NoInline()

R=asgerf@google.com

Review URL: https://codereview.chromium.org/1408193009 .
2015-11-05 10:40:12 -08:00
Asger Feldthaus c861e4d28a dart2js cps: Better side-effect tracking in loops.
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 .
2015-11-05 19:03:26 +01:00
Asger Feldthaus b466453025 dart2js cps: Fix bug in trampoline visitor.
If a continuation was visited directly (as the root of the
trampoline) the actions pushed in traverseContinuation would
not get processed.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1427643009 .
2015-11-05 13:14:55 +01:00
Stephan Herhut 2cecb9ec9c Resolve some static warnings.
R=karlklose@google.com
BUG=

Review URL: https://codereview.chromium.org/1433543004 .
2015-11-05 12:49:45 +01:00
Stephan Herhut 6ba13e2570 Use better names for captured variables in closures.
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1428853004 .
2015-11-05 11:57:50 +01:00
Johnni Winther c1b102a94d Revert "Normalize type masks to use the least upper instantiated subclass/type."
This reverts commit d3c68df853.

BUG=

Review URL: https://codereview.chromium.org/1431513010.
2015-11-05 11:14:47 +01:00
Johnni Winther d3c68df853 Normalize type masks to use the least upper instantiated subclass/type.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1413613010.
2015-11-05 10:54:21 +01:00
Johnni Winther 3837194311 Add TypeUse.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1422623014.
2015-11-04 14:29:17 +01:00
Asger Feldthaus dff4cc11d7 dart2js: Set inferred return types for async, async*, and sync* methods.
Previously these were assumed to return dynamic. Now the return type is
the concrete class being returned:
  async -> _Future
  async* -> _ControllerStream
  sync* -> _SyncStarIterable

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1418043005 .
2015-11-03 15:02:46 +01:00
Kevin Millikin 73894d4d30 dart2js CPS: Fix a bug in scalar replacement.
Scalar replacement should compute initial values for all fields (including
those in superclasses) because it will try to replace them.

R=asgerf@google.com
BUG=

Review URL: https://codereview.chromium.org/1429513006 .
2015-11-03 14:28:06 +01:00
Asger Feldthaus f4429324eb dart2js cps: Fix codegen for yield.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1415843006 .
2015-11-03 14:21:52 +01:00
Johnni Winther 419cce7178 Rename UniverseSelector to DynamicUse and move it to use.dart
BUG=
R=sigmund@google.com, sigurdm@google.com

Review URL: https://codereview.chromium.org/1408383006.
2015-11-03 10:13:55 +01:00
Johnni Winther e2e899a53f Remove for-in selectors from TreeElements.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1433443002.
2015-11-03 09:41:17 +01:00
Harry Terkelsen 1b708855ca dart2js: add OutputUnit info for constants
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1431693003 .
2015-11-02 18:44:04 -08:00
Johnni Winther 57538d804d Add StaticUse for more precise registration of statically known element use.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1424923004.
2015-11-02 14:46:05 +01:00
Johnni Winther d4021e92a1 Don't crash on error at end-of-file.
BUG=

Review URL: https://codereview.chromium.org/1415883011.
2015-11-02 14:05:56 +01:00
Sigurd Meldgaard c0d5f73bd0 Introduce "platform configurations" to replace categories and libraries.dart.
A small writeup of the thoughts behind this concept can be found at:
https://docs.google.com/a/google.com/document/d/1WkqJVPphuThH8h2jDqBOb6h1iMkrkQIO7PF638-qlso/edit?usp=sharing

BUG=
R=floitsch@google.com, johnniwinther@google.com, whesse@google.com

Review URL: https://codereview.chromium.org/1408253006 .
2015-11-02 13:02:25 +01:00
Johnni Winther b4f81a216f Support multiline location messages and use signature for function spans.
BUG=
R=ahe@google.com

Review URL: https://codereview.chromium.org/1420013002.
2015-11-02 11:52:44 +01:00
Asger Feldthaus 646a0b277f dart2js cps: Support --trust-primitives and --trust-type-annotations.
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 .
2015-11-02 11:25:57 +01:00
Jacob Richman d0f456a910 Fix behavior when typed JS interop getters are called as functions.
BUG=
R=sigmund@google.com, sra@google.com

Review URL: https://codereview.chromium.org/1431523002 .
2015-10-30 16:07:04 -07:00
Stephen Adams 2d03bd52ff dart2js cps_ir: avoid world.fieldNeverChanges()
http://dartbug.com/24781 needs to be fixed before this work-around can be reverted.

TBR=asgerf@google.com
CC=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1412493003 .
2015-10-30 15:27:10 -07:00
Stephen Adams cc0525c0c4 Simple sharing and hoisting of final field loads
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 .
2015-10-30 11:36:37 -07:00
Jacob Richman e0d2263bb3 Add @anonymous annotation and restrict object literal constructors to only anonymous classes. This frees up defining factory constructors that do not correspond to object literals on JS interop classes.
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1409033005 .
2015-10-29 19:18:19 -07:00
Asger Feldthaus b123d5393f dart2js: Bugfix in async rewriter preanalysis.
Name and StringConcatenation nodes would be classified as await/yield,
causing their surrounding expressions to be exploded into temporaries.

BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1418503009 .
2015-10-29 13:43:09 +01:00
Sigurd Meldgaard f10470741a Rename Compiler.runCompiler -> runInternal.
Also renamed MockCompiler.runCompiler to MockCompiler.run

Change all tests to use Compiler.run.

BUG=
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1417323005 .
2015-10-29 13:30:29 +01:00
Sigurd Meldgaard e3b926849f Rename apiimpl.Compiler to CompilerImpl.
BUG=
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1409803006 .
2015-10-29 13:23:55 +01:00
Johnni Winther 8688d297c5 Move most codegen registrations into WorldImpact.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1410313005.
2015-10-28 13:54:28 +01:00
Johnni Winther 9628541c10 Move remaining helpers to BackendHelpers
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1413213004.
2015-10-28 13:23:57 +01:00
Asger Feldthaus f712e08e94 dart2js cps: More interceptor optimizations and fixes.
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 .
2015-10-28 12:56:21 +01:00
Sigurd Meldgaard b0a764c074 Make the computation of import chain to disallowed library use correct uri.
BUG=
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1430603002 .
2015-10-28 10:19:12 +01:00
Asger Feldthaus 0c25cd27ac dart2js cps: Remove unneeded bailout on captured loop variables.
The analysis of try-boxed variables reused some code from the old
dart2dart CPS backend, which had bailouts for code that is handled just
fine in the dart2js CPS backend.

R=karlklose@google.com, kmillikin@google.com

Committed: https://github.com/dart-lang/sdk/commit/695bdf4fa365fc84ef4dda9e0fde84b58772ca9b

Review URL: https://codereview.chromium.org/1410123005 .
2015-10-27 13:01:10 +01:00
Asger Feldthaus 11c7b77f63 Revert "dart2js cps: Remove unneeded bailout on captured loop variables."
This reverts commit 695bdf4fa3.

BUG=

Review URL: https://codereview.chromium.org/1417773008 .
2015-10-27 12:58:48 +01:00
Asger Feldthaus 11826bf9b7 dart2js cps: Do not inline static async methods.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org/1414333008 .
2015-10-27 12:44:21 +01:00
Asger Feldthaus 695bdf4fa3 dart2js cps: Remove unneeded bailout on captured loop variables.
The analysis of try-boxed variables reused some code from the old
dart2dart CPS backend, which had bailouts for code that is handled just
fine in the dart2js CPS backend.

R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1410123005 .
2015-10-27 11:51:28 +01:00
Asger Feldthaus 3634c3998a dart2js: Bugfix for when 'await' occurs in an initializer list.
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 .
2015-10-27 11:36:57 +01:00
Johnni Winther 529bc75d81 Move codegen registration to transformImpact method.
This prepares for only registering through WorldImpact.

BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1421463005.
2015-10-27 10:10:01 +01:00
Johnni Winther db98c37dac Add CoreClasses
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1421003004.
2015-10-26 13:56:07 +01:00
Asger Feldthaus 7c09a56c76 dart2js: Fix marking of boxed loop variables.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1409933004 .
2015-10-23 17:40:34 +02:00
Johnni Winther 3310969882 Require that injected members are private.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1421723002.
2015-10-23 14:41:50 +02:00
Johnni Winther 58a11d1077 Remove requiredTypes
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1416253002.
2015-10-22 12:52:02 +02:00
Johnni Winther e38285c424 Move native and js interop properties from the element model to the JS backend
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.
2015-10-22 11:41:38 +02:00
Sigurd Meldgaard b41dc7ecf7 Introduce .isMalformed
To start a separation between different ways an element can be "wrong".

BUG=
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1414913002 .
2015-10-22 09:33:33 +02:00
Johnni Winther d497c37fbb Reenable support for native factory constructors.
BUG=

Review URL: https://codereview.chromium.org/1419883002.
2015-10-21 19:52:26 +02:00
Johnni Winther eeab865f27 Add ElementKind for factory constructors.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1417103002.
2015-10-21 17:17:09 +02:00
Asger Feldthaus 9c0a7cd730 dart2js cps: Prefer unlabeled continue over labeled break.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1405023004 .
2015-10-21 15:39:59 +02:00
Johnni Winther 7ee22bcd84 Remove [addForEmission] parameter from [registerCompileTimeConstant]
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1411783005.
2015-10-21 14:23:54 +02:00
Asger Feldthaus 9e29d33563 dart2js cps: More precise rewrite for indexables.
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 .
2015-10-21 12:54:20 +02:00
Harry Terkelsen a4bfe1f1c7 dart2js: do typechecking even if suppressWarnings is on
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 .
2015-10-20 17:06:10 -07:00
Jacob Richman be1fcb9441 Switch Js to JS
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1410403003 .
2015-10-19 17:32:10 -07:00