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

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

Issue 10534109: Use simple loop tracking instead of size to determine if (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add comment. Created 8 years, 6 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 SsaCodeGeneratorTask extends CompilerTask { 5 class SsaCodeGeneratorTask extends CompilerTask {
6 final JavaScriptBackend backend; 6 final JavaScriptBackend backend;
7 SsaCodeGeneratorTask(JavaScriptBackend backend) 7 SsaCodeGeneratorTask(JavaScriptBackend backend)
8 : this.backend = backend, 8 : this.backend = backend,
9 super(backend.compiler); 9 super(backend.compiler);
10 String get name() => 'SSA code generator'; 10 String get name() => 'SSA code generator';
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 int argumentCount = node.inputs.length - 1; 1578 int argumentCount = node.inputs.length - 1;
1579 1579
1580 // TODO(ahe): The constructor name was statically resolved in 1580 // TODO(ahe): The constructor name was statically resolved in
1581 // SsaBuilder.buildFactory. Is there a cleaner way to do this? 1581 // SsaBuilder.buildFactory. Is there a cleaner way to do this?
1582 node.name.printOn(buffer); 1582 node.name.printOn(buffer);
1583 visitArguments(node.inputs); 1583 visitArguments(node.inputs);
1584 } else { 1584 } else {
1585 buffer.add(compiler.namer.instanceMethodInvocationName( 1585 buffer.add(compiler.namer.instanceMethodInvocationName(
1586 currentLibrary, node.name, node.selector)); 1586 currentLibrary, node.name, node.selector));
1587 visitArguments(node.inputs); 1587 visitArguments(node.inputs);
1588 var inLoop = node.block.enclosingLoopHeader !== null;
1588 if (node.element !== null) { 1589 if (node.element !== null) {
1589 // If we know we're calling a specific method, register that 1590 // If we know we're calling a specific method, register that
1590 // method only. 1591 // method only.
1592 if (inLoop) node.element.calledInLoop = true;
1591 world.registerDynamicInvocationOf(node.element); 1593 world.registerDynamicInvocationOf(node.element);
1592 } else { 1594 } else {
1593 world.registerDynamicInvocation( 1595 world.registerDynamicInvocation(
1594 node.name, getOptimizedSelectorFor(node, node.selector)); 1596 node.name,
1597 getOptimizedSelectorFor(node, node.selector),
1598 inLoop: inLoop);
1595 } 1599 }
1596 } 1600 }
1597 endExpression(JSPrecedence.CALL_PRECEDENCE); 1601 endExpression(JSPrecedence.CALL_PRECEDENCE);
1598 } 1602 }
1599 1603
1600 Selector getOptimizedSelectorFor(HInvoke node, Selector defaultSelector) { 1604 Selector getOptimizedSelectorFor(HInvoke node, Selector defaultSelector) {
1601 Type receiverType = node.inputs[0].propagatedType.computeType(compiler); 1605 Type receiverType = node.inputs[0].propagatedType.computeType(compiler);
1602 if (receiverType !== null) { 1606 if (receiverType !== null) {
1603 return new TypedSelector(receiverType, defaultSelector); 1607 return new TypedSelector(receiverType, defaultSelector);
1604 } else { 1608 } else {
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
2616 bool visitAndOrInfo(HAndOrBlockInformation info) => false; 2620 bool visitAndOrInfo(HAndOrBlockInformation info) => false;
2617 bool visitIfInfo(HIfBlockInformation info) => false; 2621 bool visitIfInfo(HIfBlockInformation info) => false;
2618 bool visitLoopInfo(HLoopBlockInformation info) => false; 2622 bool visitLoopInfo(HLoopBlockInformation info) => false;
2619 bool visitTryInfo(HTryBlockInformation info) => false; 2623 bool visitTryInfo(HTryBlockInformation info) => false;
2620 bool visitSequenceInfo(HStatementSequenceInformation info) => false; 2624 bool visitSequenceInfo(HStatementSequenceInformation info) => false;
2621 2625
2622 // If argument is a [HCheck] and it does not have a name, we try to 2626 // If argument is a [HCheck] and it does not have a name, we try to
2623 // find the name of its checked input. Note that there must be a 2627 // find the name of its checked input. Note that there must be a
2624 // name, otherwise the instruction would not be in the live 2628 // name, otherwise the instruction would not be in the live
2625 // environment. 2629 // environment.
2626 HInstruction unwrap(argument) {» 2630 HInstruction unwrap(argument) {
2627 while (argument is HCheck && !variableNames.hasName(argument)) { 2631 while (argument is HCheck && !variableNames.hasName(argument)) {
2628 argument = argument.checkedInput; 2632 argument = argument.checkedInput;
2629 } 2633 }
2630 assert(variableNames.hasName(argument)); 2634 assert(variableNames.hasName(argument));
2631 return argument;» 2635 return argument;
2632 } 2636 }
2633 2637
2634 void visitTypeGuard(HTypeGuard node) { 2638 void visitTypeGuard(HTypeGuard node) {
2635 indent--; 2639 indent--;
2636 addIndented('case ${node.state}:\n'); 2640 addIndented('case ${node.state}:\n');
2637 indent++; 2641 indent++;
2638 addIndented('state = 0;\n'); 2642 addIndented('state = 0;\n');
2639 2643
2640 setup.add(' case ${node.state}:\n'); 2644 setup.add(' case ${node.state}:\n');
2641 int i = 0; 2645 int i = 0;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2778 startBailoutSwitch(); 2782 startBailoutSwitch();
2779 } 2783 }
2780 } 2784 }
2781 2785
2782 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { 2786 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) {
2783 if (labeledBlockInfo.body.start.hasGuards()) { 2787 if (labeledBlockInfo.body.start.hasGuards()) {
2784 endBailoutSwitch(); 2788 endBailoutSwitch();
2785 } 2789 }
2786 } 2790 }
2787 } 2791 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698