Index: src/ic.cc |
diff --git a/src/ic.cc b/src/ic.cc |
index 1e2f0b6b1f02603d5d3938c356ad86051832e941..f13c2f5b79b3aa59d3381b23e185020c1499cb3b 100644 |
--- a/src/ic.cc |
+++ b/src/ic.cc |
@@ -435,6 +435,42 @@ void IC::PostPatching(Address address, Code* target, Code* old_target) { |
} |
+void IC::RegisterWeakMapDependency(Handle<Code> stub) { |
+ if (FLAG_collect_maps && FLAG_weak_embedded_maps_in_ic && |
+ stub->CanBeWeakStub()) { |
+ ASSERT(!stub->is_weak_stub()); |
+ MapHandleList maps; |
+ stub->FindAllMaps(&maps); |
+ if (maps.length() == 1 && stub->IsWeakObjectInIC(*maps.at(0))) { |
+ maps.at(0)->AddDependentIC(stub); |
+ stub->mark_as_weak_stub(); |
+ if (FLAG_enable_ool_constant_pool) { |
+ stub->constant_pool()->set_weak_object_state( |
+ ConstantPoolArray::WEAK_OBJECTS_IN_IC); |
+ } |
+ } |
+ } |
+} |
+ |
+ |
+void IC::InvalidateMaps(Code* stub) { |
+ ASSERT(stub->is_weak_stub()); |
+ stub->mark_as_invalidated_weak_stub(); |
+ Isolate* isolate = stub->GetIsolate(); |
+ Heap* heap = isolate->heap(); |
+ Object* undefined = heap->undefined_value(); |
+ int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
+ for (RelocIterator it(stub, mode_mask); !it.done(); it.next()) { |
+ RelocInfo::Mode mode = it.rinfo()->rmode(); |
+ if (mode == RelocInfo::EMBEDDED_OBJECT && |
+ it.rinfo()->target_object()->IsMap()) { |
+ it.rinfo()->set_target_object(undefined, SKIP_WRITE_BARRIER); |
+ } |
+ } |
+ CPU::FlushICache(stub->instruction_start(), stub->instruction_size()); |
+} |
+ |
+ |
void IC::Clear(Isolate* isolate, Address address, |
ConstantPoolArray* constant_pool) { |
Code* target = GetTargetAtAddress(address, constant_pool); |