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

Issue 9750003: Write our JS blobs for handling native classes in Dart. (Closed)

Created:
8 years, 9 months ago by ngeoffray
Modified:
8 years, 9 months ago
CC:
reviews_dartlang.org, Lasse Reichstein Nielsen, karlklose
Visibility:
Public.

Description

Write our JS blobs for handling native classes in Dart. Committed: https://code.google.com/p/dart/source/detail?r=5867

Patch Set 1 : #

Total comments: 4

Patch Set 2 : #

Total comments: 2

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Total comments: 19

Patch Set 6 : #

Total comments: 34

Patch Set 7 : #

Patch Set 8 : #

Patch Set 9 : #

Total comments: 6

Patch Set 10 : #

Total comments: 29
Unified diffs Side-by-side diffs Delta from patch set Stats (+409 lines, -284 lines) Patch
M frog/leg/compiler.dart View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -0 lines 0 comments Download
M frog/leg/emitter.dart View 1 2 3 4 5 6 7 8 6 chunks +28 lines, -20 lines 0 comments Download
M frog/leg/lib/js_helper.dart View 1 2 3 4 5 6 7 8 4 chunks +4 lines, -3 lines 2 comments Download
A frog/leg/lib/native_helper.dart View 1 2 3 4 5 6 7 8 9 1 chunk +277 lines, -0 lines 25 comments Download
M frog/leg/native_emitter.dart View 1 2 3 4 5 6 7 8 9 9 chunks +36 lines, -246 lines 2 comments Download
M frog/leg/native_handler.dart View 1 2 3 4 5 6 7 8 9 2 chunks +10 lines, -0 lines 0 comments Download
M frog/leg/ssa/builder.dart View 1 2 3 4 5 6 7 8 2 chunks +50 lines, -15 lines 0 comments Download
M frog/leg/ssa/codegen.dart View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 22 (0 generated)
ngeoffray
8 years, 9 months ago (2012-03-20 11:09:04 UTC) #1
ahe
Initial comments. https://chromiumcodereview.appspot.com/9750003/diff/3009/frog/leg/lib/js_helper.dart File frog/leg/lib/js_helper.dart (right): https://chromiumcodereview.appspot.com/9750003/diff/3009/frog/leg/lib/js_helper.dart#newcode1183 frog/leg/lib/js_helper.dart:1183: JS('void', @'''#.toString = #''', jsError, toStringWrapper); Use ...
8 years, 9 months ago (2012-03-20 11:13:43 UTC) #2
Lasse Reichstein Nielsen
dbc. https://chromiumcodereview.appspot.com/9750003/diff/3009/frog/leg/ssa/builder.dart File frog/leg/ssa/builder.dart (right): https://chromiumcodereview.appspot.com/9750003/diff/3009/frog/leg/ssa/builder.dart#newcode1793 frog/leg/ssa/builder.dart:1793: if (type is !LiteralString) { No need for ...
8 years, 9 months ago (2012-03-20 11:17:22 UTC) #3
ngeoffray
https://chromiumcodereview.appspot.com/9750003/diff/3009/frog/leg/lib/js_helper.dart File frog/leg/lib/js_helper.dart (right): https://chromiumcodereview.appspot.com/9750003/diff/3009/frog/leg/lib/js_helper.dart#newcode1183 frog/leg/lib/js_helper.dart:1183: JS('void', @'''#.toString = #''', jsError, toStringWrapper); On 2012/03/20 11:13:43, ...
8 years, 9 months ago (2012-03-20 11:21:31 UTC) #4
Lasse Reichstein Nielsen
https://chromiumcodereview.appspot.com/9750003/diff/6001/frog/leg/ssa/builder.dart File frog/leg/ssa/builder.dart (right): https://chromiumcodereview.appspot.com/9750003/diff/6001/frog/leg/ssa/builder.dart#newcode1790 frog/leg/ssa/builder.dart:1790: if (literal is !StringNode || literal.dynamic.isInterpolation) { this .dynamic ...
8 years, 9 months ago (2012-03-20 12:01:23 UTC) #5
ngeoffray
https://chromiumcodereview.appspot.com/9750003/diff/6001/frog/leg/ssa/builder.dart File frog/leg/ssa/builder.dart (right): https://chromiumcodereview.appspot.com/9750003/diff/6001/frog/leg/ssa/builder.dart#newcode1790 frog/leg/ssa/builder.dart:1790: if (literal is !StringNode || literal.dynamic.isInterpolation) { On 2012/03/20 ...
8 years, 9 months ago (2012-03-20 12:09:05 UTC) #6
ngeoffray
ping
8 years, 9 months ago (2012-03-26 08:26:24 UTC) #7
ahe
Comments so far. Sorry for forgetting about this. https://chromiumcodereview.appspot.com/9750003/diff/10001/frog/leg/lib/js_helper.dart File frog/leg/lib/js_helper.dart (right): https://chromiumcodereview.appspot.com/9750003/diff/10001/frog/leg/lib/js_helper.dart#newcode1183 frog/leg/lib/js_helper.dart:1183: JS('void', ...
8 years, 9 months ago (2012-03-26 13:01:55 UTC) #8
ngeoffray
https://chromiumcodereview.appspot.com/9750003/diff/10001/frog/leg/lib/js_helper.dart File frog/leg/lib/js_helper.dart (right): https://chromiumcodereview.appspot.com/9750003/diff/10001/frog/leg/lib/js_helper.dart#newcode1183 frog/leg/lib/js_helper.dart:1183: JS('void', @'''#.toString = #''', jsError, JS_TO_CLOSURE(toStringWrapper)); On 2012/03/26 13:01:55, ...
8 years, 9 months ago (2012-03-26 13:32:20 UTC) #9
ahe
More comments. Still working my way through the "native" functions. https://chromiumcodereview.appspot.com/9750003/diff/10001/frog/leg/ssa/builder.dart File frog/leg/ssa/builder.dart (right): https://chromiumcodereview.appspot.com/9750003/diff/10001/frog/leg/ssa/builder.dart#newcode1856 ...
8 years, 9 months ago (2012-03-26 13:43:45 UTC) #10
ngeoffray
https://chromiumcodereview.appspot.com/9750003/diff/10001/frog/leg/ssa/builder.dart File frog/leg/ssa/builder.dart (right): https://chromiumcodereview.appspot.com/9750003/diff/10001/frog/leg/ssa/builder.dart#newcode1856 frog/leg/ssa/builder.dart:1856: addGenericSendArgumentsToList(link, inputs); On 2012/03/26 13:43:45, ahe wrote: > if ...
8 years, 9 months ago (2012-03-26 13:55:32 UTC) #11
ahe
More preliminary comments. Still working my way through the blobs. https://chromiumcodereview.appspot.com/9750003/diff/10001/frog/leg/ssa/builder.dart File frog/leg/ssa/builder.dart (right): https://chromiumcodereview.appspot.com/9750003/diff/10001/frog/leg/ssa/builder.dart#newcode1982 ...
8 years, 9 months ago (2012-03-26 14:01:23 UTC) #12
ngeoffray
https://chromiumcodereview.appspot.com/9750003/diff/10001/frog/leg/ssa/builder.dart File frog/leg/ssa/builder.dart (right): https://chromiumcodereview.appspot.com/9750003/diff/10001/frog/leg/ssa/builder.dart#newcode1982 frog/leg/ssa/builder.dart:1982: if (element === compiler.findHelper(const SourceString('JS'))) { On 2012/03/26 14:01:23, ...
8 years, 9 months ago (2012-03-26 14:13:43 UTC) #13
ahe
LGTM, but I still don't feel I fully understand this. https://chromiumcodereview.appspot.com/9750003/diff/12003/frog/leg/lib/native_helper.dart File frog/leg/lib/native_helper.dart (right): https://chromiumcodereview.appspot.com/9750003/diff/12003/frog/leg/lib/native_helper.dart#newcode41 ...
8 years, 9 months ago (2012-03-26 14:57:27 UTC) #14
ngeoffray
Thanks very much Peter for all the comments. Note that I'm also trying to find ...
8 years, 9 months ago (2012-03-27 09:17:34 UTC) #15
ahe
SLGTM https://chromiumcodereview.appspot.com/9750003/diff/12003/frog/leg/lib/native_helper.dart File frog/leg/lib/native_helper.dart (right): https://chromiumcodereview.appspot.com/9750003/diff/12003/frog/leg/lib/native_helper.dart#newcode31 frog/leg/lib/native_helper.dart:31: if (JS('bool', "typeof(#) == 'function'", constructor)) { On ...
8 years, 9 months ago (2012-03-27 09:42:08 UTC) #16
ngeoffray
https://chromiumcodereview.appspot.com/9750003/diff/12003/frog/leg/lib/native_helper.dart File frog/leg/lib/native_helper.dart (right): https://chromiumcodereview.appspot.com/9750003/diff/12003/frog/leg/lib/native_helper.dart#newcode133 frog/leg/lib/native_helper.dart:133: '#(#, #, Array.prototype.slice.call(arguments));' On 2012/03/27 09:42:08, ahe wrote: > ...
8 years, 9 months ago (2012-03-27 10:37:32 UTC) #17
sra1
So how did the change affect code size? e.g. swarm (which already uses Set) and ...
8 years, 9 months ago (2012-03-27 18:05:27 UTC) #18
floitsch
LGTM. sorry for the late review. https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/lib/js_helper.dart File frog/leg/lib/js_helper.dart (right): https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/lib/js_helper.dart#newcode1191 frog/leg/lib/js_helper.dart:1191: JS('void', @'''#.toString = ...
8 years, 9 months ago (2012-03-28 23:36:33 UTC) #19
sra1
https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/lib/native_helper.dart File frog/leg/lib/native_helper.dart (right): https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/lib/native_helper.dart#newcode122 frog/leg/lib/native_helper.dart:122: if (method === null && _dynamicMetadata !== null) { ...
8 years, 9 months ago (2012-03-29 01:14:23 UTC) #20
ngeoffray
For Swarm: from 1398619 to 1401737 (+ 0.22%) with bailout methods. from 941374 to 941052 ...
8 years, 9 months ago (2012-03-29 10:20:48 UTC) #21
ngeoffray
8 years, 9 months ago (2012-03-29 11:38:39 UTC) #22
Thanks all. Follow-up CL: https://chromiumcodereview.appspot.com/9921010

https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/lib/js_hel...
File frog/leg/lib/js_helper.dart (right):

https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/lib/js_hel...
frog/leg/lib/js_helper.dart:1191: JS('void', @'''#.toString = #''', jsError,
DART_CLOSURE_TO_JS(toStringWrapper));
On 2012/03/28 23:36:33, floitsch wrote:
> 80 chars.

Done.

https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/lib/native...
File frog/leg/lib/native_helper.dart (right):

https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/lib/native...
frog/leg/lib/native_helper.dart:24: if (name == 'Document' && JS('bool',
'!!#.xmlVersion', obj)) return 'Document';
On 2012/03/28 23:36:33, floitsch wrote:
> 80 chars.

Done.

https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/lib/native...
frog/leg/lib/native_helper.dart:54: Function getTypeNameOfFunction() {
On 2012/03/28 23:36:33, floitsch wrote:
> maybe getFunctionForTypeNameOf ?
> Otherwise it reads to much as if "of function" was together.

Done.

https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/lib/native...
frog/leg/lib/native_helper.dart:117: var methods,
On 2012/03/28 23:36:33, floitsch wrote:
> Add comment what the type of methods is (a native Hashtable like {}).

Done.

https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/lib/native...
frog/leg/lib/native_helper.dart:139: '#(#, #,
Array.prototype.slice.call(arguments));'
On 2012/03/29 01:14:23, sra1 wrote:
> There is a missing exact type check here.
> 
> class A native ... {}
> class B extends A native ... {
>    foo() {...};
> }
> 
> (1) call   get_instance_of_A().dynamic.foo()  in a try-catch.
> 
> The above function will be placed on A.prototype.foo.
> 
> (2) call   get_instance_of_B().foo()
> The exception is thrown again instead of calling the correct method.
> 
> I'm fixing it in Frog, I'll ask you to review that fix, and then you can fix
it
> here.

Done.

https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/lib/native...
frog/leg/lib/native_helper.dart:186: var dartMethod = JS('var',
'Object.getPrototypeOf(#)[#]', new Object(), name);
On 2012/03/28 23:36:33, floitsch wrote:
> const Object() would work too. No preference.

Good point. Done.

https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/lib/native...
frog/leg/lib/native_helper.dart:225: if (JS('var', 'typeof(\$dynamicMetadata)')
=== 'undefined') {
On 2012/03/28 23:36:33, floitsch wrote:
> why is \$dynamicMetadata not a normal Dart global field?

Because it is shared with isolates. Making it global is not ideal, and I'll try
to see if we can get something better. I added a comment.

https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/lib/native...
frog/leg/lib/native_helper.dart:240: * class B native "*B" {}
On 2012/03/28 23:36:33, floitsch wrote:
> extends A

Done.

https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/lib/native...
frog/leg/lib/native_helper.dart:243: * ['A', 'A|B']
On 2012/03/28 23:36:33, floitsch wrote:
> explain. ex: where 'A' is the class the information is for, and 'A|B' is the
> list of subclasses.
> Also add  ['B', 'B'] ?

I'm reluctant on adding comments as this is copied-code that I haven't tried to
change, optimize, or understand yet.

AFAIK, ['B', 'B'] is not generated because it is not needed.

https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/lib/native...
frog/leg/lib/native_helper.dart:261: // Initialized by the compiler.
On 2012/03/28 23:36:33, floitsch wrote:
> Describe type. (if I see correctly a native JS hashtable of native JS
> hashtables).

This code was removed.

https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/native_emi...
File frog/leg/native_emitter.dart (right):

https://chromiumcodereview.appspot.com/9750003/diff/20004/frog/leg/native_emi...
frog/leg/native_emitter.dart:318: void assembleCode(StringBuffer other) {
On 2012/03/28 23:36:33, floitsch wrote:
> s/other/targetBuffer ?

Done.

Powered by Google App Engine
This is Rietveld 408576698