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

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

Issue 45143003: Implement JS_INTERCEPTOR_CONSTANT (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index d025633cea73351b7ae16e336e238b1efe9fdd9d..0a88bd3e6d4d5b026e26cdc89e2f0e177611b2af 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -3201,6 +3201,29 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
argument, string.dartString.slowToString())));
}
+ void handleJsInterceptorConstant(Send node) {
+ // Single argument must be a TypeConstant which is converted into a
+ // InterceptorConstant.
+ if (!node.arguments.isEmpty && node.arguments.tail.isEmpty) {
+ Node argument = node.arguments.head;
+ visit(argument);
+ HInstruction argumentInstruction = pop();
+ if (argumentInstruction is HConstant) {
+ Constant argumentConstant = argumentInstruction.constant;
+ if (argumentConstant is TypeConstant) {
+ Constant constant =
+ new InterceptorConstant(argumentConstant.representedType);
+ HInstruction instruction = graph.addConstant(constant, compiler);
+ stack.add(instruction);
+ return;
+ }
+ }
+ }
+ compiler.reportError(node,
+ MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT);
+ stack.add(graph.addConstantNull(compiler));
+ }
+
void handleForeignJsCallInIsolate(Send node) {
Link<Node> link = node.arguments;
if (!compiler.hasIsolateSupport()) {
@@ -3370,6 +3393,8 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
handleForeignJsGetName(node);
} else if (name == 'JS_EFFECT') {
stack.add(graph.addConstantNull(compiler));
+ } else if (name == 'JS_INTERCEPTOR_CONSTANT') {
+ handleJsInterceptorConstant(node);
} else {
throw "Unknown foreign: ${selector}";
}

Powered by Google App Engine
This is Rietveld 408576698