Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(618)

Issue 1138793002: Tag closures with their types (Closed)

Created:
5 years, 7 months ago by Leaf
Modified:
5 years, 7 months ago
Reviewers:
vsm, Jennifer Messerly
CC:
dev-compiler+reviews_dartlang.org
Base URL:
git@github.com:dart-lang/dev_compiler.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

This CL implements tagging of functions and methods with function types. For every class, we now generate a setSignature call which attaches properties to the constructor recording the method signatures, the static function signatures, and the names of all of the static methods. This call also attaches a getter to every static method which returns the type of the function. Methods are only decorated with runtime types when torn off. At a tear-off, the type is looked up in the constructor, and then attached to the bound function. Top level functions and statement level functions get annotated with their type immediately after their declaration. We could consider moving all of the top level function annotations to the end of the file, but for now I've left it inline. Closures (function expressions) get wrapped in calls to a dart.fn helper, with type information attached in one of various forms. This is currently the least attractive part of this CL. We may want to iterate on the syntax for this. I've added some support for NSM checking to the dsend/dcall case as well. We may wish to iterate on the syntax, and on the runtime representation of types, but this should move us forward from a functionality standpoint. BUG= R=jmesserly@google.com, vsm@google.com Committed: https://github.com/dart-lang/dev_compiler/commit/636b3401b62022f7ef563c720baaf1e200c6f8f1

Patch Set 1 #

Patch Set 2 : Full function type reification #

Patch Set 3 : Fix statements, eliminate returns #

Patch Set 4 : Dynamic tearoffs #

Patch Set 5 : Handle no such method in dcall/dsend #

Patch Set 6 : Remove extraneous comment #

Patch Set 7 : Rebase #

Total comments: 46

Patch Set 8 : Address minor comments #

Patch Set 9 : Address jmesserly's comments #

Total comments: 4

Patch Set 10 : More comment fixes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+4744 lines, -914 lines) Patch
M lib/runtime/dart/_foreign_helper.js View 1 2 2 chunks +31 lines, -29 lines 0 comments Download
M lib/runtime/dart/_interceptors.js View 1 2 15 chunks +152 lines, -17 lines 0 comments Download
M lib/runtime/dart/_internal.js View 1 2 36 chunks +270 lines, -2 lines 0 comments Download
M lib/runtime/dart/_isolate_helper.js View 1 2 27 chunks +184 lines, -35 lines 0 comments Download
M lib/runtime/dart/_js_helper.js View 1 2 111 chunks +505 lines, -220 lines 0 comments Download
M lib/runtime/dart/_js_names.js View 1 4 chunks +8 lines, -8 lines 0 comments Download
M lib/runtime/dart/_js_primitives.js View 1 2 chunks +4 lines, -3 lines 0 comments Download
M lib/runtime/dart/_native_typed_data.js View 1 2 23 chunks +293 lines, -3 lines 0 comments Download
M lib/runtime/dart/async.js View 1 2 171 chunks +824 lines, -353 lines 0 comments Download
M lib/runtime/dart/collection.js View 1 2 81 chunks +649 lines, -29 lines 0 comments Download
M lib/runtime/dart/convert.js View 1 2 76 chunks +418 lines, -22 lines 0 comments Download
M lib/runtime/dart/core.js View 1 2 68 chunks +382 lines, -39 lines 0 comments Download
M lib/runtime/dart/isolate.js View 1 2 11 chunks +41 lines, -10 lines 0 comments Download
M lib/runtime/dart/math.js View 1 2 11 chunks +63 lines, -14 lines 0 comments Download
M lib/runtime/dart/typed_data.js View 1 20 chunks +21 lines, -0 lines 0 comments Download
M lib/runtime/dart_runtime.js View 1 2 3 4 5 6 7 8 12 chunks +214 lines, -28 lines 0 comments Download
M lib/src/codegen/js_codegen.dart View 1 2 3 4 5 6 7 8 11 chunks +129 lines, -38 lines 0 comments Download
M lib/src/codegen/reify_coercions.dart View 1 1 chunk +1 line, -0 lines 0 comments Download
M lib/src/js/nodes.dart View 1 2 3 4 5 6 7 8 1 chunk +10 lines, -1 line 0 comments Download
M lib/src/js/printer.dart View 1 2 3 4 5 6 7 8 9 2 chunks +7 lines, -4 lines 0 comments Download
M test/browser/runtime_tests.js View 1 2 3 4 5 6 7 8 9 3 chunks +271 lines, -9 lines 0 comments Download
M test/codegen/expect/8invalid-chars.in+file_name.js View 1 1 chunk +1 line, -1 line 0 comments Download
M test/codegen/expect/BenchmarkBase.js View 1 2 3 chunks +25 lines, -4 lines 0 comments Download
M test/codegen/expect/DeltaBlue.js View 1 2 15 chunks +98 lines, -4 lines 0 comments Download
M test/codegen/expect/cascade.js View 1 2 7 chunks +17 lines, -12 lines 0 comments Download
M test/codegen/expect/constructors.js View 1 2 6 chunks +27 lines, -0 lines 0 comments Download
M test/codegen/expect/covariance.js View 1 2 2 chunks +10 lines, -1 line 0 comments Download
M test/codegen/expect/dir/html_input_a.js View 1 1 chunk +1 line, -1 line 0 comments Download
M test/codegen/expect/dir/html_input_d.js View 1 1 chunk +4 lines, -3 lines 0 comments Download
M test/codegen/expect/fieldtest.js View 1 2 6 chunks +12 lines, -5 lines 0 comments Download
M test/codegen/expect/map_keys.js View 1 2 chunks +1 line, -1 line 0 comments Download
M test/codegen/expect/methods.js View 1 2 1 chunk +19 lines, -1 line 0 comments Download
M test/codegen/expect/methods.txt View 1 1 chunk +3 lines, -0 lines 0 comments Download
M test/codegen/expect/misc.js View 1 2 3 4 5 6 7 3 chunks +3 lines, -1 line 0 comments Download
M test/codegen/expect/names.js View 1 2 4 chunks +10 lines, -2 lines 0 comments Download
M test/codegen/expect/opassign.js View 1 2 chunks +3 lines, -2 lines 0 comments Download
M test/codegen/expect/sunflower/dom.js View 1 2 chunks +6 lines, -0 lines 0 comments Download
M test/codegen/expect/sunflower/sunflower.js View 1 2 6 chunks +9 lines, -4 lines 0 comments Download
M test/codegen/expect/temps.js View 1 2 chunks +4 lines, -2 lines 0 comments Download
M test/codegen/expect/try_catch.js View 1 7 chunks +6 lines, -6 lines 0 comments Download
M test/codegen/methods.dart View 1 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 14 (1 generated)
Leaf
5 years, 7 months ago (2015-05-15 22:47:08 UTC) #2
vsm
lgtm General comment - mainly it'd be nice to figure out how to make this ...
5 years, 7 months ago (2015-05-18 17:35:11 UTC) #3
Jennifer Messerly
On 2015/05/18 17:35:11, vsm wrote: > lgtm > > General comment - mainly it'd be ...
5 years, 7 months ago (2015-05-18 17:37:06 UTC) #4
Jennifer Messerly
https://codereview.chromium.org/1138793002/diff/120001/lib/runtime/dart/core.js File lib/runtime/dart/core.js (right): https://codereview.chromium.org/1138793002/diff/120001/lib/runtime/dart/core.js#newcode36 lib/runtime/dart/core.js:36: methods: () => ({ could this level be removed? ...
5 years, 7 months ago (2015-05-18 17:52:53 UTC) #5
Leaf
https://codereview.chromium.org/1138793002/diff/120001/lib/runtime/dart/core.js File lib/runtime/dart/core.js (right): https://codereview.chromium.org/1138793002/diff/120001/lib/runtime/dart/core.js#newcode36 lib/runtime/dart/core.js:36: methods: () => ({ On 2015/05/18 17:52:52, John Messerly ...
5 years, 7 months ago (2015-05-19 00:02:21 UTC) #6
Jennifer Messerly
https://codereview.chromium.org/1138793002/diff/120001/lib/runtime/dart/core.js File lib/runtime/dart/core.js (right): https://codereview.chromium.org/1138793002/diff/120001/lib/runtime/dart/core.js#newcode111 lib/runtime/dart/core.js:111: names: ['compare'] On 2015/05/19 00:02:20, leafp wrote: > On ...
5 years, 7 months ago (2015-05-19 16:32:50 UTC) #7
Jennifer Messerly
one more design-y comment. I'll take a look at the impl too now https://codereview.chromium.org/1138793002/diff/120001/lib/runtime/dart/core.js File ...
5 years, 7 months ago (2015-05-19 16:34:39 UTC) #8
Jennifer Messerly
https://codereview.chromium.org/1138793002/diff/120001/lib/runtime/dart_runtime.js File lib/runtime/dart_runtime.js (right): https://codereview.chromium.org/1138793002/diff/120001/lib/runtime/dart_runtime.js#newcode870 lib/runtime/dart_runtime.js:870: for (let m of mixins) { this should be ...
5 years, 7 months ago (2015-05-19 18:19:01 UTC) #9
Jennifer Messerly
Forgot high level comment: this looks really good. Generated code style improvements are up to ...
5 years, 7 months ago (2015-05-19 18:22:14 UTC) #10
Leaf
Thanks for the comments - very helpful. I'll revisit the static signatures in a follow ...
5 years, 7 months ago (2015-05-19 22:31:13 UTC) #11
Jennifer Messerly
changes lgtm. by the way, another thought on less type info: we may be able ...
5 years, 7 months ago (2015-05-19 22:49:48 UTC) #12
Leaf
Okay, I'm going to land this now, will follow on to address the remaining comments. ...
5 years, 7 months ago (2015-05-19 23:24:08 UTC) #13
Leaf
5 years, 7 months ago (2015-05-19 23:24:40 UTC) #14
Message was sent while issue was closed.
Committed patchset #10 (id:180001) manually as
636b3401b62022f7ef563c720baaf1e200c6f8f1 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698