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

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: clean up comments, save space in IL Instruction class. 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
Index: runtime/vm/flow_graph_compiler.cc
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index 54f18c111fa370fe41fcbb2e95a19f585713fabf..031bae278fc8f1956aba8e48b42b02ab6905b404 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -206,6 +206,7 @@ FlowGraphCompiler::FlowGraphCompiler(
patch_code_pc_offset_(Code::kInvalidPc),
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) {
@@ -218,14 +219,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);
@@ -280,6 +282,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();
+ }
}

Powered by Google App Engine
This is Rietveld 408576698