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

Side by Side Diff: dart/frog/leg/ssa/builder.dart

Issue 9634008: Introduce element categories and move resolver towards being more compositional. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 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 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 native.handleSsaNative(this, node); 1774 native.handleSsaNative(this, node);
1775 break; 1775 break;
1776 default: 1776 default:
1777 throw "Unknown foreign: ${node.selector}"; 1777 throw "Unknown foreign: ${node.selector}";
1778 } 1778 }
1779 } 1779 }
1780 1780
1781 visitSuperSend(Send node) { 1781 visitSuperSend(Send node) {
1782 Selector selector = elements.getSelector(node); 1782 Selector selector = elements.getSelector(node);
1783 Element element = elements[node]; 1783 Element element = elements[node];
1784 if (element.kind.category != ElementCategory.FUNCTION) {
1785 // Example:
1786 // co19/Language/10_Expressions/14_Method_Invocation/3_Super_Invocation_A0 3_t04
1787 compiler.unimplemented('super-send to non-function', node: node);
1788 }
1784 HStatic target = new HStatic(element); 1789 HStatic target = new HStatic(element);
1785 HInstruction context = localsHandler.readThis(); 1790 HInstruction context = localsHandler.readThis();
1786 add(target); 1791 add(target);
1787 var inputs = <HInstruction>[target, context]; 1792 var inputs = <HInstruction>[target, context];
1788 addStaticSendArgumentsToList(node, element, inputs); 1793 addStaticSendArgumentsToList(node, element, inputs);
1789 push(new HInvokeSuper(selector, inputs)); 1794 push(new HInvokeSuper(selector, inputs));
1790 } 1795 }
1791 1796
1792 visitStaticSend(Send node) { 1797 visitStaticSend(Send node) {
1793 Selector selector = elements.getSelector(node); 1798 Selector selector = elements.getSelector(node);
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2066 new HIfBlockInformation(condition, thenGraph, elseGraph, joinBlock); 2071 new HIfBlockInformation(condition, thenGraph, elseGraph, joinBlock);
2067 open(joinBlock); 2072 open(joinBlock);
2068 2073
2069 localsHandler.mergeWith(thenLocals, joinBlock); 2074 localsHandler.mergeWith(thenLocals, joinBlock);
2070 HPhi phi = new HPhi.manyInputs(null, [thenInstruction, elseInstruction]); 2075 HPhi phi = new HPhi.manyInputs(null, [thenInstruction, elseInstruction]);
2071 joinBlock.addPhi(phi); 2076 joinBlock.addPhi(phi);
2072 stack.add(phi); 2077 stack.add(phi);
2073 } 2078 }
2074 2079
2075 visitStringInterpolation(StringInterpolation node) { 2080 visitStringInterpolation(StringInterpolation node) {
2076 Operator op = new Operator.synthetic("+"); 2081 int offset = node.getBeginToken().charOffset;
2082 Operator op = new Operator(new StringToken(PLUS_INFO, "+", offset));
2077 HInstruction target = new HStatic(interceptors.getOperatorInterceptor(op)); 2083 HInstruction target = new HStatic(interceptors.getOperatorInterceptor(op));
2078 add(target); 2084 add(target);
2079 visit(node.string); 2085 visit(node.string);
2080 // Handle the parts here, to avoid recreating [target]. 2086 // Handle the parts here, to avoid recreating [target].
2081 for (StringInterpolationPart part in node.parts) { 2087 for (StringInterpolationPart part in node.parts) {
2082 HInstruction prefix = pop(); 2088 HInstruction prefix = pop();
2083 visit(part.expression); 2089 visit(part.expression);
2084 push(new HAdd(target, prefix, pop())); 2090 push(new HAdd(target, prefix, pop()));
2085 prefix = pop(); 2091 prefix = pop();
2086 visit(part.string); 2092 visit(part.string);
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
2477 // Normally, we would call [close] here. However, then we hit 2483 // Normally, we would call [close] here. However, then we hit
2478 // another unimplemented feature: aborting loop body. Simply 2484 // another unimplemented feature: aborting loop body. Simply
2479 // calling [add] does not work as it asserts that the instruction 2485 // calling [add] does not work as it asserts that the instruction
2480 // isn't a control flow instruction. So we inline parts of [add]. 2486 // isn't a control flow instruction. So we inline parts of [add].
2481 current.addAfter(current.last, new HThrow(message)); 2487 current.addAfter(current.last, new HThrow(message));
2482 if (isExpression) { 2488 if (isExpression) {
2483 stack.add(graph.addConstantNull()); 2489 stack.add(graph.addConstantNull());
2484 } 2490 }
2485 } 2491 }
2486 } 2492 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698