]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - bytecode/StructureStubInfo.cpp
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / bytecode / StructureStubInfo.cpp
index 9dd41a6e32f7bda7831d47f1170b01cc98225c23..5ea530c8aa6bea90cda9a41cb85c4940b2250d7a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2014 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,7 +27,8 @@
 #include "StructureStubInfo.h"
 
 #include "JSObject.h"
-#include "ScopeChain.h"
+#include "PolymorphicGetByIdList.h"
+#include "PolymorphicPutByIdList.h"
 
 namespace JSC {
 
@@ -35,77 +36,69 @@ namespace JSC {
 void StructureStubInfo::deref()
 {
     switch (accessType) {
-    case access_get_by_id_self_list: {
-        PolymorphicAccessStructureList* polymorphicStructures = u.getByIdSelfList.structureList;
-        delete polymorphicStructures;
+    case access_get_by_id_list: {
+        delete u.getByIdList.list;
         return;
     }
-    case access_get_by_id_proto_list: {
-        PolymorphicAccessStructureList* polymorphicStructures = u.getByIdProtoList.structureList;
+    case access_put_by_id_list:
+        delete u.putByIdList.list;
+        return;
+    case access_in_list: {
+        PolymorphicAccessStructureList* polymorphicStructures = u.inList.structureList;
         delete polymorphicStructures;
         return;
     }
     case access_get_by_id_self:
-    case access_get_by_id_proto:
-    case access_get_by_id_chain:
-    case access_put_by_id_transition:
+    case access_put_by_id_transition_normal:
+    case access_put_by_id_transition_direct:
     case access_put_by_id_replace:
-    case access_get_by_id:
-    case access_put_by_id:
-    case access_get_by_id_generic:
-    case access_put_by_id_generic:
-    case access_get_array_length:
-    case access_get_string_length:
+    case access_unset:
         // These instructions don't have to release any allocated memory
         return;
     default:
-        ASSERT_NOT_REACHED();
+        RELEASE_ASSERT_NOT_REACHED();
     }
 }
 
-void StructureStubInfo::visitAggregate(SlotVisitor& visitor)
+bool StructureStubInfo::visitWeakReferences(RepatchBuffer& repatchBuffer)
 {
     switch (accessType) {
     case access_get_by_id_self:
-        visitor.append(&u.getByIdSelf.baseObjectStructure);
-        return;
-    case access_get_by_id_proto:
-        visitor.append(&u.getByIdProto.baseObjectStructure);
-        visitor.append(&u.getByIdProto.prototypeStructure);
-        return;
-    case access_get_by_id_chain:
-        visitor.append(&u.getByIdChain.baseObjectStructure);
-        visitor.append(&u.getByIdChain.chain);
-        return;
-    case access_get_by_id_self_list: {
-        PolymorphicAccessStructureList* polymorphicStructures = u.getByIdSelfList.structureList;
-        polymorphicStructures->visitAggregate(visitor, u.getByIdSelfList.listSize);
-        return;
+        if (!Heap::isMarked(u.getByIdSelf.baseObjectStructure.get()))
+            return false;
+        break;
+    case access_get_by_id_list: {
+        if (!u.getByIdList.list->visitWeak(repatchBuffer))
+            return false;
+        break;
     }
-    case access_get_by_id_proto_list: {
-        PolymorphicAccessStructureList* polymorphicStructures = u.getByIdProtoList.structureList;
-        polymorphicStructures->visitAggregate(visitor, u.getByIdProtoList.listSize);
-        return;
-    }
-    case access_put_by_id_transition:
-        visitor.append(&u.putByIdTransition.previousStructure);
-        visitor.append(&u.putByIdTransition.structure);
-        visitor.append(&u.putByIdTransition.chain);
-        return;
+    case access_put_by_id_transition_normal:
+    case access_put_by_id_transition_direct:
+        if (!Heap::isMarked(u.putByIdTransition.previousStructure.get())
+            || !Heap::isMarked(u.putByIdTransition.structure.get())
+            || !Heap::isMarked(u.putByIdTransition.chain.get()))
+            return false;
+        break;
     case access_put_by_id_replace:
-        visitor.append(&u.putByIdReplace.baseObjectStructure);
-        return;
-    case access_get_by_id:
-    case access_put_by_id:
-    case access_get_by_id_generic:
-    case access_put_by_id_generic:
-    case access_get_array_length:
-    case access_get_string_length:
-        // These instructions don't need to mark anything
-        return;
+        if (!Heap::isMarked(u.putByIdReplace.baseObjectStructure.get()))
+            return false;
+        break;
+    case access_put_by_id_list:
+        if (!u.putByIdList.list->visitWeak(repatchBuffer))
+            return false;
+        break;
+    case access_in_list: {
+        PolymorphicAccessStructureList* polymorphicStructures = u.inList.structureList;
+        if (!polymorphicStructures->visitWeak(u.inList.listSize))
+            return false;
+        break;
+    }
     default:
-        ASSERT_NOT_REACHED();
+        // The rest of the instructions don't require references, so there is no need to
+        // do anything.
+        break;
     }
+    return true;
 }
 #endif