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

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

Issue 25478009: Handle compile-time constness for conditionals and type literal calls. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 part of ssa; 5 part of ssa;
6 6
7 /** 7 /**
8 * A special element for the extra parameter taken by intercepted 8 * A special element for the extra parameter taken by intercepted
9 * methods. We need to override [Element.computeType] because our 9 * methods. We need to override [Element.computeType] because our
10 * optimizers may look at its declared type. 10 * optimizers may look at its declared type.
(...skipping 3657 matching lines...) Expand 10 before | Expand all | Expand 10 after
3668 HConstant addConstantString(Node node, String string) { 3668 HConstant addConstantString(Node node, String string) {
3669 DartString dartString = new DartString.literal(string); 3669 DartString dartString = new DartString.literal(string);
3670 Constant constant = constantSystem.createString(dartString, node); 3670 Constant constant = constantSystem.createString(dartString, node);
3671 return graph.addConstant(constant, compiler); 3671 return graph.addConstant(constant, compiler);
3672 } 3672 }
3673 3673
3674 visitTypeReferenceSend(Send node) { 3674 visitTypeReferenceSend(Send node) {
3675 Element element = elements[node]; 3675 Element element = elements[node];
3676 if (element.isClass() || element.isTypedef()) { 3676 if (element.isClass() || element.isTypedef()) {
3677 // TODO(karlklose): add type representation 3677 // TODO(karlklose): add type representation
3678 stack.add(addConstant(node)); 3678 if (node.isCall) {
3679 // The node itself is not a constant but we register the selector (the
3680 // identifier that refers to the class/typedef) as a constant.
3681 stack.add(addConstant(node.selector));
3682 } else {
3683 stack.add(addConstant(node));
3684 }
3679 } else if (element.isTypeVariable()) { 3685 } else if (element.isTypeVariable()) {
3680 HInstruction value = 3686 HInstruction value =
3681 addTypeVariableReference(element.computeType(compiler)); 3687 addTypeVariableReference(element.computeType(compiler));
3682 pushInvokeStatic(node, 3688 pushInvokeStatic(node,
3683 backend.getRuntimeTypeToString(), 3689 backend.getRuntimeTypeToString(),
3684 [value], 3690 [value],
3685 backend.stringType); 3691 backend.stringType);
3686 pushInvokeStatic(node, 3692 pushInvokeStatic(node,
3687 backend.getCreateRuntimeType(), 3693 backend.getCreateRuntimeType(),
3688 [pop()]); 3694 [pop()]);
(...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after
5549 new HSubGraphBlockInformation(elseBranch.graph)); 5555 new HSubGraphBlockInformation(elseBranch.graph));
5550 5556
5551 HBasicBlock conditionStartBlock = conditionBranch.block; 5557 HBasicBlock conditionStartBlock = conditionBranch.block;
5552 conditionStartBlock.setBlockFlow(info, joinBlock); 5558 conditionStartBlock.setBlockFlow(info, joinBlock);
5553 SubGraph conditionGraph = conditionBranch.graph; 5559 SubGraph conditionGraph = conditionBranch.graph;
5554 HIf branch = conditionGraph.end.last; 5560 HIf branch = conditionGraph.end.last;
5555 assert(branch is HIf); 5561 assert(branch is HIf);
5556 branch.blockInformation = conditionStartBlock.blockFlow; 5562 branch.blockInformation = conditionStartBlock.blockFlow;
5557 } 5563 }
5558 } 5564 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698