Commit Graph

4835 Commits

Author SHA1 Message Date
Stephen Adams 7e301f767b dart2js: Avoid inserting redundant HTypeKnown
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2815403004 .
2017-04-14 11:40:12 -07:00
Kevin Moore 1120d10daf Finish cleaning up analyzer warnings
Also Updated pubspec to use the SDK version of kernel

Closes https://github.com/dart-lang/sdk/issues/28454

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2815383003 .
2017-04-14 10:28:07 -07:00
Emily Fortuna 93a908fde0 Remove BackendClasses and JavaScriptBackendClasses.
BUG=
R=johnniwinther@google.com, sra@google.com

Review-Url: https://codereview.chromium.org/2813093002 .
2017-04-13 17:22:54 -07:00
Stephen Adams a7a1811f18 dart2js: type analysis: yield escapes its argument
BUG= https://github.com/dart-lang/sdk/issues/29046
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2811993006 .
2017-04-13 13:41:01 -07:00
Stephen Adams d15da7d900 dart2js: Capture typedef arguments once
The type Map<T, Foo<Set<T>>> contains one type variable referenced twice,
so there are two inputs into the HTypeInfoExpression instruction.

If Foo is a typedef, T can be reused, e.g.

    typedef E Foo<E>(E a, E b);

As the typedef is expanded (to Function(Set<T>, Set<T>) => Set<T>) it
should not consume additional types from the to-level input.  We
prevent this by capturing the types and using the captured type
expressions inside the typedef expansion.

TODO: We should make the type subexpression Foo<...> be a second
HTypeInfoExpression, with Set<T> as its input (a third
HTypeInfoExpression). This would share all the Set<T> subexpressions
instead of duplicating them. This would require HTypeInfoExpression
inputs to correspond to type variables AND typedefs.

BUG= https://github.com/dart-lang/sdk/issues/28749
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2812393003 .
2017-04-13 12:45:32 -07:00
Johnni Winther 1973b42b00 Lesser direct Compiler use in SSA
This is a step towards using data object rather than Compiler and
JavaScriptBackend in codegen. This is needed to support a shift in
element models between resolution and codegen.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2811593006 .
2017-04-12 11:33:11 +02:00
Johnni Winther aef0c45019 Extract ClosedWorldBase from ClosedWorldImpl
This is step towards making (parts of) ClosedWorldImpl reusable for kernel based elements.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2813503005 .
2017-04-12 09:52:34 +02:00
Johnni Winther 5c0566c476 Use entity WorldImpl where possible
This is a step towards making WorldImpl reusable for kernel based elements.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2813853002 .
2017-04-12 09:29:35 +02:00
Johnni Winther f900cf69b7 Use ClassEntity in ClassHierarchyNode
This makes ClassSet/ClassHierachyNode reusable for kernel based elements.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2814663002 .
2017-04-12 09:23:49 +02:00
Emily Fortuna fe3a583223 Reapply "Gracefully handle if loaded dill program has no mainMethod set."
The previous (identical) version of this CL was reverted due to a
spurious unrelated error on the dart-flutter integration bots.

BUG=
R=sra@google.com

Review-Url: https://codereview.chromium.org/2816633003 .
2017-04-11 16:30:10 -07:00
Emily Fortuna 81dfc04a81 Don't duplicate switch case code if we fall through to the default case.
BUG=https://github.com/dart-lang/sdk/issues/26900
R=sra@google.com

Review-Url: https://codereview.chromium.org/2810093002 .
2017-04-11 16:28:51 -07:00
Stephen Adams 208c007650 Work-around for issue 29309
BUG= https://github.com/dart-lang/sdk/issues/29309
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2815543003 .
2017-04-11 15:08:44 -07:00
Emily Fortuna 7697137485 Merge CommonElements and BackendHelpers!
BUG=
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2814453005 .
2017-04-11 14:32:54 -07:00
Johnni Winther ad52db16e0 Add kernel/closed_world2_test
This is a step towared computing the closed world purely from kernel based elements.

The added test runs the resolution enqueuer on a kernel based world.
Some methods and classes are mocked and no closed world object is computed, yet.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2810633003 .
2017-04-11 10:33:46 +02:00
Johnni Winther e5bb7df19b Use entities in Selector methods
This makes these methods reusable for kernel based elements.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2810683002 .
2017-04-11 10:22:55 +02:00
Johnni Winther 21a3455bd6 Introduce ParameterStructure
This is a substructure of FunctionType and FunctionSignature which
doesn't contain type information. This allows us to let FunctionEntity
have a ParameterStructure (which makes sense for both K and J elements)
but not require FunctionEntity to have a type (which K elements have
but J elements might not).

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2809603002 .
2017-04-11 10:19:14 +02:00
Johnni Winther 4d3c3b9305 Use entities in JavaScriptBackendClasses
This makes it reusable for kernel based elements.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2799403003 .
2017-04-11 10:14:33 +02:00
Johnni Winther 77bd26f3d7 Add MemberEntity.isAbstract and use MemberEntity in function_set.dart
This makes function_set.dart reusable for kernel based elements.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2804293002 .
2017-04-11 10:10:04 +02:00
Johnni Winther b4ef45d6e4 Use entities in impact transformers.
This makes the impact transformers reusable for kernel based elements.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2807593002 .
2017-04-11 10:02:53 +02:00
Johnni Winther 8cf8e5f437 Use entities in TypeVariableResolutionAnalysis and TypeVariableCodegenAnalysis
This makes this reuseable for kernel based elements.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2801873006 .
2017-04-11 09:56:14 +02:00
Johnni Winther 364ecead7e Remove most direct uses of 'backend' and 'compiler' in GraphBuilder.
This is a step towards using data objects instead of directly accessing
JavaScriptBackend and Compiler. This is needed to support an element model
switch between resolution and codegen.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2808683003 .
2017-04-11 09:50:24 +02:00
Johnni Winther 35ea089be2 Decouple LocalsHandler from Compiler and JavaScriptBackend
This is a step towards passing data object to codegen in order
to allow an element model switch between resolution and codegen.

BUG=
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2812633002 .
2017-04-11 09:43:05 +02:00
Johnni Winther da22833d8a Less direct Compiler use in SSA
This is a step towards using data object rather than Compiler and
JavaScriptBackend in codegen. This is needed to support a shift in
element models between resolution and codegen.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2813603002 .
2017-04-11 09:36:07 +02:00
Stephen Adams 4f358a21d6 Redo "dart2js: Insert HTypeKnown refinement nodes on dominated edges of HPhi nodes."
TBR=efortuna@google.com

Review-Url: https://codereview.chromium.org/2802323002 .
2017-04-07 12:45:58 -07:00
Johnni Winther d0e450d501 Use Set<ClassEntity> instead of Set<MixinApplicationElement>
To make benefit glorious type system of Dart.

Review-Url: https://codereview.chromium.org/2804233002 .
2017-04-07 14:26:00 +02:00
Johnni Winther 97b19651a5 Extract ResolutionWorldBuilderBase from ElementResolutionWorldBuilder
This is a step towards reusing parts of ElementResolutionWorldBuilder
for kernel-based elements.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2804993002 .
2017-04-07 09:59:49 +02:00
Johnni Winther 7108d7b7a4 Remove use of Element in ResolutionEnqueuerListener.
This makes ResolutionEnqueuerListener reusable for kernel-based elements.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2797173004 .
2017-04-07 09:41:57 +02:00
Johnni Winther 76737bb8ea Register deferred load impact through ResolutionEnqueuerListener
This is a part of the work to decouple the backend from the used element model.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2800643002 .
2017-04-07 09:26:25 +02:00
Stephen Adams 9f10c4898c Revert "Redo "dart2js: Insert HTypeKnown refinement nodes on dominated edges of HPhi nodes.""
There is one case where compilation is much slower (corelib/regexp/pcre_test).
Reverting while investigating.

The test has a 6.6K-line main() with straight-line code.

Before:

    SSA optimizer took 78552msec
    SSA optimizer > SsaInstructionSimplifier took 21434msec
    SSA optimizer > SsaTypeconversionInserter took 12msec
    SSA optimizer > SsaRedundantPhiEliminator took 1msec
    SSA optimizer > SsaDeadPhiEliminator took 0msec
    SSA optimizer > type propagator took 15639msec
    SSA optimizer > SsaCheckInserter took 18msec
    SSA optimizer > SsaDeadCodeEliminator took 35806msec
    SSA optimizer > SsaGlobalValueNumberer took 564msec
    SSA optimizer > SsaCodeMotion took 1msec
    SSA optimizer > SsaLoadElimination took 360msec
    SSA optimizer > SSA value range builder took 4700msec
    SSA optimizer > SsaSimplifyInterceptors took 2msec

After:
    SSA optimizer took 156299msec
    SSA optimizer > SsaInstructionSimplifier took 18700msec
    SSA optimizer > SsaTypeconversionInserter took 7msec
    SSA optimizer > SsaRedundantPhiEliminator took 1msec
    SSA optimizer > SsaDeadPhiEliminator took 0msec
    SSA optimizer > type propagator took 52763msec
    SSA optimizer > SsaCheckInserter took 26msec
    SSA optimizer > SsaDeadCodeEliminator took 31066msec
    SSA optimizer > SsaGlobalValueNumberer took 596msec
    SSA optimizer > SsaCodeMotion took 2msec
    SSA optimizer > SsaLoadElimination took 368msec
    SSA optimizer > SSA value range builder took 52752msec
    SSA optimizer > SsaSimplifyInterceptors took 2msec

BUG=

Review-Url: https://codereview.chromium.org/2804193002 .
2017-04-06 21:55:05 -07:00
Stephen Adams 6feb58bfb1 Redo "dart2js: Insert HTypeKnown refinement nodes on dominated edges of HPhi nodes."
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2798423003 .
2017-04-06 13:47:59 -07:00
Stephen Adams 810f0b5538 Revert "dart2js: Insert HTypeKnown refinement nodes on dominated edges of HPhi nodes."
Need to fix a warning.

TBR=efortuna@google.com

Review-Url: https://codereview.chromium.org/2801043003 .
2017-04-06 12:07:41 -07:00
Stephen Adams 49e78d7e32 dart2js: Insert HTypeKnown refinement nodes on dominated edges of HPhi nodes.
Consider:

    value ??= "";

We fail to infer in SSA type progagation that value is non-null.

At CFG level this looks like

    if (value == null) {
      value = "";
    } else {
      // There is always an empty else-block.
    }
   value1 = phi("", value);

Previously we considered the phi use of 'value' to be outside the
region dominated by the condition 'value != null', leaving nowhere to
attach the type refinement. Now we consider it inside the region,
allowing:

    if (value == null) {
      value = "";
    } else {
      value1 = HTypeKnown(not-null, value);
    }
    value2 = phi("", value1);

Type propagation now determines value2 is non-null.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2755353003 .
2017-04-06 10:44:05 -07:00
Stephen Adams fe7baee848 Fix for type analysis bug in constructor with early return
TEST_28 is isomorphic to the original report.

BUG=
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2799763003 .
2017-04-06 09:11:34 -07:00
Stephen Adams f36aaa72a8 dart2js: make dominator tree traversals nonrecursive
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2799603003 .
2017-04-05 13:13:31 -07:00
Emily Fortuna adce9b982a Revert "Gracefully handle if loaded dill program has no mainMethod set."
This reverts commit b24e594ebd.

I got an email this broke Dart/Flutter integration???

BUG=

Review-Url: https://codereview.chromium.org/2799063002 .
2017-04-05 13:03:00 -07:00
Emily Fortuna b24e594ebd Gracefully handle if loaded dill program has no mainMethod set.
BUG=
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2800463002 .
2017-04-05 12:35:52 -07:00
Emily Fortuna b7b3714086 Reapply "Add "load from .dill" file capability and run a white-box test.""
This reverts commit 8febfff784.

BUG=
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2797443008 .
2017-04-05 11:40:52 -07:00
Dan Rubel a370462274 move fasta.Keyword methods to analyzer.Keyword
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2800583002 .
2017-04-05 13:51:53 -04:00
Peter von der Ahé 0fcc4ee024 Implement parsing of metadata on local variables.
R=johnniwinther@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2798603003 .
2017-04-05 19:12:42 +02:00
Peter von der Ahé a8d08eaf4b Make lines and columns one-based in SourceLocation.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2804613003 .
2017-04-05 15:19:05 +02:00
Peter von der Ahé ddda182957 Add Source.getTextLine and use it to display source snippets in error messages.
R=asgerf@google.com, johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2788373002 .
2017-04-05 15:02:49 +02:00
Johnni Winther 5553b600e0 Split MirrorsData methods and MirrorsDataImpl data by element kind.
This is a step towards making MirrorsData(Impl) reusable for kernel
based elements.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2791263005 .
2017-04-05 09:06:05 +02:00
Emily Fortuna 8febfff784 Revert "Add "load from .dill" file capability and run a white-box test."
This reverts commit 310532ab50.

TBR=sra@google.com

BUG=

Review-Url: https://codereview.chromium.org/2795763005 .
2017-04-04 17:40:10 -07:00
Emily Fortuna 310532ab50 Add "load from .dill" file capability and run a white-box test.
The dill_loader_test is rather intrusive and I look forward to rewriting it once we have the Entity model spread throughout the compiler rather than Elements.

BUG=
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2798443002 .
2017-04-04 16:22:14 -07:00
Stephen Adams 887e733203 dart2js: Avoid recursion in visiting blocks of subgraph
Replace recursive calls with a Queue.

BUG= https://github.com/dart-lang/sdk/issues/26864 https://github.com/dart-lang/sdk/issues/29232
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2790063008 .
2017-04-04 15:20:24 -07:00
Stephen Adams 6d9fc0cc62 dart2js: num.compareTo is pure, and a.compareTo(a) is usually zero
BUG=
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2739953002 .
2017-04-03 18:03:31 -07:00
Stephen Adams 8d62ce1042 Remove dead elements from the MemorySet in load elimination.
The old code killed bindings by storing `null`. It is possible to
construct straight-line code with takes time and space O(N^2) to do
load elimination, since all the useless nulled-out bindings are
re-walked on every killAffectedBy call.

Luckily most of our generated code has some joins which cause the
intersection to be computed which deletes the unused bindings.

BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2770563002 .
2017-04-03 12:12:32 -07:00
Peter von der Ahé 5bdc1199ca Fix dart2js warnings and add test to ensure it stays clean.
Filed https://github.com/dart-lang/sdk/issues/29224 to track all the problems that require ignore.

R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2791993002 .
2017-04-03 15:08:40 +02:00
Johnni Winther 9fd5ae5b81 Use entities in NativeResolutionEnqueuer and make it reusable for kernel
This is step towards computing closed world directly from kernel.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2786593004 .
2017-04-03 10:33:21 +02:00
Johnni Winther 23999a0f1e Use entities in NoSuchMethodRegistry
This prepares for a kernel based implementation of NoSuchMethodResolver.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2777093010 .
2017-04-03 10:26:53 +02:00