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

Unified Diff: vm/flow_graph_builder.cc

Issue 10825176: Refactor our IL instruction for static setters. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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: vm/flow_graph_builder.cc
===================================================================
--- vm/flow_graph_builder.cc (revision 10216)
+++ vm/flow_graph_builder.cc (working copy)
@@ -1789,7 +1789,8 @@
}
-void EffectGraphVisitor::VisitStaticSetterNode(StaticSetterNode* node) {
+void EffectGraphVisitor::BuildStaticSetter(StaticSetterNode* node,
+ bool result_is_needed) {
const String& setter_name =
String::Handle(Field::SetterName(node->field_name()));
const Function& setter_function =
@@ -1798,14 +1799,42 @@
ValueGraphVisitor for_value(owner(), temp_index());
node->value()->Visit(&for_value);
Append(for_value);
- StaticSetterComp* call = new StaticSetterComp(node->token_pos(),
- owner()->try_index(),
- setter_function,
- for_value.value());
- ReturnComputation(call);
+ Value* value = NULL;
+ if (result_is_needed) {
+ value = Bind(
+ BuildStoreLocal(*owner()->parsed_function().expression_temp_var(),
+ for_value.value()));
+ } else {
+ value = for_value.value();
+ }
+ ZoneGrowableArray<PushArgumentInstr*>* arguments =
+ new ZoneGrowableArray<PushArgumentInstr*>(1);
+ arguments->Add(PushArgument(value));
+ StaticCallComp* call = new StaticCallComp(node->token_pos(),
+ owner()->try_index(),
+ setter_function,
+ Array::ZoneHandle(), // No names.
+ arguments);
+ if (result_is_needed) {
+ Do(call);
+ ReturnComputation(
+ BuildLoadLocal(*owner()->parsed_function().expression_temp_var()));
+ } else {
+ ReturnComputation(call);
+ }
}
+void EffectGraphVisitor::VisitStaticSetterNode(StaticSetterNode* node) {
+ BuildStaticSetter(node, false); // Result not needed.
+}
+
+
+void ValueGraphVisitor::VisitStaticSetterNode(StaticSetterNode* node) {
+ BuildStaticSetter(node, true); // Result needed.
+}
+
+
void EffectGraphVisitor::VisitNativeBodyNode(NativeBodyNode* node) {
NativeCallComp* native_call =
new NativeCallComp(node, owner()->try_index());
« no previous file with comments | « vm/flow_graph_builder.h ('k') | vm/intermediate_language.h » ('j') | vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698