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

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 1343383003: VM: Store edge counters in one per-function array. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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_compiler.h ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler.cc
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index ca7627d8c581dd74ff9f9cd169b1c79d55a62d38..2884abf3fb0f21dbebcf167e145e6f4ed50a5f1c 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -208,6 +208,7 @@ FlowGraphCompiler::FlowGraphCompiler(
pending_deoptimization_env_(NULL),
lazy_deopt_pc_offset_(Code::kInvalidPc),
deopt_id_to_ic_data_(NULL),
+ edge_counters_array_(Array::ZoneHandle()),
inlined_code_intervals_(Array::ZoneHandle(Object::empty_array().raw())),
inline_id_to_function_(inline_id_to_function),
caller_inline_id_(caller_inline_id) {
@@ -220,14 +221,15 @@ FlowGraphCompiler::FlowGraphCompiler(
for (intptr_t i = 0; i < len; i++) {
(*deopt_id_to_ic_data_)[i] = NULL;
}
- const Array& old_saved_icdata = Array::Handle(zone(),
+ // TODO(fschneider): Abstract iteration into ICDataArrayIterator.
+ const Array& old_saved_ic_data = Array::Handle(zone(),
flow_graph->function().ic_data_array());
const intptr_t saved_len =
- old_saved_icdata.IsNull() ? 0 : old_saved_icdata.Length();
- for (intptr_t i = 0; i < saved_len; i++) {
- ICData& icd = ICData::ZoneHandle(zone());
- icd ^= old_saved_icdata.At(i);
- (*deopt_id_to_ic_data_)[icd.deopt_id()] = &icd;
+ old_saved_ic_data.IsNull() ? 0 : old_saved_ic_data.Length();
+ for (intptr_t i = 1; i < saved_len; i++) {
+ ICData& ic_data = ICData::ZoneHandle(zone());
+ ic_data ^= old_saved_ic_data.At(i);
+ (*deopt_id_to_ic_data_)[ic_data.deopt_id()] = &ic_data;
}
}
ASSERT(assembler != NULL);
@@ -282,6 +284,17 @@ void FlowGraphCompiler::InitCompiler() {
Instruction* first = flow_graph_.graph_entry()->normal_entry()->next();
if (first->IsCheckStackOverflow()) first->RemoveFromGraph();
}
+ if (!is_optimizing()) {
+ // Initialize edge counter array.
+ const intptr_t num_counters = flow_graph_.preorder().length();
+ const Array& edge_counters =
+ Array::Handle(Array::New(num_counters, Heap::kOld));
+ const Smi& zero_smi = Smi::Handle(Smi::New(0));
+ for (intptr_t i = 0; i < num_counters; ++i) {
+ edge_counters.SetAt(i, zero_smi);
+ }
+ edge_counters_array_ = edge_counters.raw();
+ }
}
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698