Commit Graph

4835 Commits

Author SHA1 Message Date
Johnni Winther 915383a17a Add KernelCodegenWorkItem stub
With this change we can run the compilation of hello_world from .dill
(with --read-dill --disable-type-inference) to where we need to run
the KernelSsaBuilder.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2888413004 .
2017-05-22 10:18:48 +02:00
Johnni Winther 789fce309f Add ElementCodegenWorldBuilder
Reusable parts are left in CodegenWorldBuilderImpl and a stub KernelCodegenWorldBuilder is added.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2894893002 .
2017-05-22 10:05:57 +02:00
Sigmund Cherem 011f8c5873 Reapply CL: first step for modular support in fasta
BUG=
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2894283002 .
2017-05-19 19:47:37 -07:00
Sigmund Cherem 54dcc29835 Revert "First step for modular output in fasta."
This reverts commit d9e9382373.

There were bot failures on incremental_kernel_generator test and in
incremental_resolved_ast_test, I'm not sure yet why tests passed locally though.

BUG=

Review-Url: https://codereview.chromium.org/2894273002 .
2017-05-19 15:02:48 -07:00
Sigmund Cherem d9e9382373 First step for modular output in fasta.
Some details:
 - Adds the tree-shaker logic and unit tests for it,

   Note: I'm still not clear on what degree of tree-shaking we can get away
   with. For now I have a mode to delete anything that is not seen explicitly.
   This passes verification for all of our tests so far, but breaks both the
   mixin and the async/await transformer in some scenarios.

 - Writes a prototype of kernelForBuildUnit (although no automated tests for it
   yet).

 - Moves a few more pieces to ProcessedOptions

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2893493004 .
2017-05-19 13:59:15 -07:00
Peter von der Ahé 547b2cdcce Implement generalized function types.
Fixes https://github.com/dart-lang/sdk/issues/6972

Fixes https://github.com/dart-lang/sdk/issues/26581

R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2876813002 .
2017-05-19 11:03:24 +02:00
Johnni Winther a52cc66a30 Handle super accesses loaded from .dill
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2890153002 .
2017-05-19 10:21:04 +02:00
Asger Feldthaus 876db33bf4 Add import/export declaration AST node boilerplate to kernel.
Previously only deferred imports were represented. They have been
merged with the general form.

BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2852373002 .
2017-05-18 14:38:08 +02:00
Johnni Winther 3ba3cc1e0d Support mixins when loading from .dill
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2884273002 .
2017-05-18 11:04:12 +02:00
Johnni Winther b30ff8ed66 Use entities in runtime_types
- and make it its own library.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2884233002 .
2017-05-18 10:09:40 +02:00
Stephen Adams 4af03b1a65 dart2js: --fast-startup: updateHolders always copies properties
The 'trick' of splicing __proto__ builds long prototype chains, so don't do it.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2890873002 .
2017-05-17 17:45:46 -07:00
Konstantin Shcheglov 7bc9df585e Move writeOutline() and writeProgram() out of KernelTarget.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2885233003 .
2017-05-17 17:33:46 -07:00
Konstantin Shcheglov 06e9b4b503 Rename buildOutline() and separate 'build' and 'writeProgram()'.
Also rename KernelTarget.program to _program to prevent clients from
reaching into internals. I think eventually we want to make more
stuff private. And rationalize errors handling. And... many things :-)

R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2893563003 .
2017-05-17 11:10:06 -07:00
Sigmund Cherem cd2ebf70a2 Add dart:html and friends to patched_dart2js_sdk/platform.dill, also fix up
warnings on these libraries.

R=sra@google.com

Review-Url: https://codereview.chromium.org/2885103005 .
2017-05-17 10:58:30 -07:00
Konstantin Shcheglov e3f4ed94b1 Rename Target.writeOutline() into computeOutline(), add separate KernelTarget.writeOutline().
For DillTarget write does not make sense, and even for KernelTarget
we usually don't want to write anything.

R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2885923002 .
2017-05-16 14:38:24 -07:00
Dan Rubel 278c7bfbeb merge fasta.Token into analyzer.Token
This eliminates much of the duplication between the two token hierarchies
by merging much of the fasta.Token hierarchy into the analyzer.Token.

* merge token hierarchies
* cleanup fasta.Token.copy()
* set preceedingComments field via constructor
* replace isBuiltInIdentifier --> type.isBuiltIn
* change all fasta.Token references to analyzer.Token
* move fasta.Token.value() implementation into analyzer.SimpleToken

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2890523002 .
2017-05-16 11:50:14 -04:00
Johnni Winther dff23682a1 Create closed world for hello world using .dill file
Currently results in compile time error because of a bug in the kernel reuse of mixin applications.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2865693002 .
2017-05-16 10:30:05 +02:00
Johnni Winther 1a5a3d71d5 Access BackendUsage through ClosedWorld
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2875313002 .
2017-05-15 10:13:06 +02:00
Johnni Winther d3846d4be0 Remove ElementEnvironment.getCallStructure
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2871133006 .
2017-05-15 10:05:08 +02:00
Johnni Winther 7d27e55c2c Add forEachLibraryMember and forEachConstructor to ElementEnvironment
- for testing equivalence on library members and constructors

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2882523003 .
2017-05-15 09:59:42 +02:00
Konstantin Shcheglov bdedd6768b Add a way to use shared CanonicalName root to deserialize Program.
This allows for example to add SDK into a Program, then load the
"incomplete" Program A that has only the library A, and name sequences
that references SDK classes. Because we look into the nameRoot which
aleady has SDK CanonicalName(s), we can find these names while filling
the link table and use references which point to the existing SDK
AST nodes.  Then we can load another set of library cycles, etc.

At the end we have a set of self-consistent libraries that we can
feed into DillTarget/DillLoader and resolve anothersource target
against it.

This CL is based on https://codereview.chromium.org/2872903005/
which has not been reviewed yet.

R=kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2874723002 .
2017-05-12 10:42:08 -07:00
Sigmund Cherem dae30fe286 Remove one more use of DillTarget.read that broke compiler/tool/generate_kernel.
Also adds a test for that script.

BUG=
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2880443005 .
2017-05-12 10:37:17 -07:00
Johnni Winther 822bbbb71a Add more equivalence tests for ElementEnvironment
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2874973003 .
2017-05-12 10:15:58 +02:00
Johnni Winther bf779d8d07 Move ElementEnvironment.isSubtype to DartTypes
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2869403002 .
2017-05-12 10:10:47 +02:00
Sigmund Cherem db331244d0 Generate outline without transformations in patched_sdk, use it for unit tests
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2881603003 .
2017-05-11 15:10:33 -07:00
Erik Ernst 9928c5cb80 Allowing e of any type in void f(...) => e in dart2js.
Addresses https://github.com/dart-lang/sdk/issues/28941.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2866213004 .
2017-05-11 16:15:08 +02:00
Johnni Winther cdfe67f95d Add equivalence check of NativeData and InterceptorData
Extracted NativeMemberResolver from NativeDataResolver and added
KernelNativeMemberResolver to resolve native member data before
world impact computation.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2873113004 .
2017-05-11 14:11:04 +02:00
Sigmund Cherem c911f44c3f fix checked-mode failure in perf_test
TBR=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2868393002 .
2017-05-10 11:37:19 -07:00
Sigmund Cherem 5366a1f76c Fix compiler.perf script
TBR=johnniwinther@google.com,vegorov@google.com

Review-Url: https://codereview.chromium.org/2875703002 .
2017-05-10 11:15:08 -07:00
Johnni Winther 5e5aa2ea9e Skip constructors from ElementEnvironment.forEachClassMember
- and don't mixin static members

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2871573007 .
2017-05-10 09:52:53 +02:00
Johnni Winther 2a3d86acec Rewrite Constantifier.visitLet
R=sra@google.com

Review-Url: https://codereview.chromium.org/2872833003 .
2017-05-10 09:45:18 +02:00
Johnni Winther 958ab524c4 Pass data objects to ConstantEmitter
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2873633002 .
2017-05-10 09:28:38 +02:00
Johnni Winther 37f86b324e Pass data objects directly to NativeEmitter
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2872613003 .
2017-05-10 09:23:44 +02:00
Stephen Adams aab31aa1a4 dart2js: Smaller async error sequence when only one handler
R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2856223004 .
2017-05-09 14:44:42 -07:00
Florian Loitsch 237313b027 Add support for profile-based startup optimizations.
An experimental (and undocumented) flag '--experimental-track-allocations' makes the '--fast-startup' compiler add instructions that track which classes are allocated.

By going to the JavaScript console and dumping this information as JSON into `allocated_classes_profile` the next dart2js compilation can optimize the startup by deferring the initialization of the classes that weren't necessary for startup.

The workflow would look something like:
```
dart2js --fast-startup --experimental-track-allocations -o foo.js -o foo.dart
// Run the program in Chrome and run the following command in the console:
JSON.stringify($__dart_deferred_initializers__.allocations)
// Take the result and copy it into a file, say "allocations.json".
// Then rerun the compilation with the allocation-information.
dart2js --experimental-allocations-path=allocations.json --fast-startup -o foo.js -o foo.dart
```

R=sra@google.com

Review-Url: https://codereview.chromium.org/2847343002 .
2017-05-09 20:33:29 +02:00
Johnni Winther 17c1f2710b Move ResolutionEnqueuer.hasBeenResolved to Resolver
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2868813003 .
2017-05-09 10:48:59 +02:00
Johnni Winther f8be1f4429 Move ResolutionWorkItem to resolution_strategy.dart
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2865953003 .
2017-05-09 10:38:53 +02:00
Johnni Winther 7fa9fc7e2e Remove DartString from constants.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2864363002 .
2017-05-09 10:26:42 +02:00
Johnni Winther c4cef519ea Pass InterceptorData through ResolutionWorldBuilder and access it through ClosedWorld
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2871583002 .
2017-05-09 10:02:11 +02:00
Johnni Winther 03af677cd3 Pass NativeDataBuilder through ResolutionWorldBuilder
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2869753002 .
2017-05-09 09:56:21 +02:00
Stephen Adams 3988f5d48d dart2js --fast-startup emitter - elide unused phases
BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2861303002 .
2017-05-08 17:06:23 -07:00
Stephen Adams 551b1e313a dart2js: Always print input and output sizes and compile time
Example:

Compiled 3,992,806 characters Dart to 821,948 characters JavaScript in 9.76 seconds

Example:

Compiled 91,031,904 characters Dart to 53,112,849 characters JavaScript in 300 seconds
Info: 11,683,442 characters JavaScript in c2/m.js

The (--verbose) Info: prints the size of the primary file (as it used to).

BUG=
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2865643004 .
2017-05-08 15:29:51 -07:00
Dan Rubel 3347169016 cleanup TokenType var names
* rename TokenType info --> type
* rename fasta Token.info --> Token.type

R=paulberry@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2872453004 .
2017-05-08 12:43:08 -04:00
Florian Loitsch 8e01f69305 Void is not required to be null anymore.
In checked mode, `void` now accepts any value.

Fixes #28937.
Fixes #28938.

BUG= http://dartbug.com/28937
BUG= http://dartbug.com/28938
R=johnniwinther@google.com, kmillikin@google.com, lrn@google.com, regis@google.com

Committed: https://github.com/dart-lang/sdk/commit/521dc6620fd2c4591aa975745c14b304428f17eb
Reverted: https://github.com/dart-lang/sdk/commit/a3c0cb65af4bbbdde756208dcccdcdf896902b5b
Committed: https://github.com/dart-lang/sdk/commit/4e52c457a9ac412b6b0a3a350020998c7e2f7d9a
Reverted: https://github.com/dart-lang/sdk/commit/4b35d3995b2b273728751c19976ece0edca0eddc
Committed: https://github.com/dart-lang/sdk/commit/6caf9ef4439e20ea726d8a5383ed34d42b02c84b
Reverted: https://github.com/dart-lang/sdk/commit/30d9bf2ed3225f04c52d999a1a5c61e63a90578d
Review-Url: https://codereview.chromium.org/2718513002 .
2017-05-08 11:31:37 +02:00
Johnni Winther 074baf1b9a Access NativeData only through ClosedWorld
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2863073003 .
2017-05-08 11:28:19 +02:00
Johnni Winther b624614fd1 Remove ClosedWorld.allFunctions
This move FunctionSet use inside ClosedWorldBase and enables
FunctionSetBuilder to be closed before the creation of the ClosedWorld object.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2860733002 .
2017-05-08 11:16:02 +02:00
Johnni Winther f11e4bbac6 Handle ?? in Constantifier
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2866463005 .
2017-05-08 11:05:45 +02:00
Johnni Winther ab688ab590 Make elements/names.dart its own library
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2860753005 .
2017-05-08 11:00:32 +02:00
Johnni Winther ca01b7c1af Rename KernelElementAdapter and element_adapter.dart to IrToElementMap and ir_map.dart
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2858223004 .
2017-05-08 10:51:18 +02:00
Johnni Winther 0adb70eb52 Move resolution/operators.dart to elements/operators.dart
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2862163003 .
2017-05-08 10:08:32 +02:00