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

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: 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 2592 matching lines...) Expand 10 before | Expand all | Expand 10 after
2603 HInstruction errorMessage = graph.addConstantString(messageObject, node); 2603 HInstruction errorMessage = graph.addConstantString(messageObject, node);
2604 Element helper = interceptors.getThrowRuntimeError(); 2604 Element helper = interceptors.getThrowRuntimeError();
2605 pushInvokeHelper1(helper, errorMessage); 2605 pushInvokeHelper1(helper, errorMessage);
2606 } 2606 }
2607 2607
2608 visitNewExpression(NewExpression node) { 2608 visitNewExpression(NewExpression node) {
2609 Element element = elements[node.send]; 2609 Element element = elements[node.send];
2610 if (element != null && element.isErroneous()) { 2610 if (element != null && element.isErroneous()) {
2611 ErroneousElement error = element; 2611 ErroneousElement error = element;
2612 Message message = error.errorMessage; 2612 Message message = error.errorMessage;
2613 if (message.kind === MessageKind.CANNOT_FIND_CONSTRUCTOR) { 2613 if (message.kind == MessageKind.CANNOT_FIND_CONSTRUCTOR) {
2614 Element helper = 2614 Element helper =
2615 compiler.findHelper(const SourceString('throwNoSuchMethod')); 2615 compiler.findHelper(const SourceString('throwNoSuchMethod'));
2616 DartString receiverLiteral = new DartString.literal(''); 2616 DartString receiverLiteral = new DartString.literal('');
2617 HInstruction receiver = graph.addConstantString(receiverLiteral, node); 2617 HInstruction receiver = graph.addConstantString(receiverLiteral, node);
2618 String constructorName = 'constructor ${message.arguments[0]}'; 2618 String constructorName = 'constructor ${message.arguments[0]}';
2619 DartString nameLiteral = new DartString.literal(constructorName); 2619 DartString nameLiteral = new DartString.literal(constructorName);
2620 HInstruction name = graph.addConstantString(nameLiteral, node.send); 2620 HInstruction name = graph.addConstantString(nameLiteral, node.send);
2621 List<HInstruction> inputs = <HInstruction>[]; 2621 List<HInstruction> inputs = <HInstruction>[];
2622 node.send.arguments.forEach((argumentNode) { 2622 node.send.arguments.forEach((argumentNode) {
2623 visit(argumentNode); 2623 visit(argumentNode);
2624 HInstruction value = pop(); 2624 HInstruction value = pop();
2625 inputs.add(value); 2625 inputs.add(value);
2626 }); 2626 });
2627 HInstruction arguments = new HLiteralList(inputs); 2627 HInstruction arguments = new HLiteralList(inputs);
2628 add(arguments); 2628 add(arguments);
2629 pushInvokeHelper3(helper, receiver, name, arguments); 2629 pushInvokeHelper3(helper, receiver, name, arguments);
2630 } else if (message.kind === MessageKind.CANNOT_RESOLVE) { 2630 } else if (message.kind == MessageKind.CANNOT_RESOLVE) {
2631 generateRuntimeError(node.send, message.message); 2631 generateRuntimeError(node.send, message.message);
2632 } else { 2632 } else {
2633 compiler.internalError('unexpected unresolved constructor call', 2633 compiler.internalError('unexpected unresolved constructor call',
2634 node: node); 2634 node: node);
2635 } 2635 }
2636 } else if (node.isConst()) { 2636 } else if (node.isConst()) {
2637 // TODO(karlklose): add type representation 2637 // TODO(karlklose): add type representation
2638 ConstantHandler handler = compiler.constantHandler; 2638 ConstantHandler handler = compiler.constantHandler;
2639 Constant constant = handler.compileNodeWithDefinitions(node, elements); 2639 Constant constant = handler.compileNodeWithDefinitions(node, elements);
2640 stack.add(graph.addConstant(constant)); 2640 stack.add(graph.addConstant(constant));
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
3939 new HSubGraphBlockInformation(elseBranch.graph)); 3939 new HSubGraphBlockInformation(elseBranch.graph));
3940 3940
3941 HBasicBlock conditionStartBlock = conditionBranch.block; 3941 HBasicBlock conditionStartBlock = conditionBranch.block;
3942 conditionStartBlock.setBlockFlow(info, joinBlock); 3942 conditionStartBlock.setBlockFlow(info, joinBlock);
3943 SubGraph conditionGraph = conditionBranch.graph; 3943 SubGraph conditionGraph = conditionBranch.graph;
3944 HIf branch = conditionGraph.end.last; 3944 HIf branch = conditionGraph.end.last;
3945 assert(branch is HIf); 3945 assert(branch is HIf);
3946 branch.blockInformation = conditionStartBlock.blockFlow; 3946 branch.blockInformation = conditionStartBlock.blockFlow;
3947 } 3947 }
3948 } 3948 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698