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

Unified Diff: lib/compiler/implementation/ssa/codegen.dart

Issue 11092104: Reserve a state variable for the bailout function. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add tests. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/compiler/implementation/ssa/variable_allocator.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/codegen.dart
diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart
index 27e1b238823d484d2a6e247d2b62afd860588181..e5517ec35258ce7c44979f4ca9e3a8dd09cd5df7 100644
--- a/lib/compiler/implementation/ssa/codegen.dart
+++ b/lib/compiler/implementation/ssa/codegen.dart
@@ -2701,7 +2701,7 @@ class SsaUnoptimizedCodeGenerator extends SsaCodeGenerator {
propagator.visitGraph(graph);
// TODO(ngeoffray): We could avoid generating the state at the
// call site for non-complex bailout methods.
- newParameters.add(new js.Parameter('state'));
+ newParameters.add(new js.Parameter(variableNames.stateName));
if (propagator.hasComplexBailoutTargets) {
// Use generic parameters that will be assigned to
@@ -2717,7 +2717,8 @@ class SsaUnoptimizedCodeGenerator extends SsaCodeGenerator {
// The setup phase of a bailout function sets up the environment for
// each bailout target. Each bailout target will populate this
// setup phase. It is put at the beginning of the function.
- setup = new js.Switch(new js.VariableUse('state'), <js.SwitchClause>[]);
+ setup = new js.Switch(new js.VariableUse(variableNames.stateName),
+ <js.SwitchClause>[]);
return graph.entry;
} else {
// We have a simple bailout target, so we can reuse the names that
@@ -2788,7 +2789,8 @@ class SsaUnoptimizedCodeGenerator extends SsaCodeGenerator {
nextBlock);
currentBailoutSwitch.cases.add(clause);
currentContainer = nextBlock;
- pushExpressionAsStatement(new js.Assignment(new js.VariableUse('state'),
+ String stateName = variableNames.stateName;
+ pushExpressionAsStatement(new js.Assignment(new js.VariableUse(stateName),
kasperl 2012/10/12 12:33:52 Add a helper for using the state? new js.Vari
floitsch 2012/10/12 13:16:44 Done.
new js.LiteralNumber('0')));
js.Block setupBlock = new js.Block.empty();
int i = 0;
@@ -2845,7 +2847,8 @@ class SsaUnoptimizedCodeGenerator extends SsaCodeGenerator {
List<js.SwitchClause> cases = <js.SwitchClause>[];
js.Block firstBlock = new js.Block.empty();
cases.add(new js.Case(new js.LiteralNumber("0"), firstBlock));
- currentBailoutSwitch = new js.Switch(new js.VariableUse('state'), cases);
+ String stateName = variableNames.stateName;
+ currentBailoutSwitch = new js.Switch(new js.VariableUse(stateName), cases);
pushStatement(currentBailoutSwitch);
oldContainerStack.add(currentContainer);
currentContainer = firstBlock;
@@ -2921,15 +2924,16 @@ class SsaUnoptimizedCodeGenerator extends SsaCodeGenerator {
elseGraph.start.bailoutTargets);
use(node.inputs[0]);
+ String stateName = variableNames.stateName;
js.Binary stateEquals0 =
new js.Binary('===',
- new js.VariableUse('state'), new js.LiteralNumber('0'));
+ new js.VariableUse(stateName), new js.LiteralNumber('0'));
js.Expression condition = new js.Binary('&&', stateEquals0, pop());
// TODO(ngeoffray): Put the condition initialization in the
// [setup] buffer.
List<HBailoutTarget> targets = node.thenBlock.bailoutTargets;
for (int i = 0, len = targets.length; i < len; i++) {
- js.VariableUse stateRef = new js.VariableUse('state');
+ js.VariableUse stateRef = new js.VariableUse(variableNames.stateName);
js.Expression targetState = new js.LiteralNumber('${targets[i].state}');
js.Binary stateTest = new js.Binary('===', stateRef, targetState);
condition = new js.Binary('||', stateTest, condition);
« no previous file with comments | « no previous file | lib/compiler/implementation/ssa/variable_allocator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698