Commit Graph

4698 Commits

Author SHA1 Message Date
Johnni Winther db14062bab Introduce ClassLike, MemberLike, FieldLike and FunctionLike
... to prepare for replacing the current element model with kernel based elements (for the resolution world) and Dart-in-JS elements (for the codegen world).

New classes in elements.dart.
Main changes in nodes.dart.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2464103002 .
2016-11-03 10:59:32 +01:00
Emily Fortuna 2206b43c3d Fix compiler crash when we declare several (global) variables, but only define some of them.
BUG=27553
R=johnniwinther@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org/2471543004 .
2016-11-02 11:28:19 -07:00
Erik Ernst b05f160352 Changed warning to hint for x as T where T is a method type variable.
This CL changes `dart2js` for compilation with `--generic-method-syntax`.
The semantics of generic methods is such that `x as T` can be used even
when `T` is a formal type parameter of an enclosing function, but the
test will always succeed. This may induce bugs into otherwise correct
programs, because the test will succeed even in the case where a
complete implementation should fail.

In response to this situation `dart2js` used to emit a warning, but
this conflicts with certain build procedures which are not allowed to
have warnings, but are intended to be able to contain these "blindly
successful" `as` expressions. So this CL changes that warning to a
hint.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2473743002 .
2016-11-02 16:56:11 +01:00
Johnni Winther 6cc90ed0f8 Compute NativeBehavior for native methods and fields.
R=het@google.com

Review URL: https://codereview.chromium.org/2467493003 .
2016-11-02 16:21:35 +01:00
Johnni Winther 00521e1e13 Compute NativeBehavior for foreign functions.
R=het@google.com

Review URL: https://codereview.chromium.org/2455073003 .

Committed: https://github.com/dart-lang/sdk/commit/7db10e4d435dd8026b03adfa912814491977f1af
2016-11-02 16:09:10 +01:00
Johnni Winther 2ad2616543 More functionality in kernel_impact.
R=het@google.com

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

Review URL: https://codereview.chromium.org/2456643006 .

Reverted: https://github.com/dart-lang/sdk/commit/8e48be6915371a131687d534c28521bea1385ab5
2016-11-02 14:42:17 +01:00
Johnni Winther 8e48be6915 Revert "More functionality in kernel_impact." and "Compute NativeBehavior for foreign functions."
This reverts commit a0bccd5c88.
This reverts commit 7db10e4d43.

Review URL: https://codereview.chromium.org/2466353002 .
2016-11-01 15:04:44 +01:00
Johnni Winther 7db10e4d43 Compute NativeBehavior for foreign functions.
R=het@google.com

Review URL: https://codereview.chromium.org/2455073003 .
2016-11-01 12:59:15 +01:00
Johnni Winther a0bccd5c88 More functionality in kernel_impact.
R=het@google.com

Review URL: https://codereview.chromium.org/2456643006 .
2016-11-01 12:37:30 +01:00
Johnni Winther b0ecbef3cc Introduce isAbstractlyInstantiated to avoid exact masks of abstract classes.
Classes can be instantiated directly, abstractly or indirectly:

When [cls] is directly instantiated: This means that at runtime instances of exactly [cls] are assumed to exist.

When [cls] is abstractly instantiated: This means that at runtime instances of [cls] or unknown subclasses of [cls] are assumed to exist.

This is used to mark native and/or reflectable classes as instantiated. For native classes we do not know the exact class that instantiates [cls] so [cls] here represents the root of the subclasses. For reflectable classes we need event abstract classes to be 'live' even though they cannot themselves be instantiated.

When [cls] is indirectly instantiated: This means that a subclass of [cls] is directly or abstractly instantiated.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2443953002 .
2016-10-28 08:45:57 +02:00
Stephen Adams 7eaad70e2f Improve condition strengthening for last test in short-circuit.
This strengthens

   t1 = s == null || t == null;
   if (t1) return;
   known-here:  t != null

There are not many hits since the 'interesting' tests are usually
earlier in the short-circuit expression.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2438543004 .
2016-10-25 04:48:35 -07:00
Sigmund Cherem 3c44a09882 make kerneltask an actual task
R=het@google.com

Review URL: https://codereview.chromium.org/2442503004 .
2016-10-20 16:27:33 -07:00
Sigmund Cherem 61bf1c2dc0 Re-add null check for closure-data (Originally removed in 177dee8f16)
Review URL: https://codereview.chromium.org/2438823002 .
2016-10-20 14:21:00 -07:00
Florian Loitsch 6beb1fdd11 Change Set.difference API to accept Set<Object>.
Fixes #27573
BUG= http://dartbug.com/27573
R=lrn@google.com

Review URL: https://codereview.chromium.org/2413233002 .
2016-10-20 14:37:15 +02:00
Stephen Adams 50e557d176 Prevent inlining of js_library core.RegExp constructor
Inlining was achieving no beneficial effect.

- Enabled GVN of match start.
- Made string quote style uniform.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2437863002 .
2016-10-19 16:25:11 -07:00
Stephen Adams 3b5c154138 Don't gvn HForeignCode without source text
There are a few synthetic templates that are generated from trees instead of source text. I don't think any are marked for GVN, but this is a hazard so best fix it.

TBR=sigmund@google.com

BUG=

Review URL: https://codereview.chromium.org/2431103003 .
2016-10-19 14:46:54 -07:00
Stephen Adams 5a646b7827 Property extraction getters (tear-offs) are effect-free
This mostly allows better scheduling of the surrounding instructions.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2430683003 .
2016-10-18 20:13:26 -07:00
Johnni Winther b262be749e Optimize needNoSuchMethodHandling computation
This greatly improves the number of lookups needed to establish the relation.
For the two most prolific tests we have:

html/element_test: 44939 -> 6557
html/mirrors_js_typed_interop_test (mirrors+jsinterop!): 1638455 -> 171326

R=sigmund@google.com

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

Review URL: https://codereview.chromium.org/2428543002 .

Reverted: https://github.com/dart-lang/sdk/commit/5397c5427e9102a8ea7602174be2664d4c15bb8b
2016-10-18 16:06:03 +02:00
Johnni Winther 37afcd5197 Change TypeInference to handle super calls as direct invocations.
This also makes calls of known target registered as static uses and thus
removes the need for misusing type masks to select super methods.

Closes #25716

R=sigmund@google.com

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

Review URL: https://codereview.chromium.org/2423953002 .

Reverted: https://github.com/dart-lang/sdk/commit/5397c5427e9102a8ea7602174be2664d4c15bb8b
2016-10-18 14:02:55 +02:00
Erik Ernst b5d2b38aa3 Relaxes treatment of method type parameter in as expressions.
This CL changes the semantics of `dart2js --generic-method-syntax`
generated code for `e as T` where `T` is a method type parameter.

The old behavior was to raise a `TypeError` at runtime when such an
expression was evaluated. The new behavior is to consider `T` as an
alias for `dynamic`, i.e., `e as T` will then always succeed.

Addresses part of issue 27460, omits a part that is not yet agreed upon.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/2388843002 .
2016-10-18 11:11:44 +02:00
Johnni Winther 5397c5427e Revert "Change TypeInference to handle super calls as direct invocations." and "Optimize needNoSuchMethodHandling computation"
This reverts commit 70159b7418.
This reverts commit a8b2bfb5eb.

Review URL: https://codereview.chromium.org/2425933002 .
2016-10-18 11:00:42 +02:00
Johnni Winther a8b2bfb5eb Optimize needNoSuchMethodHandling computation
This greatly improves the number of lookups needed to establish the relation.
For the two most prolific tests we have:

html/element_test: 44939 -> 6557
html/mirrors_js_typed_interop_test (mirrors+jsinterop!): 1638455 -> 171326

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2428543002 .
2016-10-18 10:52:12 +02:00
Johnni Winther 70159b7418 Change TypeInference to handle super calls as direct invocations.
This also makes calls of known target registered as static uses and thus
removes the need for misusing type masks to select super methods.

Closes #25716

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2423953002 .
2016-10-18 09:46:28 +02:00
Johnni Winther 74b74a13f7 Decouple TypeMask from ClassElement
- by typing FlatTypeMask.base with Entity
- moving needsNoSuchMethodHandling to ClosedWorld
- and testing needsNoSuchMethodHandling

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2420073002 .
2016-10-17 09:47:20 +02:00
Stephen Adams 790b9d9cb1 Enable GVN on HForeignNew
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2422003002 .
2016-10-14 17:34:07 -07:00
Sigmund Cherem 997581ccec Fix custom elements in startup emitter
R=sra@google.com

Review URL: https://codereview.chromium.org/2424553002 .
2016-10-14 16:58:47 -07:00
Sigmund Cherem ee42a0a0aa Add js-interop support to the fast-startup emitter
BUG=
R=jacobr@google.com

Review URL: https://codereview.chromium.org/2420173002 .
2016-10-14 14:22:11 -07:00
Lasse R.H. Nielsen efb9a12811 Add = as default-value separator for named parameters.
Fixes issue #27559.

BUG= http://dartbug.com/27559
R=asiva@google.com, eernst@google.com, floitsch@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org/2411633002 .
2016-10-14 11:25:25 +02:00
Stephen Adams 476ffbda5e Revert "Build CFG for various JS() foreign methods"
TBR=het@google.com
BUG=

Review URL: https://codereview.chromium.org/2411793007 .
2016-10-13 19:02:41 -07:00
Stephen Adams a897bc3832 Build CFG for various JS() foreign methods
BUG=
R=het@google.com

Review URL: https://codereview.chromium.org/2404123002 .
2016-10-13 17:11:35 -07:00
Sigmund Cherem b39b0d1811 Fixes in dart2js parser to be able to parse files without the diet-parser
R=ahe@google.com

Review URL: https://codereview.chromium.org/2385643003 .
2016-10-10 12:21:56 -07:00
Johnni Winther 9f5a4b231e Handle type of constructor invoke in deferred_load
Review URL: https://codereview.chromium.org/2404813002 .
2016-10-10 12:01:55 +02:00
Johnni Winther 090f20fc5d Handle constructor declarations.
+ default values
+ if-null and set-if-null

R=het@google.com

Review URL: https://codereview.chromium.org/2396173003 .
2016-10-10 11:35:54 +02:00
Johnni Winther 9c1ad56116 Handle const constructor invocation in kernel_impact.
This includes a move toward registering the type together with constructors which is need for this CL and (later) for not registering classes with factories as instantiated.

R=het@google.com

Review URL: https://codereview.chromium.org/2392943003 .
2016-10-10 11:03:11 +02:00
Stephen Adams e60fee914a Bug fix - use type of input, not type of result, for throw-on-null check
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2396323004 .
2016-10-09 00:31:56 -07:00
Stephen Adams 808c35cbee String.codeUnitAt has no side-effects
BUG=

Review URL: https://codereview.chromium.org/2401573004 .
2016-10-08 12:39:47 -07:00
Stephen Adams c91cbe1fc5 dart2js: Constant fold num.round()
Also num.round() is pure

R=sigmund@google.com

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

Review URL: https://codereview.chromium.org/2400853003 .

Reverted:  https://github.com/dart-lang/sdk/commit/2eadef53b722dede80153450900bf86497d13b8a
2016-10-07 18:22:52 -07:00
Stephen Adams 2eadef53b7 Revert "dart2js: Constant fold num.round()"
This reverts commit 3d28d08413.

It appears that Safari does not round the same as other browsers.

TBR=sigmund@google.com

Review URL: https://codereview.chromium.org/2395243008 .
2016-10-07 16:59:46 -07:00
Stephen Adams 0eae263076 Optimize out checkInt, checkNum and checkString
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2392343004 .
2016-10-07 15:18:07 -07:00
Stephen Adams 3d28d08413 dart2js: Constant fold num.round()
Also num.round() is pure

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2400853003 .
2016-10-07 13:39:20 -07:00
Johnni Winther 177dee8f16 Fix access to ClosureToClassMap
- avoid abstract members
- pull ClosureClassElement info from its methodElement

Review URL: https://codereview.chromium.org/2400153002 .
2016-10-07 12:01:01 +02:00
Johnni Winther dd2f0a9bd0 Eagerly compute closure classes
- and use elements instead of nodes as key

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2387353002 .
2016-10-07 10:53:34 +02:00
Harry Terkelsen 8d746645e3 Include ClosureInfo in dump info.
Uses the 0.5.0 version of dart2js_info

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2398133002 .
2016-10-06 13:48:52 -07:00
Stephen Adams 646af36e93 Improvement to SsaLoadElimination
nonEscapingReceivers was always empty at the top of a loop, making
scalar replacement candidates susceptible to spurious may-alias
invalidations.

R=het@google.com

Review URL: https://codereview.chromium.org/2395623002 .
2016-10-05 10:03:24 -07:00
Johnni Winther 2595d34940 Handle invalid default cases.
Review URL: https://codereview.chromium.org/2392303002 .
2016-10-05 12:11:08 +02:00
Johnni Winther 1b2e857f19 Roll kernel to latest
+ fix default constructor encoding
+ match fall-through error handling
+ handle typedef tests
+ speed up visitor_test by reusing the Compiler object

R=het@google.com

Review URL: https://codereview.chromium.org/2392863002 .
2016-10-05 10:36:37 +02:00
Harry Terkelsen 90b54ed78b roll dart2js_info to 0.3.0
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2379573010 .
2016-09-30 16:02:55 -07:00
Johnni Winther c3421b5586 Rename Universe to WorldBuilder.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2381793003 .
2016-09-30 10:34:07 +02:00
Johnni Winther ead7f7030a Remove Enqueuer argument from Backend.registerStaticUse
- and from CustomElementsAnalysis, TypeVariableHandler, and LookupMapAnalysis methods

R=sigmund@google.com

Review URL: https://codereview.chromium.org/2378063002 .
2016-09-30 10:26:03 +02:00
Johnni Winther 3fb04e3495 Handle getters/setters and try in kernel_impact.
R=het@google.com

Review URL: https://codereview.chromium.org/2375613003 .
2016-09-30 10:03:01 +02:00