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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 11778064: Cleanup the isolate library to pave the way for web worker support. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/builder.dart (revision 16903)
+++ sdk/lib/_internal/compiler/implementation/ssa/builder.dart (working copy)
@@ -3111,6 +3111,29 @@
inputs));
}
+ void handleForeignSetCurrentIsolate(Send node) {
+ if (node.arguments.isEmpty || !node.arguments.tail.isEmpty) {
+ compiler.cancel('Exactly one argument required',
+ node: node.argumentsNode);
+ }
+ visit(node.arguments.head);
+ String isolateName = backend.namer.CURRENT_ISOLATE;
+ push(new HForeign(new DartString.literal("$isolateName = #"),
+ const LiteralDartString('void'),
+ <HInstruction>[pop()]));
+ }
+
+ void handleForeignCreateIsolate(Send node) {
+ if (!node.arguments.isEmpty) {
+ compiler.cancel('Too many arguments',
+ node: node.argumentsNode);
+ }
+ String constructorName = backend.namer.isolateName;
+ push(new HForeign(new DartString.literal("new $constructorName"),
+ const LiteralDartString('var'),
+ <HInstruction>[]));
+ }
+
visitForeignSend(Send node) {
Selector selector = elements.getSelector(node);
SourceString name = selector.name;
@@ -3126,6 +3149,10 @@
handleForeignJsCallInIsolate(node);
} else if (name == const SourceString('DART_CLOSURE_TO_JS')) {
handleForeignDartClosureToJs(node);
+ } else if (name == const SourceString('JS_SET_CURRENT_ISOLATE')) {
+ handleForeignSetCurrentIsolate(node);
+ } else if (name == const SourceString('JS_CREATE_ISOLATE')) {
+ handleForeignCreateIsolate(node);
} else {
throw "Unknown foreign: ${selector}";
}

Powered by Google App Engine
This is Rietveld 408576698