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

Unified Diff: src/objects-inl.h

Issue 23803007: Fix wraparound of deoptimization count in shared function info. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | « src/objects.h ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index fc5ed247ee5a86f38aa6a59794ace121fe538da4..8dce54443a0da786216d8283f4f8cb47747619f9 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -4888,8 +4888,20 @@ void SharedFunctionInfo::set_deopt_count(int deopt_count) {
void SharedFunctionInfo::increment_deopt_count() {
int value = counters();
int deopt_count = DeoptCountBits::decode(value);
- deopt_count = (deopt_count + 1) & DeoptCountBits::kMax;
- set_counters(DeoptCountBits::update(value, deopt_count));
+ if (deopt_count < DeoptCountBits::kMax) {
+ deopt_count = (deopt_count + 1) & DeoptCountBits::kMax;
Toon Verwaest 2013/09/05 18:13:57 I guess this mask isn't necessary anymore.
+ set_counters(DeoptCountBits::update(value, deopt_count));
+ if (deopt_count == DeoptCountBits::kMax) {
+ // We hit the limit; temporarily disable optimization.
+ // The runtime profiler may try to reenable optimization sometime later.
+ DisableOptimization(kDeoptimizedTooManyTimes);
+ }
+ }
+}
+
+
+bool SharedFunctionInfo::too_many_deopts() {
+ return DeoptCountBits::decode(counters()) == DeoptCountBits::kMax;
}
« no previous file with comments | « src/objects.h ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698