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

Unified Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 1031673004: Caches the edge counter increment size in the isolate() (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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
===================================================================
--- runtime/vm/flow_graph_compiler_x64.cc (revision 44638)
+++ runtime/vm/flow_graph_compiler_x64.cc (working copy)
@@ -1240,32 +1240,20 @@
counter.SetAt(0, Smi::Handle(Smi::New(0)));
__ Comment("Edge counter");
__ LoadObject(RAX, counter, PP);
-#if defined(DEBUG)
intptr_t increment_start = assembler_->CodeSize();
-#endif // DEBUG
__ IncrementSmiField(FieldAddress(RAX, Array::element_offset(0)), 1);
-#if defined(DEBUG)
- // If the assertion below fails, update EdgeCounterIncrementSizeInBytes.
- intptr_t expected = EdgeCounterIncrementSizeInBytes();
- intptr_t actual = assembler_->CodeSize() - increment_start;
- if (actual != expected) {
- FATAL2("Edge counter increment length: %" Pd ", expected %" Pd "\n",
- actual,
- expected);
+ 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());
}
-#endif // DEBUG
}
int32_t FlowGraphCompiler::EdgeCounterIncrementSizeInBytes() {
- // Used by CodePatcher; so must be constant across all code in an isolate.
- int32_t size = 5;
-#if defined(DEBUG)
- size += 36; // VerifySmi
-#endif // DEBUG
- if (VerifiedMemory::enabled()) {
- size += 72;
- }
+ const int32_t size = Isolate::Current()->edge_counter_increment_size();
+ ASSERT(size != -1);
return size;
}

Powered by Google App Engine
This is Rietveld 408576698