Index: src/runtime-profiler.cc |
diff --git a/src/runtime-profiler.cc b/src/runtime-profiler.cc |
index 7c24ae6adcb9b3a4b4f270f4f758eed12d83eb5a..dcca30ba7ee2dda8caf5fbe782dadb795b7852a9 100644 |
--- a/src/runtime-profiler.cc |
+++ b/src/runtime-profiler.cc |
@@ -109,6 +109,10 @@ void RuntimeProfiler::Optimize(JSFunction* function, const char* reason) { |
function->PrintName(); |
PrintF(" 0x%" V8PRIxPTR, reinterpret_cast<intptr_t>(function->address())); |
PrintF(" for recompilation, reason: %s", reason); |
+ int typeinfo = function->shared()->ic_typeinfo_count(); |
+ int total = function->shared()->ic_total_count(); |
+ PrintF(", ICs with typeinfo: %d/%d (%d%%)", |
Vyacheslav Egorov (Chromium)
2012/02/15 12:07:39
I sense SIGFPE here for code objects without ICs.
Jakob Kummerow
2012/02/17 16:07:52
Done.
|
+ typeinfo, total, (100*typeinfo/total)); |
PrintF("]\n"); |
} |
@@ -258,9 +262,21 @@ void RuntimeProfiler::OptimizeNow() { |
int ticks = function->shared()->profiler_ticks(); |
if (ticks >= kProfilerTicksBeforeOptimization) { |
- // If this particular function hasn't had any ICs patched for enough |
- // ticks, optimize it now. |
- Optimize(function, "hot and stable"); |
+ int ic_typeinfo = function->shared()->ic_typeinfo_count(); |
Vyacheslav Egorov (Chromium)
2012/02/15 12:07:39
I would rename ic_typeinfo_count into ic_with_type
Jakob Kummerow
2012/02/17 16:07:52
Done.
|
+ int ic_total = function->shared()->ic_total_count(); |
+ int percentage = 100 * ic_typeinfo / ic_total; |
Vyacheslav Egorov (Chromium)
2012/02/15 12:07:39
I sense SIGFPE here for code objects without ICs.
Jakob Kummerow
2012/02/17 16:07:52
Done.
|
+ if (percentage >= FLAG_type_info_threshold) { |
+ // If this particular function hasn't had any ICs patched for enough |
+ // ticks, optimize it now. |
+ Optimize(function, "hot and stable"); |
+ } else { |
+ if (FLAG_trace_opt_verbose) { |
+ PrintF("[not yet optimizing "); |
+ function->PrintName(); |
+ PrintF(", not enough type info: %d/%d (%d%%)]\n", |
+ ic_typeinfo, ic_total, percentage); |
+ } |
+ } |
} else if (!any_ic_changed_ && |
function->shared()->code()->instruction_size() < kMaxSizeEarlyOpt) { |
// If no IC was patched since the last tick and this function is very |