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

Unified Diff: runtime/vm/object.cc

Issue 2647913002: Optimizations to IC stub for unoptimized code performance on x64. (Closed)
Patch Set: Feedback from Regis Created 3 years, 11 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/assembler_x64.cc ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 69810fdf5e52e4f1c0a9d0174e5082ef65af3f60..2fe3131c536a90f43f49b42b8f6d5128ef2839ef 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -13465,7 +13465,13 @@ intptr_t ICData::GetCountAt(intptr_t index) const {
const Array& data = Array::Handle(ic_data());
const intptr_t data_pos =
index * TestEntryLength() + CountIndexFor(NumArgsTested());
- return Smi::Value(Smi::RawCast(data.At(data_pos)));
+ intptr_t value = Smi::Value(Smi::RawCast(data.At(data_pos)));
+ if (value >= 0) return value;
+
+ // The counter very rarely overflows to a negative value, but if it does, we
+ // would rather just reset it to zero.
+ SetCountAt(index, 0);
+ return 0;
}
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/stub_code_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698