Commit Graph

4835 Commits

Author SHA1 Message Date
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
Johnni Winther c3d8f392c5 Extract WorldImpactBuilder from _ResolutionWorldImpact.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1413543004.
2015-10-19 14:31:49 +02:00
Asger Feldthaus ee0f98ab33 dart2js cps: Ensure parameter default values are emitted.
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1411763002 .
2015-10-16 17:00:32 +02:00
Asger Feldthaus 1e23ef0cbb dart2js cps: Speed up integrity checking some more.
Share the Map instance between different passes, so we don't need to
allocate and resize the hash table from scratch every time.

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1397953005 .
2015-10-16 09:52:47 +02:00
Asger Feldthaus 106a36b321 dart2js cps: Do not mark result of type casts as non-null.
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1400113003 .
2015-10-16 09:35:46 +02:00
Harry Terkelsen 356a7c76ed dart2js: use AllInfoJsonCodec to write dumpinfo file
BUG=

Review URL: https://codereview.chromium.org/1413513002 .
2015-10-15 17:50:31 -07:00
Harry Terkelsen b84ac4c3b6 dart2js: use AllInfoJsonCodec to write dump info file
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1407133002 .
2015-10-15 17:25:18 -07:00
Stephen Adams 14dcffa124 dart2js cps_ir: Unary operator improvements
~ and - are reduced to BuiltinOperators.

R=asgerf@google.com

Review URL: https://codereview.chromium.org/1394003008 .
2015-10-15 12:00:15 -07:00
Asger Feldthaus fd3b1d144f dart2js cps: Speed up CPS IR integrity checker.
Building large maps and sets slowed the checker down a lot,
so it has been narrowed down to one map.

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1409483002 .
2015-10-15 11:01:12 +02:00
Stephen Adams 52d7ad1978 dart2js cps_ir: Use JSNumber_methods where possible
We can often use the JSNumber interceptor directly without choosing
between JSNumber and JSInt.

BUG=
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1395333004 .
2015-10-14 12:57:27 -07:00
Johnni Winther 5a956826a5 Move WorldImpact to universe/world_impact.dart
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1394793004.
2015-10-14 15:22:40 +02:00
Johnni Winther 0fb376928e Remove calls to registerDependency from within resolution.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1405443004.
2015-10-14 15:06:45 +02:00
Johnni Winther 47b83b3bc1 Include class members in dependencies.
BUG=

Review URL: https://codereview.chromium.org/1404763002.
2015-10-14 12:56:47 +02:00
Johnni Winther 23524a8028 Fix after bad merge.
BUG=

Review URL: https://codereview.chromium.org/1407693002.
2015-10-14 11:44:10 +02:00
Asger Feldthaus cd901e7813 dart2js cps: Change type tests to null tests when applicable.
When null is the only value that might fail a type test we can
rewrite it to just compare against null.

Update: Fixed a missing mandatory named parameter.

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

Committed: https://github.com/dart-lang/sdk/commit/29dedfa97e3ff513d93b89c69c6b42b9746925d6

Reverted: https://github.com/dart-lang/sdk/commit/e97d32be50504c965b2f598f7f833b54be066fdf

Review URL: https://codereview.chromium.org/1306773005 .
2015-10-14 11:35:44 +02:00
Johnni Winther c77f1527d5 Move otherDependencies to globalDependencies.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1405563002.
2015-10-14 11:19:43 +02:00
Johnni Winther 26d6a8363e Use WorldImpact for element dependencies in deferred_load
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1394923003.
2015-10-14 11:12:19 +02:00
Harry Terkelsen 79134a74fa include entrypoint in dump_info
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1403073002 .
2015-10-13 17:08:13 -07:00
Jacob Richman cd2752431e Support user generated custom native JS classes.
BUG=
R=jmesserly@google.com, sra@google.com

Review URL: https://codereview.chromium.org//1318043005 .
2015-10-13 13:15:28 -07:00
Harry Terkelsen b7bb39a062 dart2js: mark FunctionElements as dependencies always
We were only marking FunctionElements as dependencies if they were
closurized class members. This prevented us from adding functions that
were top level.

BUG=
R=floitsch@google.com, sigurdm@google.com

Review URL: https://codereview.chromium.org/1395183004 .
2015-10-13 10:55:05 -07:00
Sigmund Cherem ac8b2af179 Decouple SSA builder from codegen-work-item
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1398393002 .
2015-10-13 09:32:14 -07:00
Asger Feldthaus a50105543f dart2js cps: Add a pass for eliminating bounds checks.
The analysis uses a watered-down octagon domain which reduces range
analysis to a graph problem.

There are more ideas to try out to improve on this, but I think this is
a nice baseline to work from.

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//1353443002 .
2015-10-13 16:40:54 +02:00
Johnni Winther c1214e8f99 Avoid creating invalid TypeMask.nonNullExact
BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org/1402913003.
2015-10-13 15:12:40 +02:00
Asger Feldthaus 7a534459ba dart2js cps: Some fixes for yield.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org/1405503003 .
2015-10-13 14:34:01 +02:00
Asger Feldthaus d43d95aaa3 dart2js cps: Maintain parent pointers instead of recomputing them.
All passes must now preserve valid parent pointers. Several passes
already did this (or tried to do it).

The IR integrity checker can now check that parent pointers are valid.
This has caught a number of missing parent pointers assignments in
passes that otherwise tried to preserve them.

All node constructors now set parent pointers. This is very convenient
for simple transformations, but also a bit of a trap since updating a
field on an existing node does not update the parent pointer.

This is a pretty heavy-handed change. The main rationale for it are:

- The helpers methods require parent pointers, so they are more useful
  when parent pointers are always set.

- The integrity checker can catch bogus parent pointers after passes
  that have to maintain them anyway.

- The integrity checker is super slow, but this can finally be fixed
  if it can assume parent pointers are valid (not part of this CL).

The IR visitors have been changed a bit to support a generic parent
visitor that does not have to implement every visit method.

The 'parent index' fields have been removed.

BUG=
R=kmillikin@google.com

Committed: https://github.com/dart-lang/sdk/commit/6cc9b435354ea4fe3796437e3cc7091f6a11de19

Review URL: https://codereview.chromium.org/1375213003 .
2015-10-13 10:50:41 +02:00