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

Issue 8467034: Isolates in frog - tweaks in existing js code to make things run (Closed)

Created:
9 years, 1 month ago by Siggi Cherem (dart-lang)
Modified:
9 years, 1 month ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Isolates in frog - tweaks in existing js code to make it run. I plan to do an actual cleanup on a second CL. Committed: https://code.google.com/p/dart/source/detail?r=1279

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : for review #

Total comments: 2

Patch Set 4 : '' #

Total comments: 35
Unified diffs Side-by-side diffs Delta from patch set Stats (+748 lines, -22658 lines) Patch
M client/samples/dartcombat/dartcombat.dart View 1 chunk +1 line, -1 line 0 comments Download
M client/samples/dartcombat/dartcombatlib.dart View 1 chunk +1 line, -1 line 0 comments Download
M client/samples/dartcombat/grids.dart View 1 chunk +1 line, -1 line 0 comments Download
M client/samples/dartcombat/views.dart View 1 chunk +1 line, -1 line 2 comments Download
M frog/frogsh View 1 2 8 chunks +515 lines, -8 lines 2 comments Download
M frog/gen.dart View 1 1 chunk +1 line, -1 line 1 comment Download
M frog/lib/core.js View 1 2 2 chunks +7 lines, -3 lines 0 comments Download
M frog/lib/corelib_impl.dart View 1 chunk +1 line, -0 lines 4 comments Download
D frog/lib/dom/html.dart View 1 chunk +0 lines, -22416 lines 0 comments Download
M frog/lib/isolate.dart View 1 7 chunks +47 lines, -25 lines 4 comments Download
M frog/lib/isolate.js View 1 2 11 chunks +96 lines, -134 lines 9 comments Download
M frog/lib/isolate_serialization.dart View 1 2 12 chunks +53 lines, -61 lines 4 comments Download
M frog/presubmit.py View 1 chunk +1 line, -1 line 0 comments Download
M frog/value.dart View 3 chunks +17 lines, -3 lines 6 comments Download
M tests/corelib/corelib.status View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M tests/isolate/isolate.status View 1 2 1 chunk +6 lines, -0 lines 1 comment Download
M tests/language/language.status View 1 2 3 1 chunk +0 lines, -1 line 2 comments Download

Messages

Total messages: 5 (0 generated)
Siggi Cherem (dart-lang)
This is only a first step: - it makes the existing js code work to ...
9 years, 1 month ago (2011-11-08 01:25:14 UTC) #1
Siggi Cherem (dart-lang)
http://codereview.chromium.org/8467034/diff/9001/frog/value.dart File frog/value.dart (right): http://codereview.chromium.org/8467034/diff/9001/frog/value.dart#newcode220 frog/value.dart:220: return _isDomCallback(toType) && !_isDomCallback(type) ? BTW, this was a ...
9 years, 1 month ago (2011-11-08 02:06:26 UTC) #2
Jennifer Messerly
lgtm http://codereview.chromium.org/8467034/diff/9001/frog/lib/corelib_impl.dart File frog/lib/corelib_impl.dart (right): http://codereview.chromium.org/8467034/diff/9001/frog/lib/corelib_impl.dart#newcode29 frog/lib/corelib_impl.dart:29: // trying to get things compiling again. This ...
9 years, 1 month ago (2011-11-08 05:04:35 UTC) #3
jimhug
LGTM! This came in far better than I'd hoped for a first commit of isolates. ...
9 years, 1 month ago (2011-11-08 15:39:00 UTC) #4
Siggi Cherem (dart-lang)
9 years, 1 month ago (2011-11-08 17:56:42 UTC) #5
http://codereview.chromium.org/8467034/diff/9001/client/samples/dartcombat/vi...
File client/samples/dartcombat/views.dart (right):

http://codereview.chromium.org/8467034/diff/9001/client/samples/dartcombat/vi...
client/samples/dartcombat/views.dart:285: completer.complete([x, y]);
On 2011/11/08 15:39:01, jimhug wrote:
> Why did you lose the const here?

Basically x, y are variables, which are not allowed to be used within const
expressions. We actually want here an immutable array (rather than a const).

http://codereview.chromium.org/8467034/diff/9001/frog/frogsh
File frog/frogsh (right):

http://codereview.chromium.org/8467034/diff/9001/frog/frogsh#newcode19176
frog/frogsh:19176: RunEntry(function () {main();}, []);
On 2011/11/08 15:39:01, jimhug wrote:
> 500 lines is a lot to add - but considering that we get a feature as big as
> isolates in return and that we have plans to reduce this overhead with time I
> think this is a fair price to pay.

Yeah - I'll be working this week on bringing this down. Hopefully to something
near-zero if you are not using any isolates in your code.

http://codereview.chromium.org/8467034/diff/9001/frog/lib/corelib_impl.dart
File frog/lib/corelib_impl.dart (right):

http://codereview.chromium.org/8467034/diff/9001/frog/lib/corelib_impl.dart#n...
frog/lib/corelib_impl.dart:29: // trying to get things compiling again.
On 2011/11/08 05:04:35, John Messerly wrote:
> This TODO can go :) ... I'll remove it in my upcoming change

:)

http://codereview.chromium.org/8467034/diff/9001/frog/lib/isolate.dart
File frog/lib/isolate.dart (right):

http://codereview.chromium.org/8467034/diff/9001/frog/lib/isolate.dart#newcode11
frog/lib/isolate.dart:11: throw "SendPort::send: Illegal replyTo type.";
On 2011/11/08 05:04:35, John Messerly wrote:
> probably want to throw an actual exception type?

will do - the current throw was basically copied over from the JS code.

http://codereview.chromium.org/8467034/diff/9001/frog/lib/isolate.dart#newcode17
frog/lib/isolate.dart:17: // TODO(sigmund): get rid of _sendNow
On 2011/11/08 05:04:35, John Messerly wrote:
> I think you can just remove it? I didn't see any callers.

Unfortunately some other code in corelib is still using this, I'll remove it
after I clean up that code.

http://codereview.chromium.org/8467034/diff/9001/frog/lib/isolate.js
File frog/lib/isolate.js (right):

http://codereview.chromium.org/8467034/diff/9001/frog/lib/isolate.js#newcode253
frog/lib/isolate.js:253: // Both, the message and the replyTo are already
serialized.
On 2011/11/08 05:04:35, John Messerly wrote:
> nit: extra comma

copy/paste :) - fixed.

http://codereview.chromium.org/8467034/diff/9001/frog/lib/isolate.js#newcode284
frog/lib/isolate.js:284: });
On 2011/11/08 05:04:35, John Messerly wrote:
> can this just be isolate.run(self) ?

good point. Done

http://codereview.chromium.org/8467034/diff/9001/frog/lib/isolate.js#newcode299
frog/lib/isolate.js:299: });
On 2011/11/08 05:04:35, John Messerly wrote:
> nit: i'd put on one line:
> 
> isolate.run(function() { self(arg); });

Done.

http://codereview.chromium.org/8467034/diff/9001/frog/lib/isolate_serializati...
File frog/lib/isolate_serialization.dart (right):

http://codereview.chromium.org/8467034/diff/9001/frog/lib/isolate_serializati...
frog/lib/isolate_serialization.dart:70:
"o['__MessageTraverser__attached_info__'] = (void 0);";
On 2011/11/08 15:39:01, jimhug wrote:
> I'm going to have to get you to explain (void 0) to me later today.  I've
never
> seen it before and can't quite work out what it means.

void is an operator that produces the side effects of the following expression
(in this case there are none), and then returns 'undefined'. 

It's basically a way to obtain undefined, even when the 'undefined' symbol is
overwritten.

http://codereview.chromium.org/8467034/diff/9001/frog/value.dart
File frog/value.dart (right):

http://codereview.chromium.org/8467034/diff/9001/frog/value.dart#newcode220
frog/value.dart:220: return _isDomCallback(toType) && !_isDomCallback(type) ?
On 2011/11/08 15:39:01, jimhug wrote:
> I'm not sure about the right long-term solution, but like this as a hack for
> now.  +1 to the suggestion to add a TODO with the contents of your comment
> above.
> On 2011/11/08 05:04:35, John Messerly wrote:
> > On 2011/11/08 02:06:26, sigmund wrote:
> > > BTW, this was a cool trick that John came up with. but I'm not very happy
> > having
> > > this as part of the compiler.
> > > 
> > > We have to first reconsider the design issue of whether or not we allow
> > multiple
> > > isolates to have access to the DOM, and if we do, is there a way to handle
> at
> > > the library level?
> > 
> > It'd be worth putting the "we have to first reconsider..." as a TODO.
> > 
> > In general I don't think there's anything wrong with isolates & the DOM
being
> a
> > bit special. What would be better though is if we had a generic way of
marking
> > function-typed parameters as "native callbacks". Then the "conversion" only
> > applies to those parameters. (Converting arguments when going from
> > dynamic->static is a common trick in many systems. Usually you specify it
with
> > some sort of metadata, e.g. the C# [MarshalAs] attribute)
> > 
> > I wonder if "typedefs" allow "native" in the grammar? That might give us the
> > hook we need to put it in the definition of EventListener & friends.
> 

Done

http://codereview.chromium.org/8467034/diff/9001/frog/value.dart#newcode281
frog/value.dart:281: bool _isDomCallback(toType) {
On 2011/11/08 15:39:01, jimhug wrote:
> This could use a doc comment and possibly a TODO as well to highlight the
> deliberate choice to do something a little weird for a compiler - in return
for
> great benefit as a web language.

Done.

http://codereview.chromium.org/8467034/diff/9001/tests/language/language.status
File tests/language/language.status (left):

http://codereview.chromium.org/8467034/diff/9001/tests/language/language.stat...
tests/language/language.status:315: TypedMessageTest: Fail
On 2011/11/08 15:39:01, jimhug wrote:
> Your changes really fixed this?  Does this mean this test should get moved to
> isolate?

I believe so, yes. This test basically creates isolates and sends messages
across.

Powered by Google App Engine
This is Rietveld 408576698