Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 64d85a0685a98470ad66df6207a6f18f8448eeae..31919d866847d4cb522cfb549bea525e4eb7eb2d 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -7869,6 +7869,14 @@ void SharedFunctionInfo::AttachInitialMap(Map* map) { |
} |
+void SharedFunctionInfo::ResetForNewContext(int new_ic_age) { |
+ code()->ClearInlineCaches(); |
+ set_ic_age(new_ic_age); |
+ set_opt_count(0); |
+ set_profiler_ticks(0); |
+} |
+ |
+ |
static void GetMinInobjectSlack(Map* map, void* data) { |
int slack = map->unused_property_fields(); |
if (*reinterpret_cast<int*>(data) > slack) { |
@@ -8116,6 +8124,21 @@ Map* Code::FindFirstMap() { |
} |
+void Code::ClearInlineCaches() { |
+ int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET) | |
+ RelocInfo::ModeMask(RelocInfo::CONSTRUCT_CALL) | |
+ RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID) | |
+ RelocInfo::ModeMask(RelocInfo::CODE_TARGET_CONTEXT); |
+ for (RelocIterator it(this, mask); !it.done(); it.next()) { |
+ RelocInfo* info = it.rinfo(); |
+ Code* target(Code::GetCodeFromTargetAddress(info->target_address())); |
+ if (target->is_inline_cache_stub()) { |
+ IC::Clear(info->pc()); |
+ } |
+ } |
+} |
+ |
+ |
#ifdef ENABLE_DISASSEMBLER |
void DeoptimizationInputData::DeoptimizationInputDataPrint(FILE* out) { |