Chromium Code Reviews| 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; |
| } |