Commit Graph

52 Commits

Author SHA1 Message Date
Vijay Menon c1d45769c3 Inline constant values
Change-Id: Iee929bc64c152be989e6e7ba38132f806c33c7e0
Reviewed-on: https://dart-review.googlesource.com/11960
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Jennifer Messerly <jmesserly@google.com>
2017-10-10 13:21:41 +00:00
Jennifer Messerly ab226fd40c optimize Object members in DDC
This should improve performance of these members in most cases:
- toString
- operator ==
- hashCode
- runtimeType
- noSuchMethod

The helpers for checking `null` and then dispatching to the method are now very small again. Also, because we can lookup symbolized names always, we can start taking advantage of this in our Map/Set implementations (for a follow up CL).

This also improves correctness of these helpers given JavaScript objects; we were previously falling back to calling a Dart method name like `.hashCode`, which is incorrect (except for `toString` where fallback is probably the correct behavior).

Change-Id: I39cbc80ca3e93ca7672652610b02bce899894da1
Reviewed-on: https://dart-review.googlesource.com/3427
Commit-Queue: Jennifer Messerly <jmesserly@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2017-09-06 08:12:11 +00:00
Jennifer Messerly 353583fb10 fix how DDC finds its undefined constant
R=vsm@google.com

Review-Url: https://codereview.chromium.org/3009733002 .
2017-08-29 14:16:39 -07:00
Leaf Petersen 1b8f4ac1e7 Optimize DDC private runtime library files.
Eliminate numerous type checks not needed in strong mode.  Use
private nullability annotations instead of inline JS to mark known
non-null variables, and to make the compiler generate null checks
for null checked variables. Use nullability annotations and code refactoring to
remove redundant null checks and to move checks out of loops.

BUG=
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2994203002 .
2017-08-23 10:28:45 -07:00
Jennifer Messerly ed5ced82b1 Re-land "fix #30423, covariant parameter tearoff type should be Object"
This is the original CL plus status file fixes.

Disables auto-generated function_type tests that are not working for the Dart 2 runtime behavior, and filed #30462 to track. Also removes the separate status that was skipping these tests in DDC when $checked was unset. $checked is not a thing for Dart 2, and DDC test status should never depend on it.

This reverts commit 1b0b1a4913.

R=leafp@google.com

Review-Url: https://codereview.chromium.org/3001053002 .
2017-08-16 23:23:36 -07:00
Brian Wilkerson 1b0b1a4913 Gardening: Revert "fix #30423, covariant parameter tearoff type should be Object" (TBR)
Review-Url: https://codereview.chromium.org/2995973002 .
2017-08-15 17:02:49 -07:00
Jennifer Messerly d09868c02f fix #30423, covariant parameter tearoff type should be Object
some tests needed to be updated to reflect the informal spec semantics.

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

Review-Url: https://codereview.chromium.org/2995813002 .
2017-08-15 14:27:06 -07:00
Jennifer Messerly 58a6227198 Use status files for DDC's presubmit script/travis bot
This only handles compile time errors & compiler crashes. It does not yet support status files at runtime, that is still hard coded in language_tests.js. Some preliminary support for runtime status is there, but it's not enabled yet.

This also updates *_strong.status to reflect current test behavior. It looks like those files have not been triaged in a while.

R=rnystrom@google.com

Review-Url: https://codereview.chromium.org/2987093002 .
2017-08-01 16:36:17 -07:00
Jennifer Messerly 90380dfdfa fix #27259, implement covariance checking for strong mode and DDC
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2954523002 .
2017-07-06 14:31:35 -07:00
Jennifer Messerly 5533a256cb fix #30030, fix #27327 - fix tearoffs and various Object member bugs
this includes various cleanups found along the way:
* various issues with JS annotations, see #30043
* getGenericClass is now optimized when used in a JS builtin with a Type literal
* typed list literals should be slightly faster to create
* memoized getters used by dart:_runtime should be faster
* registerExtension should be a tad faster, and now understands JSArray
* dart.bind "safeName" hack gone in codegenerator
* JSArray<E>.runtimeType returns List<E>
* JSArray<E>.noSuchMethod works
* cleans up code that generates `setExtensionBaseClass` (used only by JSArray)
* _throwUnsafe helper for generating a `throw` in --unsafe compile mode
* fix tearoff of JS interop types (_emitSimpleIdentifier)
* fix TODO about splitting LazyJSType and AnonymousJSType
* fix is/as/cast methods on TypeRep and related classes
* fix codegenerator to not tearoff "hashCode" and "runtimeType" (they are not methods)
* fix NoSuchMethodError.toString()   (update via dart2js sdk impl)

R=vsm@google.com

Review-Url: https://codereview.chromium.org/2962263002 .
2017-07-05 14:17:53 -07:00
Leaf Petersen 6f73694bb7 Generate better code for '==', core.identical, and dart.test.
Avoid falling back to the dart.equal runtime helper where possible based on static types.  Also uses JS `==` or `===` in some cases.

Treat core.identical as a compiler intrinsic, based on type.

Make dart.test assume correct types, use dart.dtest for combined cast and nullability check only when required.

Fixes https://github.com/dart-lang/sdk/issues/29851
Fixes https://github.com/dart-lang/sdk/issues/29772
BUG=
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2926613003 .
2017-06-30 15:04:29 -07:00
Jennifer Messerly 334354f968 fix #29753, use ES5 constructors for ddc
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2934623003 .
2017-06-12 15:31:32 -07:00
Leaf Petersen cb8cc2526b Add codegen test for equality.
Adds a DDC test tracking the generated code and its correctness. Some
test harness changes to support running codegen tests.

BUG=
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2930733002 .
2017-06-07 12:42:30 -07:00
Jennifer Messerly 99d5344463 fix "unresolved names" code generation
now unsafe-force-compile will generate a throw rather than a free floating name

R=vsm@google.com

Review-Url: https://codereview.chromium.org/2920223009 .
2017-06-06 15:53:30 -07:00
Jennifer Messerly 811a9eed1d Revert "Revert "fix #27256, track type bounds for generic functions""
This reverts commit 3a23e604e2.

The problem was unrelated to the CL; it appears to be a dart:async break of package:async.

In the meantime we have turned on --unsafe-force-compile to DDC's shapshotting step

Review-Url: https://codereview.chromium.org/2869733006 .
2017-05-09 14:20:25 -07:00
Alan Knight 3a23e604e2 Revert "fix #27256, track type bounds for generic functions"
This reverts commit b58f826976.

BUG=

Review URL: https://codereview.chromium.org/2870543005 .
2017-05-09 12:58:03 -07:00
Jennifer Messerly b58f826976 fix #27256, track type bounds for generic functions
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2867493002 .
2017-05-09 11:42:40 -07:00
Jennifer Messerly eeb0e1d2ae fix #27258, don't allow dynamic set of a final field
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2847893002 .
2017-05-01 15:36:32 -07:00
Jennifer Messerly b76e2d67cf fix #29346, ensure all nodes are implemented by DDC's code generator
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2822633003 .
2017-04-14 10:10:50 -07:00
Vijay Menon 5c3bcff375 DDC fix for foreign futures
Fixes #29287

R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2804113002 .
2017-04-06 14:52:59 -07:00
Jennifer Messerly e4e7dffadb fix #29182, generate top level const fields lazily
This fixes an ordering issue, but also may help load time.

R=vsm@google.com

Review-Url: https://codereview.chromium.org/2797443007 .
2017-04-04 16:18:46 -07:00
Jennifer Messerly 1c504f8945 Fix #28120, strong mode allows field overrides
Fix #28119, DDC supports field overrides without @virtual
Fix #28801, devirtualize private fields in DDC where possible
Fix #28589, stop supporting @virtual in strong mode

R=leafp@google.com, vsm@google.com

Review-Url: https://codereview.chromium.org/2781443003 .
2017-03-28 10:26:36 -07:00
Jennifer Messerly f021a7019b fixes #27586, prefer downwards context type in generic inference
fixes #27625, Object constraints were not tracked in inference
fixes #27933, pin return type from downwards inference

We now prefer to pick the bound (lower or upper) that had some information on, and it also improves inference error messages somewhat (still a ways to go).

The way this works is we now have a type representing an unknown type: ?. We use ? when performing downward inference steps, instead of `dynamic`. This allows more accurate tracking of type constraints.

For example: given:

    var x = await Future.wait([a, b]);

Future.wait<T>'s argument type is Iterable<Future<T>>. Since we didn't know T, we previously pushed down Iterable<Future<dynamic>>. The dynamic caused loss of information. Now we push down Iterable<Future<?>>, allowing us to infer the right type there.

R=leafp@google.com, vsm@google.com

Review-Url: https://codereview.chromium.org/2456803004 .
2017-03-17 16:59:56 -07:00
Vijay Menon 2fd1f5ebf1 Fix FutureOr runtime check
Fixes #29062

This is taken straight from Jen's CL here:

https://codereview.chromium.org/2456803004/

R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2750393003 .
2017-03-16 12:54:22 -07:00
Vijay Menon f331ecea20 Invoke native methods directly
In DDC, if the receiver is typed and the target method simply forwards to a JS call, invoke that call directly instead of via a symbol.

This is a step toward #28307.

Paul: can you look the the analyzer / summary code change?

dart:html uses "native".  other libraries (e.g., typed_data) use "external" for more or less the same thing.  The analyzer element model doesn't provide a way to test for "native" methods, but it does for "external".  I map native to external here.  Not sure if it's better to treat them as separate (I believe native predated external).  Longer term, it may make sense to try to remove "native" in favor of "external".

R=brianwilkerson@google.com, jacobr@google.com, jmesserly@google.com, paulberry@google.com

Review-Url: https://codereview.chromium.org/2748713002 .
2017-03-13 15:11:37 -07:00
Jacob Richman 1f38879094 Inline source maps as part of each script.
Unfortunately this is required as even with ideal caching, performing
XHRs to load all source maps increased load times by ~5 seconds for large
applications. Performance hit is now minimal.

BUG=

Review-Url: https://codereview.chromium.org/2747513003 .
Review-Url: https://codereview.chromium.org/2746033003 .
2017-03-13 10:46:02 -07:00
Jacob Richman a6a206062d Custom formatter cleanup Fix case where displaying a class constructor generated unreadable huge output. Fix case where exceptions were throw. Correct display of statics, fix indentation bugs. Add improved custom formatter test to main repro. As a drive by fix, switch hashCode to use a symbol instead of the name $identityHash as $identityHash was making custom formatter test output unstable.
BUG=
R=vsm@google.com

Review-Url: https://codereview.chromium.org/2703263002 .
2017-02-28 17:47:53 -08:00
Leaf Petersen ef120f105f When metadata is not requested, elide signature information that is
not needed for dynamic checks (static fields/getters/setters and constructors).

BUG=
R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2711253004 .
2017-02-24 12:59:09 -08:00
Vijay Menon 1ec614fd7b Enable DDC output to run on v8/d8 using ES6 modules
Fixes #27309

V8 / D8 tip supports ES6 modules natively.  It's a little cumbersome
to set up, but hello world runs.  :-)

> ln -s $DDC_PATH/lib/js/es6/ddc_sdk.js ddc_sdk
> dart  $DDC_PATH/bin/dartdevc.dart --dart-sdk-summary $DDC_PATH/lib/sdk/ddc_sdk.sum --modules es6 -o hello hello.dart
> cat > run.js
import { hello } from 'hello';
hello.main();
> d8 --module run.js

R=jmesserly@google.com

Review-Url: https://codereview.chromium.org/2701963002 .
2017-02-17 16:54:21 -08:00
Leaf Petersen a3b4366f11 Infer Null for return type of functions with empty returns.
This allows inference to infer Null as the return type of functions
which have no return statements, or which return with no value.

Also allows inference to propagate Null.

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

BUG=
R=brianwilkerson@google.com, jmesserly@google.com

Review-Url: https://codereview.chromium.org/2667343005 .
2017-02-06 12:24:39 -08:00
Jacob Richman 1b339deab2 Support lazy JS types.
BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/2515353003 .
2016-11-22 10:55:35 -08:00
Jacob Richman 3356f82eb3 Fix crashing bug for closures of the form () { return; }
BUG=
R=jmesserly@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/2484913004 .
2016-11-08 15:14:10 -08:00
Jennifer Messerly 5111675810 fix #27631, get/set methods no longer shadow index operator
R=rnystrom@google.com

Review URL: https://codereview.chromium.org/2435163002 .
2016-10-20 15:45:29 -07:00
Bob Nystrom 2305865365 Start cleaning up the HTML tests.
My initial goal was just to move some of the HTML tests off unittest,
but that ended up slurping in some other changes as well. I haven't
finished going through all of the tests, but this puts the
infrastructure in place and fixes a batch of them. I'll do more next.

Changes:

- Add a "minitest" package. This shims just enough of the unittest/test
  API to make it easy to swap it out for unittest without having to
  rework the entire test.

- Go through the HTML tests from A-J and change them to use minitest
  when possible. The ones that aren't possible use asynchrony.
  Minitest doesn't support async tests (yet, maybe).

- Triage those tests and enable ones that are passing. Mark them failing
  if failing. Filed a couple of tracking bugs for the common issues,
  but for other cases, I just left a comment.

- In the process of this, I went ahead and make some of the affected
  tests strong mode clean if they weren't already and it was easy.

- Synchronize changes between dev_compiler's fork of expect and
  pkg/expect. We'll want to unfork those at some point. D-:

This gets dev_compiler from 1985 tests to 2042.

R=jacobr@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/2413073002 .
2016-10-13 08:47:27 -07:00
Bob Nystrom b30571884f Use expect instead of unittest for json_lib_test.
One step closer to removing the deprecated unittest.

R=vsm@google.com

Review URL: https://codereview.chromium.org/2402123002 .
2016-10-10 09:42:40 -07:00
John Messerly 361cd4c61c fix #27408, reverts "ignore dynamic in inference"
this reverts https://github.com/dart-lang/sdk/commit/8c25a41accf52265a89bcc2ffac3bdb7c271f9fb

R=vsm@google.com

Review URL: https://codereview.chromium.org/2360973004 .
2016-09-23 17:01:33 -07:00
John Messerly aa85651820 fix #27403, use AST summaries in DDC
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2353133004 .
2016-09-20 17:55:09 -07:00
Vijay Menon 9af2fb0115 More DDC mirrors support
(Note, this is a straight migration of the old DDC repo CL. :-))

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/2301973002 .
2016-09-01 10:13:31 -07:00
Vijay Menon 6a1a03add4 Make source map paths relative
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/2288453002 .
2016-08-26 16:31:53 -07:00
John Messerly c1139934a7 fix #626, add AMD module format and make it default
R=nweiz@google.com, vsm@google.com

Review URL: https://codereview.chromium.org/2249233002 .
2016-08-25 09:39:36 -07:00
Vijay Menon 8442efa4d3 Support call methods on functions
Fixes #624

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/2255993002 .
2016-08-18 07:51:17 -07:00
John Messerly 90a8667c06 remove unused test baseline files 2016-08-16 08:22:18 -07:00
John Messerly 0aa5cbd128 fix #620, infer the input files from sources
also simplifies build of packages used by our tests
this caused a bunch of tests that use parts to start passing

R=nweiz@google.com

Review URL: https://codereview.chromium.org/2234343003 .
2016-08-11 13:19:36 -07:00
Vijay Menon 8fec051a8e Mark recursive_inheritance_test as passing
This will get the dev and master bots green.

Will need to bump the pubspec on analyzer (once published) to make stable green after this.

R=leafp@google.com

Review URL: https://codereview.chromium.org/2214263005 .
2016-08-05 09:35:01 -07:00
Vijay Menon 3ddb76b95c Reify type params on map literals
Fixes #621

R=jmesserly@google.com, leafp@google.com

Review URL: https://codereview.chromium.org/2211293002 .
2016-08-05 07:16:02 -07:00
Vijay Menon 0fd3e8821c Fix wrt analyzer tip
This sidesteps #618 for now.

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/2209473002 .
2016-08-02 14:42:06 -07:00
John Messerly e51f9de339 fixes #616, statics on callable functions
also fixes `this` for them

R=vsm@google.com

Review URL: https://codereview.chromium.org/2200913002 .
2016-08-01 17:12:37 -07:00
John Messerly 344124e4a1 fix optional params to mock methods, allow all signatures
switches to use the same technique as `dsend`

R=vsm@google.com

Review URL: https://codereview.chromium.org/2201973002 .
2016-08-01 16:21:59 -07:00
Vijay Menon b2353d7513 Fix analyzer error
This is breaking travis.

TBR=jmesserly@google.com

Review URL: https://codereview.chromium.org/2199473002 .
2016-07-29 14:31:46 -07:00
John Messerly 0f29ee9618 Remove DDC custom error list now that strong mode analyzer handles it
R=leafp@google.com

Review URL: https://codereview.chromium.org/2102053003 .
2016-07-27 13:10:57 -07:00