Commit Graph

1390 Commits

Author SHA1 Message Date
Johnni Winther 8a4995dfb7 Remove WorldImpact from caches when no longer needed.
BUG=
R=sigurdm@google.com

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

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

This test fails:
python tools/test.py -mrelease -cdart2js -rd8 --minified --dart2js-batch --host-checked -t960 dart2js_extra/deferred/deferred_function_test

Review URL: https://codereview.chromium.org/1464773002.
2015-11-23 15:51:48 +01:00
Asger Feldthaus cb8d7994ce dart2js cps: Refactor CallExpressions into Primitives.
(Work-in-progress, but mostly done)

InvokeMethod and friends no longer take a continuation, but are instead
primitives bound by LetPrim.

This touches a lot of code. Some general housekeeping came along in the
process.

InvokeMethod has a "calling convention" enum on it to enable
dartReceiver and getDartArgument convenience methods.

There is a new UnsafePrimitive class to help type propagation
constant-fold InvokeMethods.  I expect the class will go away after
some changes to type propagation.

Most optimizations work exactly as before, but not all are 100%
consistent.  The consecutive push rewrite was removed entirely because
V8 does not like that.

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

Review URL: https://codereview.chromium.org/1458703007 .
2015-11-23 12:29:43 +01:00
Stephen Adams b28df3dc5d Revert "Remove WorldImpact from caches when no longer needed."
Revert while breakage can be investigated

TBR=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1467733002 .
2015-11-20 15:23:14 -08:00
Johnni Winther ecea5e5dc0 Remove WorldImpact from caches when no longer needed.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1464773002.
2015-11-20 15:16:26 +01:00
Johnni Winther 4c0c3e54e1 Revert "Register super field set explicitly in the universe."
This reverts commit 2345d845f5.

BUG=

Review URL: https://codereview.chromium.org/1462333002.
2015-11-20 14:11:20 +01:00
Johnni Winther 2345d845f5 Register super field set explicitly in the universe.
Closes #24781

R=sra@google.com

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

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

Review URL: https://codereview.chromium.org/1435053002.
2015-11-20 13:10:34 +01:00
Asger Feldthaus 392bed583c dart2js: Recanonicalize selectors in static fields between runs.
This fixes a bug in batch-mode.

Selectors are canonicalized upon construction, so two equal selectors
are always the same object.

To avoid memory leaks in batch mode, the compiler clears the canonical
cache before each run.

However, some selectors were stored in static fields and thus shared
between runs.  These selectors lost their canonical status when the
cache was cleared.  This patch "fixes" that by reinserting them in
the cache after clearing it.

BUG=
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1457733002 .
2015-11-18 13:55:15 +01:00
Johnni Winther aa16622d8d Handle prefix as expression in SendSet.
Closes #23611

BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1449343003.
2015-11-17 13:45:13 +01:00
Johnni Winther 25aeab3c40 Revert "Limit interceptedElements to instantiated members only."
This reverts commit c71f758cba.

BUG=

Review URL: https://codereview.chromium.org/1450843002.
2015-11-16 13:16:55 +01:00
Johnni Winther c71f758cba Limit interceptedElements to instantiated members only.
BUG=
R=asgerf@google.com, sra@google.com

Review URL: https://codereview.chromium.org/1418643008.
2015-11-16 12:46:09 +01:00
Stephen Adams 2b30d5919a Revert "Register super field set explicitly in the universe."
Havlak benchmark tanked to 1/3.

There are a lot of crashes, e.g

python tools/test.py -mrelease -cdart2js -rd8 -aia32 --use-sdk --write-debug-log --write-test-outcome-log --clear_browser_cache --checked --dart2js-batch --host-checked -t1920 dart2js_native/native_class_with_dart_methods_frog_test

python tools/test.py -mrelease -cdart2js -rd8 -aia32 --use-sdk --write-debug-log --write-test-outcome-log --clear_browser_cache --checked --dart2js-batch -t120 co19/LibTest/html/IFrameElement/insertBefore_A01_t01

TBR=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1441853005 .
2015-11-13 17:15:29 -08:00
Stephen Adams df5bc72927 Register super field set explicitly in the universe.
Closes #24781

R=sra@google.com

Review URL: https://codereview.chromium.org/1435053002 .
2015-11-13 15:52:32 -08:00
Stephen Adams 77483ae5d3 dart2js: Forbid # placeholders in JS function bodies.
This enforces one of the guidelines that is described in the documentation for 'JS' in js_runtime/lib/foreign_helper.dart

The JS code should be rewritten to explicitly capture the values in JS.

    // Dart 'a' might change after it is closed over.
    JS('', 'function(){return #;}', a);

-->

    // Immediately bind Dart 'a' to JS 'a' and then close over JS 'a':
    //
    JS('', '(function(a){return function(){return a;};})(#)', a);

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1436263002 .
2015-11-12 15:38:12 -08:00
Harry Terkelsen 9a56c7ee56 dart2js: report output unit imports to dump-info
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1434103004 .
2015-11-12 14:10:49 -08:00
Harry Terkelsen 0df916cce0 dart2js: use WorldImpact for dump_info
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1422323007 .
2015-11-11 17:33:50 -08:00
Stephan Herhut 1fdcb882d5 Fix a bug in type inference for locals in switch statements.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1439603002 .
2015-11-11 16:03:19 +01:00
Asger Feldthaus c10bc94937 dart2js cps: Do not propagate expressions into foreign code.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1436833002 .
2015-11-11 14:56:57 +01:00
Johnni Winther 8b0817c839 Register closures using StaticUse.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1435853002.
2015-11-11 12:59:00 +01:00
Johnni Winther 9cfba28da1 Compute NewStructure in resolution.
Closes #21134

R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1437463005.
2015-11-11 11:46:08 +01:00
Johnni Winther 686faebf70 Canonicalize BackendImpact
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1431983003.
2015-11-10 11:24:56 +01:00
Johnni Winther 0133786ae0 Use DiagnosticMessage in MockCompiler.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1415463022.
2015-11-10 11:12:51 +01:00
Johnni Winther f92416c2b6 Use Feature directly in resolution.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1438453002.
2015-11-10 10:47:02 +01:00
Asger Feldthaus d730063475 dart2js cps: Do not propagate InvokeMethodDirectly receiver.
The target function might not exist before the class has been
instantiated for the first time, so the receiver must be evaluated
before the callee expression.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1408353009 .
2015-11-09 15:50:54 +01:00
Johnni Winther e9c53271c5 Improve messages and static use for super/this-calls.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1423623008.
2015-11-09 13:24:38 +01:00
Johnni Winther 7b458eb1d6 Normalize type masks to use the least upper instantiated subclass/type.
BUG=
R=sigurdm@google.com

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

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

Review URL: https://codereview.chromium.org/1413613010.
2015-11-06 15:37:14 +01:00
Asger Feldthaus a32a12f900 dart2js: Change how super tear-offs are registered.
Previously, torn off super methods would be registered by emulating a
dynamic getter call using an exact TypeMask for the super class as the
receiver.

If the super class was abstract (or just not instantiated), using an
exact TypeMask is absurd since there are no objects with that exact
class.

Now, methods that have been registered as "needing super getter" are
always considered to have their getter invoked, removing the need to
emulate the dynamic getter call.

BUG=
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1418573011 .
2015-11-06 11:49:05 +01:00
Asger Feldthaus eb7befc3d9 dart2js cps: Propagate container types for lists.
Container type masks depend on the allocation site of an object, but the
allocation site "key" is an AST node. We need to assign types to nodes
in the type propagation pass where the AST nodes are (and should be)
inaccessible, so we cannot directly query the type inference from there.

The key could be changed to an opaque "AllocationSiteID" object with no
members (just a key), but for now, we're just preserving the type mask
for container types from build-time.

Also has some other type propagation improvements related to containers.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1416723008 .
2015-11-06 11:29:26 +01:00
Lasse R.H. Nielsen 3c41869d3c Make dart2js accept constant null values in string interpolations.
Fixes issue #24839.
BUG= http://dartbug.com/24839
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1425823004 .
2015-11-06 10:58:06 +01:00
Kevin Millikin 45004655a1 Mark returns from inside the try of a try/catch as ones that exit the try.
At construction time, jumps from within the try block of a try/catch are
marked as ones that exit the try block.  This is relied on for correctness.
Specifically, it prevents moving code from outside the try into the scope of
the try.

Return jumps were from within the try were not marked because it was
unnecessary.  In the presence of inlining, returns are turned into jumps to a
local join-point continuation.  These jumps must be marked for correctness.

R=asgerf@google.com
BUG=

Review URL: https://codereview.chromium.org/1414043011 .
2015-11-06 09:31:07 +01:00
Stephen Adams 9efe59cc02 Fix for 23806 - don't optimize out Array allocation that may throw
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1431513012 .
2015-11-05 18:11:23 -08:00
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
Sigurd Meldgaard f7998baf71 Add .platform files to jsonify.
This allows 'try' to  run again.

BUG=

Review URL: https://codereview.chromium.org/1420843008 .
2015-11-02 14:43:22 +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