References from code to Structures should be stronger than weak
[WebKit-https.git] / Source / JavaScriptCore / bytecode / StructureStubInfo.cpp
index d925cfc..77531c5 100644 (file)
@@ -230,7 +230,10 @@ void StructureStubInfo::visitWeakReferences(CodeBlock* codeBlock)
 {
     VM& vm = *codeBlock->vm();
     
 {
     VM& vm = *codeBlock->vm();
     
-    bufferedStructures.clear();
+    bufferedStructures.genericFilter(
+        [&] (Structure* structure) -> bool {
+            return Heap::isMarked(structure);
+        });
 
     switch (cacheType) {
     case CacheType::GetByIdSelf:
 
     switch (cacheType) {
     case CacheType::GetByIdSelf:
@@ -250,6 +253,22 @@ void StructureStubInfo::visitWeakReferences(CodeBlock* codeBlock)
     resetByGC = true;
 }
 
     resetByGC = true;
 }
 
+bool StructureStubInfo::propagateTransitions(SlotVisitor& visitor)
+{
+    switch (cacheType) {
+    case CacheType::Unset:
+        return true;
+    case CacheType::GetByIdSelf:
+    case CacheType::PutByIdReplace:
+        return u.byIdSelf.baseObjectStructure->markIfCheap(visitor);
+    case CacheType::Stub:
+        return u.stub->propagateTransitions(visitor);
+    }
+    
+    RELEASE_ASSERT_NOT_REACHED();
+    return true;
+}
+
 bool StructureStubInfo::containsPC(void* pc) const
 {
     if (cacheType != CacheType::Stub)
 bool StructureStubInfo::containsPC(void* pc) const
 {
     if (cacheType != CacheType::Stub)