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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 10448059: Use temporary variable for StoreIndexed that returns a value. (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
« no previous file with comments | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
===================================================================
--- runtime/vm/flow_graph_builder.cc (revision 8108)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -1920,7 +1920,8 @@
}
-void EffectGraphVisitor::VisitStoreIndexedNode(StoreIndexedNode* node) {
+void EffectGraphVisitor::BuildStoreIndexedValues(
+ StoreIndexedNode* node, Value** array, Value** index, Value** value) {
ValueGraphVisitor for_array(owner(), temp_index());
node->array()->Visit(&for_array);
Append(for_array);
@@ -1930,15 +1931,43 @@
ValueGraphVisitor for_value(owner(), for_index.temp_index());
node->value()->Visit(&for_value);
Append(for_value);
+ *array = for_array.value();
+ *index = for_index.value();
+ *value = for_value.value();
+}
+
+
+void EffectGraphVisitor::VisitStoreIndexedNode(StoreIndexedNode* node) {
+ Value *array, *index, *value;
+ BuildStoreIndexedValues(node, &array, &index, &value);
StoreIndexedComp* store = new StoreIndexedComp(node->token_index(),
owner()->try_index(),
- for_array.value(),
- for_index.value(),
- for_value.value());
+ array,
+ index,
+ value);
ReturnComputation(store);
}
+void ValueGraphVisitor::VisitStoreIndexedNode(StoreIndexedNode* node) {
+ Value *array, *index, *value;
+ BuildStoreIndexedValues(node, &array, &index, &value);
+ BindInstr* store_local_instr = new BindInstr(
+ BuildStoreLocal(*owner()->parsed_function().expression_temp_var(),
+ value));
+ AddInstruction(store_local_instr);
+ UseVal* saved_value = new UseVal(store_local_instr);
+ StoreIndexedComp* store = new StoreIndexedComp(node->token_index(),
+ owner()->try_index(),
+ array,
+ index,
+ saved_value);
+ AddInstruction(new DoInstr(store));
+ ReturnComputation(
+ BuildLoadLocal(*owner()->parsed_function().expression_temp_var()));
+}
+
+
bool EffectGraphVisitor::MustSaveRestoreContext(SequenceNode* node) const {
return (node == owner()->parsed_function().node_sequence()) &&
(owner()->parsed_function().saved_context_var() != NULL);
« no previous file with comments | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698