Commit Graph

2555 Commits

Author SHA1 Message Date
Johnni Winther ab195dac63 Remove backend dependency from TypeTestRegistry
- and move RuntimeTypesChecks to TypeTestRegistry.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2826083002 .
2017-04-20 09:32:51 +02:00
Emily Fortuna 6c25a58dab Make backend.setAnnotations (mostly) handle LibraryEntities.
BUG=
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2824123003 .
2017-04-19 15:36:33 -07:00
Stephen Adams 6c75646b3e Revert "Remove JavaScriptBackend from ClosedWorldBase"
TBR=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2828873002 .
2017-04-19 12:55:14 -07:00
Johnni Winther ee4b776108 Remove JavaScriptBackend from ClosedWorldBase
Also extract more extract more methods from ClosedWorldImpl into
ClosedWorldBase.

This is a step towards creating a closed world object from kernel based
elements. This CL adds the first mock of that object.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2826673002 .
2017-04-19 11:14:02 +02:00
Johnni Winther 407645660c Remove Compiler and JavaScriptBackend from program_builder and collector.
This is a step towards passing data object directly instead of accessing
data on JavaScriptBackend. This is needed to support an element switch
between resolution and codegen.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2824823004 .
2017-04-19 10:44:57 +02:00
Johnni Winther 230c1745cd Remove Compiler and JavaScriptBackend from class_stub_generator
This is a step towards passing data object directly instead of accessing
data on JavaScriptBackend. This is needed to support an element switch
between resolution and codegen.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2820143004 .
2017-04-19 10:40:11 +02:00
Johnni Winther 23684c221e Remove Compiler and JavaScriptBackend from field_visitor.
This is a step towards passing data object directly instead of accessing
data on JavaScriptBackend. This is needed to support an element switch
between resolution and codegen.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2823003003 .
2017-04-19 10:30:55 +02:00
Stephen Adams 2955ecc794 Increase tracing limit
Increasing from 16 to 32 has a lot of nice small improvements and does
not seem to affect compile time (within benchmark noise).

BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2826623002 .
2017-04-18 15:00:20 -07:00
Johnni Winther 86b468a466 Remove Compiler and JavaScriptBackend from parameter_stub_generator
This is a step towards passing data object directly instead of accessing
data on JavaScriptBackend. This is needed to support an element switch
between resolution and codegen.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2810223002 .
2017-04-18 10:43:52 +02:00
Johnni Winther d7f28df9e8 Remove Compiler and JavaScriptBackend from main_call_stub_generator and runtime_type_generator
This is a step towards passing data object directly instead of accessing
data on JavaScriptBackend. This is needed to support an element switch
between resolution and codegen.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2815513007 .
2017-04-18 10:39:04 +02:00
Johnni Winther db048990bc Remove Compiler and JavaScriptBackend from interceptor_stub_generator.
This is a step towards passing data object directly instead of accessing
data on JavaScriptBackend. This is needed to support an element switch
between resolution and codegen.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2818463002 .
2017-04-18 10:33:58 +02:00
Johnni Winther 635f2fc491 Less direct use of JavaScriptBackend in ProgramBuilder
This is a step towards passing data object directly instead of accessing
data on JavaScriptBackend. This is needed to support an element switch
between resolution and codegen.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2810183002 .
2017-04-18 10:25:15 +02:00
Johnni Winther e484e652e2 Remove Compiler/JavaScriptBackend from metadata_collector
- and Compiler from type_test_registry.

The CodeEmitterTask was removed from the TypeRepresentationGenerator to
break a dependency cycle between the two. An Emitter is now provided as
an argument to TypeRepresentationGenerator methods instead.

This is a step towards passing data object to the codegen/emitter
instead of pulling data directly from Compiler/JavaScriptBackend. This
is needed to support an element model switch between codegen and
resolution.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2809203003 .
2017-04-18 09:58:27 +02:00
Johnni Winther 9cff58233f Extract ClosedWorldRefiner implementation from ClosedWorldImpl to ClosedWorldBase
- to make it reusable for kernel based elements.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2814973003 .
2017-04-18 09:45:00 +02:00
Johnni Winther a65d195f72 Compute isSubtype and isSubclass using ClassSet/ClassHierarchyNode
This makes ClosedWorld.isSubtype and ClosedWorld.isSubclass reusable
for kernel based elements.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2815513006 .
2017-04-18 09:34:32 +02:00
Johnni Winther 5ccf530f62 Extract OrderedTypeSetBuilderBase from OrderedTypeSetBuilder
- to make it reusable for kernel based elements.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2808763005 .
2017-04-18 09:29:39 +02:00
Stephen Adams 0c83262a1e Use shorter names for some standard properties on closures.
BUG= https://github.com/dart-lang/sdk/issues/25003
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2820953002 .
2017-04-17 18:51:18 -07:00
Stephen Adams 835f06a488 dart2js: fast startup: cache common superclass in inheritance
- group classes by common superclass
- cache superclass in local to reduce property accesses

Shrinks minified large app by 0.2%

BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2813743003 .
2017-04-17 14:57:50 -07:00
Stephen Adams cdba92a563 dart2js: --fast-startup: share defaultValues property for closures with no default values
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2820573005 .
2017-04-17 10:27:17 -07:00
Stephen Adams b0599b2647 dart2js: eliminate useless conditionals
1. Simplify HPhi nodes that merge refinements of the same value.

2. Replace the condition of HIf with a constant when the HIf does nothing (no controlled statements or phis).

Together with existing optimizations, this can optimize `s?.toString()` to `s` when `s` is known to be a nullable String.

BUG=
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2823543002 .
2017-04-14 14:34:05 -07:00
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