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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 10389041: Adapt compile time constants and integrate with Kevin's CL 10302007 (Remove temporaries using expli… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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
Index: runtime/vm/flow_graph_builder.cc
===================================================================
--- runtime/vm/flow_graph_builder.cc (revision 7463)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -400,21 +400,42 @@
}
BindInstr* constant_true = new BindInstr(new ConstantVal(bool_true));
for_right.AddInstruction(constant_true);
- StrictCompareComp* comp = new StrictCompareComp(Token::kEQ_STRICT,
- right_value, new UseVal(constant_true));
- for_right.AddInstruction(new BindInstr(comp));
+ BindInstr* comp =
+ new BindInstr(new StrictCompareComp(Token::kEQ_STRICT,
+ right_value,
+ new UseVal(constant_true)));
+ for_right.AddInstruction(comp);
+ for_right.AddInstruction(
+ new DoInstr(new StoreLocalComp(
+ *owner()->parsed_function().expression_temp_var(),
+ new UseVal(comp),
+ owner()->context_level())));
if (node->kind() == Token::kAND) {
ValueGraphVisitor for_false(owner(), temp_index());
- for_false.ReturnComputation(new ConstantVal(bool_false));
+ BindInstr* constant_false = new BindInstr(new ConstantVal(bool_false));
+ for_false.AddInstruction(constant_false);
+ for_false.AddInstruction(
+ new DoInstr(new StoreLocalComp(
+ *owner()->parsed_function().expression_temp_var(),
+ new UseVal(constant_false),
+ owner()->context_level())));
Join(for_test, for_right, for_false);
} else {
ASSERT(node->kind() == Token::kOR);
ValueGraphVisitor for_true(owner(), temp_index());
- for_true.ReturnComputation(new ConstantVal(bool_true));
+ BindInstr* constant_true = new BindInstr(new ConstantVal(bool_true));
+ for_true.AddInstruction(constant_true);
+ for_true.AddInstruction(
+ new DoInstr(new StoreLocalComp(
+ *owner()->parsed_function().expression_temp_var(),
+ new UseVal(constant_true),
+ owner()->context_level())));
Join(for_test, for_true, for_right);
}
- ReturnValue(new TempVal(temp_index() - 1));
+ ReturnComputation(
+ new LoadLocalComp(*owner()->parsed_function().expression_temp_var(),
+ owner()->context_level()));
return;
}
EffectGraphVisitor::VisitBinaryOpNode(node);
@@ -746,20 +767,28 @@
node->condition()->token_index());
node->condition()->Visit(&for_test);
- // Ensure that the value of the true/false subexpressions are named with
- // the same temporary name.
ValueGraphVisitor for_true(owner(), temp_index());
node->true_expr()->Visit(&for_true);
ASSERT(for_true.is_open());
- ASSERT(for_true.value()->IsTemp() || for_true.value()->IsUse());
+ for_true.AddInstruction(
+ new DoInstr(
+ new StoreLocalComp(*owner()->parsed_function().expression_temp_var(),
+ for_true.value(),
+ owner()->context_level())));
ValueGraphVisitor for_false(owner(), temp_index());
node->false_expr()->Visit(&for_false);
ASSERT(for_false.is_open());
- ASSERT(for_false.value()->IsTemp() || for_false.value()->IsUse());
+ for_false.AddInstruction(
+ new DoInstr(
+ new StoreLocalComp(*owner()->parsed_function().expression_temp_var(),
+ for_false.value(),
+ owner()->context_level())));
Join(for_test, for_true, for_false);
- ReturnValue(new TempVal(temp_index() - 1));
+ ReturnComputation(
+ new LoadLocalComp(*owner()->parsed_function().expression_temp_var(),
+ owner()->context_level()));
}
@@ -2085,13 +2114,8 @@
}
-void FlowGraphPrinter::VisitTemp(TempVal* val) {
- OS::Print("t%d", val->index());
-}
-
-
void FlowGraphPrinter::VisitUse(UseVal* val) {
- OS::Print("s%d", val->definition()->temp_index());
+ OS::Print("t%d", val->definition()->temp_index());
}

Powered by Google App Engine
This is Rietveld 408576698