Index: frog/leg/ssa/builder.dart |
=================================================================== |
--- frog/leg/ssa/builder.dart (revision 5517) |
+++ frog/leg/ssa/builder.dart (working copy) |
@@ -1709,7 +1709,8 @@ |
case "UNINTERCEPTED": |
Link<Node> link = node.arguments; |
if (!link.tail.isEmpty()) { |
- compiler.cancel('More than one expression in UNINTERCEPTED()'); |
+ compiler.cancel( |
+ 'More than one expression in UNINTERCEPTED()', node: node); |
} |
Expression expression = link.head; |
disableMethodInterception(); |
@@ -1719,7 +1720,8 @@ |
case "JS_HAS_EQUALS": |
List<HInstruction> inputs = <HInstruction>[]; |
if (!node.arguments.tail.isEmpty()) { |
- compiler.cancel('More than one expression in JS_HAS_EQUALS()'); |
+ compiler.cancel( |
+ 'More than one expression in JS_HAS_EQUALS()', node: node); |
} |
addGenericSendArgumentsToList(node.arguments, inputs); |
String name = compiler.namer.instanceMethodName( |
@@ -1728,6 +1730,56 @@ |
const LiteralDartString('bool'), |
inputs)); |
break; |
+ case "JS_CURRENT_ISOLATE": |
+ if (!node.arguments.isEmpty()) { |
kasperl
2012/03/16 11:06:42
There's sooo much code in these cases. Maybe this
ngeoffray
2012/03/19 10:29:58
Done.
|
+ compiler.cancel( |
+ 'Too many arguments to JS_CURRENT_ISOLATE', node: node); |
+ } |
+ |
+ if (!compiler.hasIsolateSupport()) { |
+ // If the isolate library is not used, we just generate code |
+ // to fetch the Leg's current isolate. |
+ String name = compiler.namer.CURRENT_ISOLATE; |
+ push(new HForeign(new DartString.literal(name), |
+ const LiteralDartString('bool'), |
kasperl
2012/03/16 11:06:42
Not sure I understand the use of bool here.
ngeoffray
2012/03/19 10:29:58
Typo, replaced with 'var'.
|
+ <HInstruction>[])); |
+ } else { |
+ // Call a helper method from the isolate library. |
kasperl
2012/03/16 11:06:42
Maybe explain here why you cannot just grab hold o
ngeoffray
2012/03/19 10:29:58
Done.
|
+ Element element = compiler.isolateLibrary.find( |
+ const SourceString('_currentIsolate')); |
+ if (element === null) { |
+ compiler.cancel( |
+ 'Isolate library and compiler mismatch', node: node); |
+ } |
+ HStatic target = new HStatic(element); |
+ add(target); |
+ push(new HInvokeStatic(Selector.INVOCATION_0, |
+ <HInstruction>[target])); |
+ } |
+ break; |
+ case "JS_CALL_IN_ISOLATE": |
+ Link<Node> link = node.arguments; |
+ if (!compiler.hasIsolateSupport()) { |
+ // If the isolate library is not used, we just invoke the |
+ // closure. |
+ visit(link.tail.head); |
+ push(new HInvokeClosure(Selector.INVOCATION_0, |
+ <HInstruction>[pop()])); |
+ } else { |
+ // Call a helper method from the isolate library. |
+ Element element = compiler.isolateLibrary.find( |
+ const SourceString('_callInIsolate')); |
+ if (element === null) { |
+ compiler.cancel( |
+ 'Isolate library and compiler mismatch', node: node); |
+ } |
+ HStatic target = new HStatic(element); |
+ add(target); |
+ List<HInstruction> inputs = <HInstruction>[target]; |
+ addGenericSendArgumentsToList(link, inputs); |
+ push(new HInvokeStatic(Selector.INVOCATION_0, inputs)); |
+ } |
+ break; |
case "native": |
native.handleSsaNative(this, node); |
break; |