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

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: Address next round of comments. 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 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 int argumentCount = node.inputs.length - 1; 1600 int argumentCount = node.inputs.length - 1;
1601 1601
1602 // TODO(ahe): The constructor name was statically resolved in 1602 // TODO(ahe): The constructor name was statically resolved in
1603 // SsaBuilder.buildFactory. Is there a cleaner way to do this? 1603 // SsaBuilder.buildFactory. Is there a cleaner way to do this?
1604 node.name.printOn(buffer); 1604 node.name.printOn(buffer);
1605 visitArguments(node.inputs); 1605 visitArguments(node.inputs);
1606 } else { 1606 } else {
1607 buffer.add(compiler.namer.instanceMethodInvocationName( 1607 buffer.add(compiler.namer.instanceMethodInvocationName(
1608 currentLibrary, node.name, node.selector)); 1608 currentLibrary, node.name, node.selector));
1609 visitArguments(node.inputs); 1609 visitArguments(node.inputs);
1610 bool inLoop = node.block.enclosingLoopHeader !== null;
1610 if (node.element !== null) { 1611 if (node.element !== null) {
1611 // If we know we're calling a specific method, register that 1612 // If we know we're calling a specific method, register that
1612 // method only. 1613 // method only.
1614 if (inLoop) {
1615 backend.builder.functionsCalledInLoop.add(node.element);
1616 }
1613 world.registerDynamicInvocationOf(node.element); 1617 world.registerDynamicInvocationOf(node.element);
1614 } else { 1618 } else {
1619 if (inLoop) {
1620 backend.builder.selectorsCalledInLoop[node.name] = node.selector;
1621 }
1615 world.registerDynamicInvocation( 1622 world.registerDynamicInvocation(
1616 node.name, getOptimizedSelectorFor(node, node.selector)); 1623 node.name,
1624 getOptimizedSelectorFor(node, node.selector));
1617 } 1625 }
1618 } 1626 }
1619 endExpression(JSPrecedence.CALL_PRECEDENCE); 1627 endExpression(JSPrecedence.CALL_PRECEDENCE);
1620 } 1628 }
1621 1629
1622 Selector getOptimizedSelectorFor(HInvoke node, Selector defaultSelector) { 1630 Selector getOptimizedSelectorFor(HInvoke node, Selector defaultSelector) {
1623 Type receiverType = node.inputs[0].propagatedType.computeType(compiler); 1631 Type receiverType = node.inputs[0].propagatedType.computeType(compiler);
1624 if (receiverType !== null) { 1632 if (receiverType !== null) {
1625 return new TypedSelector(receiverType, defaultSelector); 1633 return new TypedSelector(receiverType, defaultSelector);
1626 } else { 1634 } else {
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2808 startBailoutSwitch(); 2816 startBailoutSwitch();
2809 } 2817 }
2810 } 2818 }
2811 2819
2812 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { 2820 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) {
2813 if (labeledBlockInfo.body.start.hasGuards()) { 2821 if (labeledBlockInfo.body.start.hasGuards()) {
2814 endBailoutSwitch(); 2822 endBailoutSwitch();
2815 } 2823 }
2816 } 2824 }
2817 } 2825 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698