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

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

Issue 10919123: Reapply Issue 10911006. (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
« no previous file with comments | « lib/compiler/implementation/resolver.dart ('k') | lib/compiler/implementation/ssa/codegen.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2694 matching lines...) Expand 10 before | Expand all | Expand 10 after
2705 HInstruction errorMessage = graph.addConstant(messageConstant); 2705 HInstruction errorMessage = graph.addConstant(messageConstant);
2706 Element helper = interceptors.getThrowRuntimeError(); 2706 Element helper = interceptors.getThrowRuntimeError();
2707 pushInvokeHelper1(helper, errorMessage); 2707 pushInvokeHelper1(helper, errorMessage);
2708 } 2708 }
2709 2709
2710 visitNewExpression(NewExpression node) { 2710 visitNewExpression(NewExpression node) {
2711 Element element = elements[node.send]; 2711 Element element = elements[node.send];
2712 if (element != null && element.isErroneous()) { 2712 if (element != null && element.isErroneous()) {
2713 ErroneousElement error = element; 2713 ErroneousElement error = element;
2714 Message message = error.errorMessage; 2714 Message message = error.errorMessage;
2715 if (message.kind === MessageKind.CANNOT_FIND_CONSTRUCTOR) { 2715 if (message.kind == MessageKind.CANNOT_FIND_CONSTRUCTOR) {
2716 Element helper = 2716 Element helper =
2717 compiler.findHelper(const SourceString('throwNoSuchMethod')); 2717 compiler.findHelper(const SourceString('throwNoSuchMethod'));
2718 DartString receiverLiteral = new DartString.literal(''); 2718 DartString receiverLiteral = new DartString.literal('');
2719 Constant receiverConstant = 2719 Constant receiverConstant =
2720 constantSystem.createString(receiverLiteral, node); 2720 constantSystem.createString(receiverLiteral, node);
2721 HInstruction receiver = graph.addConstant(receiverConstant); 2721 HInstruction receiver = graph.addConstant(receiverConstant);
2722 String constructorName = 'constructor ${message.arguments[0]}'; 2722 String constructorName = 'constructor ${message.arguments[0]}';
2723 DartString nameLiteral = new DartString.literal(constructorName); 2723 DartString nameLiteral = new DartString.literal(constructorName);
2724 Constant nameConstant = 2724 Constant nameConstant =
2725 constantSystem.createString(nameLiteral, node.send); 2725 constantSystem.createString(nameLiteral, node.send);
2726 HInstruction name = graph.addConstant(nameConstant); 2726 HInstruction name = graph.addConstant(nameConstant);
2727 List<HInstruction> inputs = <HInstruction>[]; 2727 List<HInstruction> inputs = <HInstruction>[];
2728 node.send.arguments.forEach((argumentNode) { 2728 node.send.arguments.forEach((argumentNode) {
2729 visit(argumentNode); 2729 visit(argumentNode);
2730 HInstruction value = pop(); 2730 HInstruction value = pop();
2731 inputs.add(value); 2731 inputs.add(value);
2732 }); 2732 });
2733 HInstruction arguments = new HLiteralList(inputs); 2733 HInstruction arguments = new HLiteralList(inputs);
2734 add(arguments); 2734 add(arguments);
2735 pushInvokeHelper3(helper, receiver, name, arguments); 2735 pushInvokeHelper3(helper, receiver, name, arguments);
2736 } else if (message.kind === MessageKind.CANNOT_RESOLVE) { 2736 } else if (message.kind == MessageKind.CANNOT_RESOLVE) {
2737 generateRuntimeError(node.send, message.message); 2737 generateRuntimeError(node.send, message.message);
2738 } else { 2738 } else {
2739 compiler.internalError('unexpected unresolved constructor call', 2739 compiler.internalError('unexpected unresolved constructor call',
2740 node: node); 2740 node: node);
2741 } 2741 }
2742 } else if (node.isConst()) { 2742 } else if (node.isConst()) {
2743 // TODO(karlklose): add type representation 2743 // TODO(karlklose): add type representation
2744 ConstantHandler handler = compiler.constantHandler; 2744 ConstantHandler handler = compiler.constantHandler;
2745 Constant constant = handler.compileNodeWithDefinitions(node, elements); 2745 Constant constant = handler.compileNodeWithDefinitions(node, elements);
2746 stack.add(graph.addConstant(constant)); 2746 stack.add(graph.addConstant(constant));
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
4051 new HSubGraphBlockInformation(elseBranch.graph)); 4051 new HSubGraphBlockInformation(elseBranch.graph));
4052 4052
4053 HBasicBlock conditionStartBlock = conditionBranch.block; 4053 HBasicBlock conditionStartBlock = conditionBranch.block;
4054 conditionStartBlock.setBlockFlow(info, joinBlock); 4054 conditionStartBlock.setBlockFlow(info, joinBlock);
4055 SubGraph conditionGraph = conditionBranch.graph; 4055 SubGraph conditionGraph = conditionBranch.graph;
4056 HIf branch = conditionGraph.end.last; 4056 HIf branch = conditionGraph.end.last;
4057 assert(branch is HIf); 4057 assert(branch is HIf);
4058 branch.blockInformation = conditionStartBlock.blockFlow; 4058 branch.blockInformation = conditionStartBlock.blockFlow;
4059 } 4059 }
4060 } 4060 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/resolver.dart ('k') | lib/compiler/implementation/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698