Index: src/ic.cc |
diff --git a/src/ic.cc b/src/ic.cc |
index f774b928ce7c7656b19bdc7d69abb103ae218967..6edfa91bd420729d8484d51508bf1cecbb909ba4 100644 |
--- a/src/ic.cc |
+++ b/src/ic.cc |
@@ -296,8 +296,20 @@ Failure* IC::ReferenceError(const char* type, Handle<String> name) { |
} |
-void IC::PostPatching() { |
- if (FLAG_watch_ic_patching) { |
+void IC::PostPatching(Address address, Code* target, Code* old_target) { |
+ bool increment_ics_with_typeinfo = false; |
+ if (FLAG_type_info_threshold > 0) { |
+ if (old_target->is_inline_cache_stub() && |
+ target->is_inline_cache_stub()) { |
+ State old_state = old_target->ic_state(); |
+ State new_state = target->ic_state(); |
+ if ((old_state == UNINITIALIZED || old_state == PREMONOMORPHIC) && |
+ (new_state != UNINITIALIZED && new_state != PREMONOMORPHIC)) { |
+ increment_ics_with_typeinfo = true; |
+ } |
+ } |
+ } |
+ if (FLAG_watch_ic_patching || FLAG_type_info_threshold) { |
Isolate::Current()->runtime_profiler()->NotifyICChanged(); |
// We do not want to optimize until the ICs have settled down, |
// so when they are patched, we postpone optimization for the |
@@ -313,7 +325,19 @@ void IC::PostPatching() { |
if (raw_frame->is_java_script()) { |
JSFunction* function = |
JSFunction::cast(JavaScriptFrame::cast(raw_frame)->function()); |
- function->shared()->set_profiler_ticks(0); |
+ if (function->IsOptimized()) continue; |
+ SharedFunctionInfo* shared = function->shared(); |
+ if (FLAG_watch_ic_patching) { |
+ shared->set_profiler_ticks(0); |
+ } |
+ if (increment_ics_with_typeinfo) { |
+ Code* code = shared->code(); |
+ if (address > code->instruction_start() && |
Vyacheslav Egorov (Chromium)
2012/02/15 12:07:39
I think Code has Contains method.
Jakob Kummerow
2012/02/17 16:07:52
Thanks for the suggestion; but this is obsolete an
|
+ address < code->instruction_end()) { |
+ shared->set_ic_typeinfo_count(shared->ic_typeinfo_count() + 1); |
Vyacheslav Egorov (Chromium)
2012/02/15 12:07:39
Please add a small comment that this what this cod
Jakob Kummerow
2012/02/17 16:07:52
This is obsolete too.
|
+ increment_ics_with_typeinfo = false; // Done. |
+ } |
+ } |
} |
it.Advance(); |
} |