Index: src/ic.cc |
diff --git a/src/ic.cc b/src/ic.cc |
index b084109a713aa572bb79acdfb7f1155d8a9ba9f8..9122294bee2f3cca32d3eea2e2b363e1f2c988ae 100644 |
--- a/src/ic.cc |
+++ b/src/ic.cc |
@@ -292,6 +292,31 @@ Failure* IC::ReferenceError(const char* type, Handle<String> name) { |
} |
+void IC::PostPatching() { |
+ if (FLAG_counting_profiler) { |
+ 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 |
+ // current function and the functions above it on the stack that |
+ // might want to inline this one. |
+ StackFrameIterator it; |
+ if (it.done()) return; |
+ it.Advance(); |
+ static const int kStackFramesToMark = Compiler::kMaxInliningLevels - 1; |
+ for (int i = 0; i < kStackFramesToMark; ++i) { |
+ if (it.done()) return; |
+ StackFrame* raw_frame = it.frame(); |
+ if (raw_frame->is_java_script()) { |
+ JSFunction* function = |
+ JSFunction::cast(JavaScriptFrame::cast(raw_frame)->function()); |
+ function->shared()->set_profiler_ticks(0); |
+ } |
+ it.Advance(); |
+ } |
+ } |
+} |
+ |
+ |
void IC::Clear(Address address) { |
Code* target = GetTargetAtAddress(address); |