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

Unified Diff: pkg/compiler/lib/src/ssa/builder_kernel.dart

Issue 2551713002: dart2js-kernel: Implement JS_CALL_IN_ISOLATE (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/builder_kernel.dart
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 8cb831e955493c69ee0adf8be504df009c687edb..613e12fed4a2687fef3a1c1776de191188d512ca 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -1212,14 +1212,6 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
return stringConstant.primitiveValue.slowToString();
}
- // TODO(sra): Remove when handleInvokeStaticForeign fully implemented.
- void unhandledForeign(ir.StaticInvocation invocation) {
- ir.Procedure target = invocation.target;
- TypeMask typeMask = astAdapter.returnTypeOf(target);
- List<HInstruction> arguments = _visitArguments(invocation.arguments);
- _pushStaticInvocation(target, arguments, typeMask);
- }
-
void handleForeignJsCurrentIsolateContext(ir.StaticInvocation invocation) {
if (_unexpectedForeignArguments(invocation, 0, 0)) {
stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
@@ -1247,7 +1239,27 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
}
void handleForeignJsCallInIsolate(ir.StaticInvocation invocation) {
- unhandledForeign(invocation);
Siggi Cherem (dart-lang) 2016/12/04 05:02:41 woo hoo!
+ if (_unexpectedForeignArguments(invocation, 2, 2)) {
+ stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+ return;
+ }
+
+ List<HInstruction> inputs = _visitArguments(invocation.arguments);
+
+ if (!compiler.hasIsolateSupport) {
+ // If the isolate library is not used, we ignore the isolate argument and
+ // just invoke the closure.
+ push(new HInvokeClosure(new Selector.callClosure(0),
+ <HInstruction>[inputs[1]], backend.dynamicType));
+ } else {
+ // Call a helper method from the isolate library.
+ ir.Procedure callInIsolate = astAdapter.callInIsolate;
+ if (callInIsolate == null) {
+ compiler.reporter.internalError(astAdapter.getNode(invocation),
+ 'Isolate library and compiler mismatch.');
+ }
+ _pushStaticInvocation(callInIsolate, inputs, backend.dynamicType);
+ }
}
void handleForeignDartClosureToJs(
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698