Unreviewed, rolling out r192416 and r192443.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Nov 2015 01:18:58 +0000 (01:18 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Nov 2015 01:18:58 +0000 (01:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151285

Broke 32-bit in some mysterious way I need to understand
(Requested by kling on #webkit).

Reverted changesets:

"[JSC] JSPropertyNameEnumerator could be destructorless."
https://bugs.webkit.org/show_bug.cgi?id=151242
http://trac.webkit.org/changeset/192416

"Follow-up for 32-bit test failures after..."
https://bugs.webkit.org/show_bug.cgi?id=151242
http://trac.webkit.org/changeset/192443

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192453 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/heap/CopyToken.h
Source/JavaScriptCore/runtime/JSPropertyNameEnumerator.cpp
Source/JavaScriptCore/runtime/JSPropertyNameEnumerator.h

index 48c69e0..4e894ba 100644 (file)
@@ -1,5 +1,23 @@
 2015-11-13  Commit Queue  <commit-queue@webkit.org>
 
+        Unreviewed, rolling out r192416 and r192443.
+        https://bugs.webkit.org/show_bug.cgi?id=151285
+
+        Broke 32-bit in some mysterious way I need to understand
+        (Requested by kling on #webkit).
+
+        Reverted changesets:
+
+        "[JSC] JSPropertyNameEnumerator could be destructorless."
+        https://bugs.webkit.org/show_bug.cgi?id=151242
+        http://trac.webkit.org/changeset/192416
+
+        "Follow-up for 32-bit test failures after..."
+        https://bugs.webkit.org/show_bug.cgi?id=151242
+        http://trac.webkit.org/changeset/192443
+
+2015-11-13  Commit Queue  <commit-queue@webkit.org>
+
         Unreviewed, rolling out r192401.
         https://bugs.webkit.org/show_bug.cgi?id=151282
 
index d79038a..e8f8109 100644 (file)
@@ -32,8 +32,7 @@ enum CopyToken {
     ButterflyCopyToken,
     TypedArrayVectorCopyToken,
     MapBackingStoreCopyToken,
-    DirectArgumentsOverridesCopyToken,
-    JSPropertyNameEnumeratorCopyToken,
+    DirectArgumentsOverridesCopyToken
 };
 
 } // namespace JSC
index 2415517..690920f 100644 (file)
@@ -26,8 +26,6 @@
 #include "config.h"
 #include "JSPropertyNameEnumerator.h"
 
-#include "CopiedBlockInlines.h"
-#include "CopyVisitorInlines.h"
 #include "JSCInlines.h"
 #include "StrongInlines.h"
 
@@ -72,45 +70,25 @@ void JSPropertyNameEnumerator::finishCreation(VM& vm, uint32_t indexedLength, ui
     m_endStructurePropertyIndex = endStructurePropertyIndex;
     m_endGenericPropertyIndex = vector.size();
 
-    if (!vector.isEmpty()) {
-        void* backingStore;
-        RELEASE_ASSERT(vm.heap.tryAllocateStorage(this, propertyNameCacheSize(), &backingStore));
-        WriteBarrier<JSString>* propertyNames = reinterpret_cast<WriteBarrier<JSString>*>(backingStore);
-        m_propertyNames.set(vm, this, propertyNames);
-
-        for (unsigned i = 0; i < vector.size(); ++i)
-            propertyNames[i].set(vm, this, jsString(&vm, vector[i].string()));
+    m_propertyNames.resizeToFit(vector.size());
+    for (unsigned i = 0; i < vector.size(); ++i) {
+        const Identifier& identifier = vector[i];
+        m_propertyNames[i].set(vm, this, jsString(&vm, identifier.string()));
     }
 }
 
-void JSPropertyNameEnumerator::visitChildren(JSCell* cell, SlotVisitor& visitor)
+void JSPropertyNameEnumerator::destroy(JSCell* cell)
 {
-    Base::visitChildren(cell, visitor);
-    JSPropertyNameEnumerator* thisObject = jsCast<JSPropertyNameEnumerator*>(cell);
-    visitor.append(&thisObject->m_prototypeChain);
-
-    if (thisObject->cachedPropertyNameCount()) {
-        visitor.appendValues(reinterpret_cast<WriteBarrier<Unknown>*>(thisObject->m_propertyNames.getWithoutBarrier()), thisObject->cachedPropertyNameCount());
-        visitor.copyLater(
-            thisObject, JSPropertyNameEnumeratorCopyToken,
-            thisObject->m_propertyNames.getWithoutBarrier(), thisObject->propertyNameCacheSize());
-    }
+    jsCast<JSPropertyNameEnumerator*>(cell)->JSPropertyNameEnumerator::~JSPropertyNameEnumerator();
 }
 
-void JSPropertyNameEnumerator::copyBackingStore(JSCell* cell, CopyVisitor& visitor, CopyToken token)
+void JSPropertyNameEnumerator::visitChildren(JSCell* cell, SlotVisitor& visitor)
 {
+    Base::visitChildren(cell, visitor);
     JSPropertyNameEnumerator* thisObject = jsCast<JSPropertyNameEnumerator*>(cell);
-    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
-
-    RELEASE_ASSERT(token == JSPropertyNameEnumeratorCopyToken);
-
-    void* oldPropertyNames = thisObject->m_propertyNames.getWithoutBarrier();
-    if (visitor.checkIfShouldCopy(oldPropertyNames)) {
-        WriteBarrier<JSString>* newPropertyNames = static_cast<WriteBarrier<JSString>*>(visitor.allocateNewSpace(thisObject->propertyNameCacheSize()));
-        memcpy(newPropertyNames, oldPropertyNames, thisObject->propertyNameCacheSize());
-        thisObject->m_propertyNames.setWithoutBarrier(newPropertyNames);
-        visitor.didCopy(oldPropertyNames, thisObject->propertyNameCacheSize());
-    }
+    for (unsigned i = 0; i < thisObject->m_propertyNames.size(); ++i)
+        visitor.append(&thisObject->m_propertyNames[i]);
+    visitor.append(&thisObject->m_prototypeChain);
 }
 
 } // namespace JSC
index 2e2b194..8406c46 100644 (file)
@@ -43,6 +43,9 @@ public:
     static JSPropertyNameEnumerator* create(VM&);
     static JSPropertyNameEnumerator* create(VM&, Structure*, uint32_t, uint32_t, PropertyNameArray&);
 
+    static const bool needsDestruction = true;
+    static void destroy(JSCell*);
+
     static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
     {
         return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info());
@@ -52,9 +55,9 @@ public:
 
     JSString* propertyNameAtIndex(uint32_t index) const
     {
-        if (index >= cachedPropertyNameCount())
+        if (index >= m_propertyNames.size())
             return nullptr;
-        return m_propertyNames.get(this)[index].get();
+        return m_propertyNames[index].get();
     }
 
     StructureChain* cachedPrototypeChain() const { return m_prototypeChain.get(); }
@@ -78,30 +81,18 @@ public:
     static ptrdiff_t cachedInlineCapacityOffset() { return OBJECT_OFFSETOF(JSPropertyNameEnumerator, m_cachedInlineCapacity); }
     static ptrdiff_t cachedPropertyNamesVectorOffset()
     {
-        return OBJECT_OFFSETOF(JSPropertyNameEnumerator, m_propertyNames);
+        return OBJECT_OFFSETOF(JSPropertyNameEnumerator, m_propertyNames) + Vector<WriteBarrier<JSString>>::dataMemoryOffset();
     }
 
     static void visitChildren(JSCell*, SlotVisitor&);
-    static void copyBackingStore(JSCell*, CopyVisitor&, CopyToken);
-
-    uint32_t cachedPropertyNameCount() const
-    {
-        // Note that this depends on m_endGenericPropertyIndex being the number of entries in m_propertyNames.
-        return m_endGenericPropertyIndex;
-    }
-
-    size_t propertyNameCacheSize() const
-    {
-        return WTF::roundUpToMultipleOf<8>(cachedPropertyNameCount() * sizeof(WriteBarrier<JSString>));
-    }
 
 private:
     JSPropertyNameEnumerator(VM&, StructureID, uint32_t);
     void finishCreation(VM&, uint32_t, uint32_t, PassRefPtr<PropertyNameArrayData>);
 
-    CopyBarrier<WriteBarrier<JSString>> m_propertyNames;
-    WriteBarrier<StructureChain> m_prototypeChain;
+    Vector<WriteBarrier<JSString>> m_propertyNames;
     StructureID m_cachedStructureID;
+    WriteBarrier<StructureChain> m_prototypeChain;
     uint32_t m_indexedLength;
     uint32_t m_endStructurePropertyIndex;
     uint32_t m_endGenericPropertyIndex;