Index: src/runtime-profiler.cc |
diff --git a/src/runtime-profiler.cc b/src/runtime-profiler.cc |
index 351bca7b6aa08d534f3a9e633fff8fadcf9dcc38..184007835b8579a1241e9777c3beece4af0882ca 100644 |
--- a/src/runtime-profiler.cc |
+++ b/src/runtime-profiler.cc |
@@ -181,10 +181,12 @@ void RuntimeProfiler::OptimizeNow() { |
// Attempt OSR if we are still running unoptimized code even though the |
// the function has long been marked or even already been optimized. |
int ticks = shared_code->profiler_ticks(); |
- int allowance = kOSRCodeSizeAllowanceBase + |
- ticks * kOSRCodeSizeAllowancePerTick; |
- if (shared_code->CodeSize() > allowance) { |
- if (ticks < 255) shared_code->set_profiler_ticks(ticks + 1); |
+ int64_t allowance = |
+ kOSRCodeSizeAllowanceBase + |
+ static_cast<int64_t>(ticks) * kOSRCodeSizeAllowancePerTick; |
+ if (shared_code->CodeSize() > allowance && |
+ ticks < Code::ProfilerTicksField::kMax) { |
+ shared_code->set_profiler_ticks(ticks + 1); |
} else { |
AttemptOnStackReplacement(function); |
} |