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

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

Issue 9642001: Make string juxtaposition combine properly with string interpolations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 assert(op.token.kind !== PLUS_TOKEN); 1318 assert(op.token.kind !== PLUS_TOKEN);
1319 HInstruction operand = pop(); 1319 HInstruction operand = pop();
1320 // See if we can constant-fold right away. This avoids rewrites later on. 1320 // See if we can constant-fold right away. This avoids rewrites later on.
1321 if (operand is HConstant) { 1321 if (operand is HConstant) {
1322 HConstant typedOperand = operand; 1322 HConstant typedOperand = operand;
1323 Constant constant = typedOperand.constant; 1323 Constant constant = typedOperand.constant;
1324 Constant folded = constant.unaryFold(op.source.stringValue); 1324 Constant folded = constant.unaryFold(op.source.stringValue);
1325 if (folded !== null) { 1325 if (folded !== null) {
1326 stack.add(graph.addConstant(folded)); 1326 stack.add(graph.addConstant(folded));
1327 return; 1327 return;
1328 } 1328 }
1329 } 1329 }
1330 HInstruction target = 1330 HInstruction target =
1331 new HStatic(interceptors.getPrefixOperatorInterceptor(op)); 1331 new HStatic(interceptors.getPrefixOperatorInterceptor(op));
1332 add(target); 1332 add(target);
1333 switch (op.source.stringValue) { 1333 switch (op.source.stringValue) {
1334 case "-": push(new HNegate(target, operand)); break; 1334 case "-": push(new HNegate(target, operand)); break;
1335 case "~": push(new HBitNot(target, operand)); break; 1335 case "~": push(new HBitNot(target, operand)); break;
1336 default: unreachable(); 1336 default: unreachable();
1337 } 1337 }
1338 } 1338 }
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 SourceString name = selector.namedArguments[i]; 1633 SourceString name = selector.namedArguments[i];
1634 if (name == parameter.name) { 1634 if (name == parameter.name) {
1635 foundIndex = i; 1635 foundIndex = i;
1636 break; 1636 break;
1637 } 1637 }
1638 } 1638 }
1639 if (foundIndex != -1) { 1639 if (foundIndex != -1) {
1640 list.add(namedArguments[foundIndex]); 1640 list.add(namedArguments[foundIndex]);
1641 } else { 1641 } else {
1642 Constant constant = compiler.compileVariable(parameter); 1642 Constant constant = compiler.compileVariable(parameter);
1643 list.add(graph.addConstant(constant)); 1643 list.add(graph.addConstant(constant));
1644 } 1644 }
1645 } 1645 }
1646 } 1646 }
1647 } 1647 }
1648 1648
1649 void addGenericSendArgumentsToList(Link<Node> link, List<HInstruction> list) { 1649 void addGenericSendArgumentsToList(Link<Node> link, List<HInstruction> list) {
1650 for (; !link.isEmpty(); link = link.tail) { 1650 for (; !link.isEmpty(); link = link.tail) {
1651 visit(link.head); 1651 visit(link.head);
1652 list.add(pop()); 1652 list.add(pop());
1653 } 1653 }
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
2274 } 2274 }
2275 2275
2276 visitNamedArgument(NamedArgument node) { 2276 visitNamedArgument(NamedArgument node) {
2277 visit(node.expression); 2277 visit(node.expression);
2278 } 2278 }
2279 2279
2280 visitSwitchStatement(SwitchStatement node) { 2280 visitSwitchStatement(SwitchStatement node) {
2281 work.allowSpeculativeOptimization = false; 2281 work.allowSpeculativeOptimization = false;
2282 visit(node.expression); 2282 visit(node.expression);
2283 HInstruction expression = pop(); 2283 HInstruction expression = pop();
2284
2284 Link cases = node.cases.nodes; 2285 Link cases = node.cases.nodes;
2285 int count = 0; 2286 int count = 0;
2286 handleThen() { 2287 handleThen() {
2287 if (cases.head.statements.nodes.isEmpty()) { 2288 if (cases.head.statements.nodes.isEmpty()) {
2288 compiler.unimplemented('fall-through', node: cases.head); 2289 compiler.unimplemented('fall-through', node: cases.head);
2289 } 2290 }
2290 visit(cases.head.statements); 2291 visit(cases.head.statements);
2291 cases = cases.tail; 2292 cases = cases.tail;
2292 } 2293 }
2293 handleElse() { 2294 handleElse() {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
2458 // Normally, we would call [close] here. However, then we hit 2459 // Normally, we would call [close] here. However, then we hit
2459 // another unimplemented feature: aborting loop body. Simply 2460 // another unimplemented feature: aborting loop body. Simply
2460 // calling [add] does not work as it asserts that the instruction 2461 // calling [add] does not work as it asserts that the instruction
2461 // isn't a control flow instruction. So we inline parts of [add]. 2462 // isn't a control flow instruction. So we inline parts of [add].
2462 current.addAfter(current.last, new HThrow(message)); 2463 current.addAfter(current.last, new HThrow(message));
2463 if (isExpression) { 2464 if (isExpression) {
2464 stack.add(graph.addConstantNull()); 2465 stack.add(graph.addConstantNull());
2465 } 2466 }
2466 } 2467 }
2467 } 2468 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698