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

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

Issue 10545176: Only do the declaring of parameters in a non-bailout version. The bailout version has different set… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 generateAtUseSite = new Set<HInstruction>(), 208 generateAtUseSite = new Set<HInstruction>(),
209 controlFlowOperators = new Set<HInstruction>(), 209 controlFlowOperators = new Set<HInstruction>(),
210 breakAction = new Map<Element, ElementAction>(), 210 breakAction = new Map<Element, ElementAction>(),
211 continueAction = new Map<Element, ElementAction>(), 211 continueAction = new Map<Element, ElementAction>(),
212 unsignedShiftPrecedences = JSPrecedence.binary['>>>'] { 212 unsignedShiftPrecedences = JSPrecedence.binary['>>>'] {
213 213
214 Interceptors interceptors = backend.builder.interceptors; 214 Interceptors interceptors = backend.builder.interceptors;
215 equalsNullElement = interceptors.getEqualsNullInterceptor(); 215 equalsNullElement = interceptors.getEqualsNullInterceptor();
216 boolifiedEqualsNullElement = 216 boolifiedEqualsNullElement =
217 interceptors.getBoolifiedVersionOf(equalsNullElement); 217 interceptors.getBoolifiedVersionOf(equalsNullElement);
218 parameterNames.forEach((Element element, String name) {
219 declaredVariables.add(name);
220 });
221 } 218 }
222 219
223 abstract visitTypeGuard(HTypeGuard node); 220 abstract visitTypeGuard(HTypeGuard node);
224 221
225 abstract beginGraph(HGraph graph); 222 abstract beginGraph(HGraph graph);
226 abstract endGraph(HGraph graph); 223 abstract endGraph(HGraph graph);
227 224
228 abstract beginLoop(HBasicBlock block); 225 abstract beginLoop(HBasicBlock block);
229 abstract endLoop(HBasicBlock block); 226 abstract endLoop(HBasicBlock block);
230 abstract handleLoopCondition(HLoopBranch node); 227 abstract handleLoopCondition(HLoopBranch node);
(...skipping 2230 matching lines...) Expand 10 before | Expand all | Expand 10 after
2461 buffer.add(')'); 2458 buffer.add(')');
2462 endExpression(JSPrecedence.CALL_PRECEDENCE); 2459 endExpression(JSPrecedence.CALL_PRECEDENCE);
2463 } else { 2460 } else {
2464 use(node.checkedInput, expectedPrecedence); 2461 use(node.checkedInput, expectedPrecedence);
2465 } 2462 }
2466 } 2463 }
2467 } 2464 }
2468 2465
2469 class SsaOptimizedCodeGenerator extends SsaCodeGenerator { 2466 class SsaOptimizedCodeGenerator extends SsaCodeGenerator {
2470 SsaOptimizedCodeGenerator(backend, work, parameters, parameterNames) 2467 SsaOptimizedCodeGenerator(backend, work, parameters, parameterNames)
2471 : super(backend, work, parameters, parameterNames); 2468 : super(backend, work, parameters, parameterNames) {
2469 // Declare the parameter names only for the optimized version. The
2470 // unoptimized version has different parameters.
2471 parameterNames.forEach((Element element, String name) {
2472 declaredVariables.add(name);
2473 });
2474 }
2472 2475
2473 int maxBailoutParameters; 2476 int maxBailoutParameters;
2474 2477
2475 HBasicBlock beginGraph(HGraph graph) => graph.entry; 2478 HBasicBlock beginGraph(HGraph graph) => graph.entry;
2476 void endGraph(HGraph graph) {} 2479 void endGraph(HGraph graph) {}
2477 2480
2478 void bailout(HTypeGuard guard, String reason) { 2481 void bailout(HTypeGuard guard, String reason) {
2479 if (maxBailoutParameters === null) { 2482 if (maxBailoutParameters === null) {
2480 maxBailoutParameters = 0; 2483 maxBailoutParameters = 0;
2481 work.guards.forEach((HTypeGuard guard) { 2484 work.guards.forEach((HTypeGuard guard) {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2693 } 2696 }
2694 assert(variableNames.hasName(argument)); 2697 assert(variableNames.hasName(argument));
2695 return argument; 2698 return argument;
2696 } 2699 }
2697 2700
2698 void endGraph(HGraph graph) { 2701 void endGraph(HGraph graph) {
2699 // TODO(ngeoffray): We could avoid generating the state at the 2702 // TODO(ngeoffray): We could avoid generating the state at the
2700 // call site for non-complex bailout methods. 2703 // call site for non-complex bailout methods.
2701 newParameters.add('state'); 2704 newParameters.add('state');
2702 2705
2706 // TODO(ngeoffray): We should declare the parameters in
2707 // beginGraph, to avoid potentially redeclaring them with 'var'
2708 // in the method body.
2703 if (!propagator.hasComplexTypeGuards) { 2709 if (!propagator.hasComplexTypeGuards) {
2704 propagator.firstTypeGuard.block.first = savedFirstInstruction; 2710 propagator.firstTypeGuard.block.first = savedFirstInstruction;
2705 for (HInstruction input in propagator.firstTypeGuard.inputs) { 2711 for (HInstruction input in propagator.firstTypeGuard.inputs) {
2706 input = unwrap(input); 2712 input = unwrap(input);
2707 newParameters.add(', ${variableNames.getName(input)}'); 2713 newParameters.add(', ${variableNames.getName(input)}');
2708 } 2714 }
2709 } else { 2715 } else {
2710 for (int i = 0; i < maxBailoutParameters; i++) { 2716 for (int i = 0; i < maxBailoutParameters; i++) {
2711 newParameters.add(', env$i'); 2717 newParameters.add(', env$i');
2712 } 2718 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
2888 startBailoutSwitch(); 2894 startBailoutSwitch();
2889 } 2895 }
2890 } 2896 }
2891 2897
2892 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { 2898 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) {
2893 if (labeledBlockInfo.body.start.hasGuards()) { 2899 if (labeledBlockInfo.body.start.hasGuards()) {
2894 endBailoutSwitch(); 2900 endBailoutSwitch();
2895 } 2901 }
2896 } 2902 }
2897 } 2903 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698