Index: src/handles.cc |
diff --git a/src/handles.cc b/src/handles.cc |
index b3704df698970eb140f939f5e2a759112ac26833..f49a10586d08ec14248a1c67d566bd694c7db30a 100644 |
--- a/src/handles.cc |
+++ b/src/handles.cc |
@@ -905,4 +905,18 @@ DeferredHandles* DeferredHandleScope::Detach() { |
} |
+void AddWeakObjectToCodeDependency(Heap* heap, |
+ Handle<Object> object, |
+ Handle<Code> code) { |
+ if (!heap->weak_object_to_code()->IsHashTable()) { |
+ heap->set_weak_object_to_code( |
+ *heap->isolate()->factory()->NewWeakHashTable(16)); |
+ } |
+ Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(*object)); |
+ dep = DependentCode::Insert(dep, DependentCode::kWeaklyEmbeddedGroup, code); |
+ CALL_HEAP_FUNCTION_VOID(heap->isolate(), |
+ heap->AddWeakObjectToCodeDependency(*object, *dep)); |
+} |
+ |
+ |
} } // namespace v8::internal |