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

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

Issue 9802023: Correctly handle constness for list and map literals inside bodies. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add TODOs. Created 8 years, 8 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 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after
2291 localsHandler.updateLocal(elements[definition], initialValue); 2291 localsHandler.updateLocal(elements[definition], initialValue);
2292 } else { 2292 } else {
2293 assert(definition is SendSet); 2293 assert(definition is SendSet);
2294 visitSendSet(definition); 2294 visitSendSet(definition);
2295 pop(); // Discard value. 2295 pop(); // Discard value.
2296 } 2296 }
2297 } 2297 }
2298 } 2298 }
2299 2299
2300 visitLiteralList(LiteralList node) { 2300 visitLiteralList(LiteralList node) {
2301 if (node.isConst()) {
2302 ConstantHandler handler = compiler.constantHandler;
2303 Constant constant = handler.compileNodeWithDefinitions(node, elements);
2304 stack.add(graph.addConstant(constant));
2305 return;
2306 }
2307
2301 List<HInstruction> inputs = <HInstruction>[]; 2308 List<HInstruction> inputs = <HInstruction>[];
2302 for (Link<Node> link = node.elements.nodes; 2309 for (Link<Node> link = node.elements.nodes;
2303 !link.isEmpty(); 2310 !link.isEmpty();
2304 link = link.tail) { 2311 link = link.tail) {
2305 visit(link.head); 2312 visit(link.head);
2306 inputs.add(pop()); 2313 inputs.add(pop());
2307 } 2314 }
2308 push(new HLiteralList(inputs, node.isConst())); 2315 push(new HLiteralList(inputs, node.isConst()));
2309 } 2316 }
2310 2317
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2501 if (hasBreak) { 2508 if (hasBreak) {
2502 // There was at least one reachable break, so the label is needed. 2509 // There was at least one reachable break, so the label is needed.
2503 HLabeledBlockInformation blockInfo = 2510 HLabeledBlockInformation blockInfo =
2504 new HLabeledBlockInformation(bodyGraph, joinBlock, handler.labels()); 2511 new HLabeledBlockInformation(bodyGraph, joinBlock, handler.labels());
2505 entryBlock.labeledBlockInformation = blockInfo; 2512 entryBlock.labeledBlockInformation = blockInfo;
2506 } 2513 }
2507 handler.close(); 2514 handler.close();
2508 } 2515 }
2509 2516
2510 visitLiteralMap(LiteralMap node) { 2517 visitLiteralMap(LiteralMap node) {
2518 if (node.isConst()) {
2519 ConstantHandler handler = compiler.constantHandler;
2520 Constant constant = handler.compileNodeWithDefinitions(node, elements);
2521 stack.add(graph.addConstant(constant));
2522 return;
2523 }
2511 List<HInstruction> inputs = <HInstruction>[]; 2524 List<HInstruction> inputs = <HInstruction>[];
2512 for (Link<Node> link = node.entries.nodes; 2525 for (Link<Node> link = node.entries.nodes;
2513 !link.isEmpty(); 2526 !link.isEmpty();
2514 link = link.tail) { 2527 link = link.tail) {
2515 visit(link.head); 2528 visit(link.head);
2516 inputs.addLast(pop()); 2529 inputs.addLast(pop());
2517 inputs.addLast(pop()); 2530 inputs.addLast(pop());
2518 } 2531 }
2519 HLiteralList keyValuePairs = new HLiteralList(inputs, node.isConst()); 2532 HLiteralList keyValuePairs = new HLiteralList(inputs, node.isConst());
2520 HStatic mapMaker = new HStatic(interceptors.getMapMaker()); 2533 HStatic mapMaker = new HStatic(interceptors.getMapMaker());
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
2962 false, 2975 false,
2963 <HInstruction>[target, input])); 2976 <HInstruction>[target, input]));
2964 return builder.pop(); 2977 return builder.pop();
2965 } 2978 }
2966 2979
2967 HInstruction result() { 2980 HInstruction result() {
2968 flushLiterals(); 2981 flushLiterals();
2969 return prefix; 2982 return prefix;
2970 } 2983 }
2971 } 2984 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/scanner/listener.dart ('k') | lib/compiler/implementation/tree/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698