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

Unified Diff: runtime/vm/flow_graph_compiler_x64.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_x64.cc
diff --git a/runtime/vm/flow_graph_compiler_x64.cc b/runtime/vm/flow_graph_compiler_x64.cc
index 59934cd1360ca8bbe5f9309aadcad9df9bc7c464..51215d5b1bf0d9e1c4be090c80a162692e2b4c0e 100644
--- a/runtime/vm/flow_graph_compiler_x64.cc
+++ b/runtime/vm/flow_graph_compiler_x64.cc
@@ -1234,32 +1234,17 @@ void FlowGraphCompiler::EmitUnoptimizedStaticCall(
}
-void FlowGraphCompiler::EmitEdgeCounter() {
+void FlowGraphCompiler::EmitEdgeCounter(intptr_t edge_id) {
// We do not check for overflow when incrementing the edge counter. The
// function should normally be optimized long before the counter can
// overflow; and though we do not reset the counters when we optimize or
// deoptimize, there is a bound on the number of
// optimization/deoptimization cycles we will attempt.
+ ASSERT(!edge_counters_array_.IsNull());
ASSERT(assembler_->constant_pool_allowed());
- const Array& counter = Array::ZoneHandle(zone(), Array::New(1, Heap::kOld));
- counter.SetAt(0, Smi::Handle(zone(), Smi::New(0)));
__ Comment("Edge counter");
- __ LoadUniqueObject(RAX, counter);
- intptr_t increment_start = assembler_->CodeSize();
- __ IncrementSmiField(FieldAddress(RAX, Array::element_offset(0)), 1);
- int32_t size = assembler_->CodeSize() - increment_start;
- if (isolate()->edge_counter_increment_size() == -1) {
- isolate()->set_edge_counter_increment_size(size);
- } else {
- ASSERT(size == isolate()->edge_counter_increment_size());
- }
-}
-
-
-int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() {
- const int32_t size = Isolate::Current()->edge_counter_increment_size();
- ASSERT(size != -1);
- return size;
+ __ LoadObject(RAX, edge_counters_array_);
+ __ IncrementSmiField(FieldAddress(RAX, Array::element_offset(edge_id)), 1);
}

Powered by Google App Engine
This is Rietveld 408576698