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
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
ButterflyCopyToken,
TypedArrayVectorCopyToken,
MapBackingStoreCopyToken,
- DirectArgumentsOverridesCopyToken,
- JSPropertyNameEnumeratorCopyToken,
+ DirectArgumentsOverridesCopyToken
};
} // namespace JSC
#include "config.h"
#include "JSPropertyNameEnumerator.h"
-#include "CopiedBlockInlines.h"
-#include "CopyVisitorInlines.h"
#include "JSCInlines.h"
#include "StrongInlines.h"
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
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());
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(); }
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;