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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 12212050: Fix allocation of array tables (use store barrier if needed, store values directly instead of via s… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 18412)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -1661,24 +1661,37 @@
void EffectGraphVisitor::VisitArrayNode(ArrayNode* node) {
- // Translate the array elements and collect their values.
- ZoneGrowableArray<PushArgumentInstr*>* arguments =
- new ZoneGrowableArray<PushArgumentInstr*>(node->length());
- for (int i = 0; i < node->length(); ++i) {
- ValueGraphVisitor for_value(owner(), temp_index());
- node->ElementAt(i)->Visit(&for_value);
- Append(for_value);
- arguments->Add(PushArgument(for_value.value()));
- }
const AbstractTypeArguments& type_args =
AbstractTypeArguments::ZoneHandle(node->type().arguments());
Value* element_type = BuildInstantiatedTypeArguments(node->token_pos(),
type_args);
CreateArrayInstr* create = new CreateArrayInstr(node->token_pos(),
- arguments,
+ node->length(),
node->type(),
element_type);
- ReturnDefinition(create);
+ Value* array_val = Bind(create);
+ Definition* store = BuildStoreTemp(node->temp_local(), array_val);
+ Do(store);
+
+ const intptr_t class_id = create->ResultCid();
+ const intptr_t deopt_id = Isolate::kNoDeoptId;
+ for (int i = 0; i < node->length(); ++i) {
+ Value* array = Bind(
+ new LoadLocalInstr(node->temp_local(), owner()->context_level()));
+ Value* index = Bind(new ConstantInstr(Smi::ZoneHandle(Smi::New(i))));
+ ValueGraphVisitor for_value(owner(), temp_index());
+ node->ElementAt(i)->Visit(&for_value);
+ Append(for_value);
+ // No store barrier needed for constants.
+ const bool emit_store_barrier = !for_value.value()->BindsToConstant();
+ StoreIndexedInstr* store = new StoreIndexedInstr(
+ array, index, for_value.value(),
+ emit_store_barrier, class_id, deopt_id);
+ Do(store);
+ }
+
+ ReturnDefinition(
+ new LoadLocalInstr(node->temp_local(), owner()->context_level()));
}
@@ -3046,8 +3059,10 @@
arguments->Add(new LiteralNode(args_pos, args_descriptor));
// The third argument is an array containing the original method arguments,
// including the receiver.
- ArrayNode* args_array =
- new ArrayNode(args_pos, Type::ZoneHandle(Type::ArrayType()));
+ ArrayNode* args_array = new ArrayNode(
+ args_pos,
+ Type::ZoneHandle(Type::ArrayType()),
+ *owner()->parsed_function().array_literal_var());
for (intptr_t i = 0; i < method_arguments->length(); i++) {
args_array->AddElement(method_arguments->NodeAt(i));
}
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | runtime/vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698