Chromium Code Reviews| 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 a0df3633e7c96c59ff7c62d9097470995719c6a2..bcf35f6d38aa8a943e75063e33f5c2c64d61d6f5 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| @@ -3184,6 +3184,33 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
| argument, string.dartString.slowToString()))); |
| } |
| + void handleJsInterceptorConstant(Send node) { |
| + void bad(Node node) { |
| + compiler.reportError(node, |
|
ahe
2013/10/29 15:23:07
You can use reportFatalError to abort immediately.
|
| + MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT); |
|
ahe
2013/10/29 15:23:07
I'd just use MessageKind.GENERIC for this. Users s
|
| + stack.add(graph.addConstantNull(compiler)); |
| + } |
| + if (node.arguments.isEmpty || !node.arguments.tail.isEmpty) { |
| + return bad(node.arguments); |
| + } |
| + Node argument = node.arguments.head; |
| + // argument must be a TypeConstant. |
| + visit(argument); |
| + HInstruction argumentInstruction = pop(); |
| + if (argumentInstruction is! HConstant) { |
| + return bad(argument); |
| + } |
| + Constant argumentConstant = argumentInstruction.constant; |
| + if (argumentConstant is! TypeConstant) { |
| + return bad(argument); |
| + } |
| + |
| + Constant constant = |
| + new InterceptorConstant(argumentConstant.representedType); |
| + HInstruction instruction = graph.addConstant(constant, compiler); |
| + stack.add(instruction); |
| + } |
| + |
| void handleForeignJsCallInIsolate(Send node) { |
| Link<Node> link = node.arguments; |
| if (!compiler.hasIsolateSupport()) { |
| @@ -3351,6 +3378,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}"; |
| } |