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

Side by Side Diff: lib/compiler/implementation/ssa/builder.dart

Issue 10911006: Collect the types used in is-checks in the resolver phase. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix last upload. Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class Interceptors { 5 class Interceptors {
6 Compiler compiler; 6 Compiler compiler;
7 Interceptors(Compiler this.compiler); 7 Interceptors(Compiler this.compiler);
8 8
9 SourceString mapOperatorToMethodName(Operator op) { 9 SourceString mapOperatorToMethodName(Operator op) {
10 String name = op.source.stringValue; 10 String name = op.source.stringValue;
(...skipping 2650 matching lines...) Expand 10 before | Expand all | Expand 10 after
2661 HInstruction errorMessage = graph.addConstantString(messageObject, node); 2661 HInstruction errorMessage = graph.addConstantString(messageObject, node);
2662 Element helper = interceptors.getThrowRuntimeError(); 2662 Element helper = interceptors.getThrowRuntimeError();
2663 pushInvokeHelper1(helper, errorMessage); 2663 pushInvokeHelper1(helper, errorMessage);
2664 } 2664 }
2665 2665
2666 visitNewExpression(NewExpression node) { 2666 visitNewExpression(NewExpression node) {
2667 Element element = elements[node.send]; 2667 Element element = elements[node.send];
2668 if (element != null && element.isErroneous()) { 2668 if (element != null && element.isErroneous()) {
2669 ErroneousElement error = element; 2669 ErroneousElement error = element;
2670 Message message = error.errorMessage; 2670 Message message = error.errorMessage;
2671 if (message.kind === MessageKind.CANNOT_FIND_CONSTRUCTOR) { 2671 if (message.kind == MessageKind.CANNOT_FIND_CONSTRUCTOR) {
2672 Element helper = 2672 Element helper =
2673 compiler.findHelper(const SourceString('throwNoSuchMethod')); 2673 compiler.findHelper(const SourceString('throwNoSuchMethod'));
2674 DartString receiverLiteral = new DartString.literal(''); 2674 DartString receiverLiteral = new DartString.literal('');
2675 HInstruction receiver = graph.addConstantString(receiverLiteral, node); 2675 HInstruction receiver = graph.addConstantString(receiverLiteral, node);
2676 String constructorName = 'constructor ${message.arguments[0]}'; 2676 String constructorName = 'constructor ${message.arguments[0]}';
2677 DartString nameLiteral = new DartString.literal(constructorName); 2677 DartString nameLiteral = new DartString.literal(constructorName);
2678 HInstruction name = graph.addConstantString(nameLiteral, node.send); 2678 HInstruction name = graph.addConstantString(nameLiteral, node.send);
2679 List<HInstruction> inputs = <HInstruction>[]; 2679 List<HInstruction> inputs = <HInstruction>[];
2680 node.send.arguments.forEach((argumentNode) { 2680 node.send.arguments.forEach((argumentNode) {
2681 visit(argumentNode); 2681 visit(argumentNode);
2682 HInstruction value = pop(); 2682 HInstruction value = pop();
2683 inputs.add(value); 2683 inputs.add(value);
2684 }); 2684 });
2685 HInstruction arguments = new HLiteralList(inputs); 2685 HInstruction arguments = new HLiteralList(inputs);
2686 add(arguments); 2686 add(arguments);
2687 pushInvokeHelper3(helper, receiver, name, arguments); 2687 pushInvokeHelper3(helper, receiver, name, arguments);
2688 } else if (message.kind === MessageKind.CANNOT_RESOLVE) { 2688 } else if (message.kind == MessageKind.CANNOT_RESOLVE) {
2689 generateRuntimeError(node.send, message.message); 2689 generateRuntimeError(node.send, message.message);
2690 } else { 2690 } else {
2691 compiler.internalError('unexpected unresolved constructor call', 2691 compiler.internalError('unexpected unresolved constructor call',
2692 node: node); 2692 node: node);
2693 } 2693 }
2694 } else if (node.isConst()) { 2694 } else if (node.isConst()) {
2695 // TODO(karlklose): add type representation 2695 // TODO(karlklose): add type representation
2696 ConstantHandler handler = compiler.constantHandler; 2696 ConstantHandler handler = compiler.constantHandler;
2697 Constant constant = handler.compileNodeWithDefinitions(node, elements); 2697 Constant constant = handler.compileNodeWithDefinitions(node, elements);
2698 stack.add(graph.addConstant(constant)); 2698 stack.add(graph.addConstant(constant));
(...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after
4001 new HSubGraphBlockInformation(elseBranch.graph)); 4001 new HSubGraphBlockInformation(elseBranch.graph));
4002 4002
4003 HBasicBlock conditionStartBlock = conditionBranch.block; 4003 HBasicBlock conditionStartBlock = conditionBranch.block;
4004 conditionStartBlock.setBlockFlow(info, joinBlock); 4004 conditionStartBlock.setBlockFlow(info, joinBlock);
4005 SubGraph conditionGraph = conditionBranch.graph; 4005 SubGraph conditionGraph = conditionBranch.graph;
4006 HIf branch = conditionGraph.end.last; 4006 HIf branch = conditionGraph.end.last;
4007 assert(branch is HIf); 4007 assert(branch is HIf);
4008 branch.blockInformation = conditionStartBlock.blockFlow; 4008 branch.blockInformation = conditionStartBlock.blockFlow;
4009 } 4009 }
4010 } 4010 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698