Index: src/runtime-profiler.cc |
diff --git a/src/runtime-profiler.cc b/src/runtime-profiler.cc |
index b1e640c2ecb42c78215f6f632fb3a9b0aa13105b..ab76cc90649901d3f562de3f94c973ba1661e254 100644 |
--- a/src/runtime-profiler.cc |
+++ b/src/runtime-profiler.cc |
@@ -54,6 +54,8 @@ static const int kOSRCodeSizeAllowancePerTickIgnition = |
// the very first time it is seen on the stack. |
static const int kMaxSizeEarlyOpt = |
5 * FullCodeGenerator::kCodeSizeMultiplier; |
+static const int kMaxSizeEarlyOptIgnition = |
+ 5 * interpreter::Interpreter::kCodeSizeMultiplier; |
#define OPTIMIZATION_REASON_LIST(V) \ |
V(DoNotOptimize, "do not optimize") \ |
@@ -422,9 +424,18 @@ OptimizationReason RuntimeProfiler::ShouldOptimizeIgnition( |
} |
return OptimizationReason::kDoNotOptimize; |
} |
+ } else if (!any_ic_changed_ && |
+ shared->bytecode_array()->Size() < kMaxSizeEarlyOptIgnition) { |
+ // If no IC was patched since the last tick and this function is very |
mythria
2016/10/19 13:17:29
Just for my understanding, any_ic_changed_ means i
Benedikt Meurer
2016/10/19 13:19:40
That's a good point, I missed that. Can you put th
|
+ // small, optimistically optimize it now. |
+ int typeinfo, generic, total, type_percentage, generic_percentage; |
+ GetICCounts(function, &typeinfo, &generic, &total, &type_percentage, |
+ &generic_percentage); |
+ if (type_percentage >= FLAG_type_info_threshold && |
+ generic_percentage <= FLAG_generic_ic_threshold) { |
+ return OptimizationReason::kSmallFunction; |
+ } |
} |
- // TODO(rmcilroy): Consider whether we should optimize small functions when |
- // they are first seen on the stack (e.g., kMaxSizeEarlyOpt). |
return OptimizationReason::kDoNotOptimize; |
} |