From 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Thu, 2 Jun 2011 12:07:03 +0100 Subject: Merge WebKit at r84325: Initial merge by git. Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b --- .../JavaScriptCore/runtime/PropertyMapHashTable.h | 31 +++++++++++++--------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'Source/JavaScriptCore/runtime/PropertyMapHashTable.h') diff --git a/Source/JavaScriptCore/runtime/PropertyMapHashTable.h b/Source/JavaScriptCore/runtime/PropertyMapHashTable.h index c000dc8..fc195cd 100644 --- a/Source/JavaScriptCore/runtime/PropertyMapHashTable.h +++ b/Source/JavaScriptCore/runtime/PropertyMapHashTable.h @@ -22,6 +22,7 @@ #define PropertyMapHashTable_h #include "UString.h" +#include "WriteBarrier.h" #include #include #include @@ -73,13 +74,13 @@ struct PropertyMapEntry { StringImpl* key; unsigned offset; unsigned attributes; - JSCell* specificValue; + WriteBarrier specificValue; - PropertyMapEntry(StringImpl* key, unsigned offset, unsigned attributes, JSCell* specificValue) + PropertyMapEntry(JSGlobalData& globalData, JSCell* owner, StringImpl* key, unsigned offset, unsigned attributes, JSCell* specificValue) : key(key) , offset(offset) , attributes(attributes) - , specificValue(specificValue) + , specificValue(globalData, owner, specificValue) { } }; @@ -141,9 +142,9 @@ public: typedef std::pair find_iterator; // Constructor is passed an initial capacity, a PropertyTable to copy, or both. - PropertyTable(unsigned initialCapacity); - PropertyTable(const PropertyTable&); - PropertyTable(unsigned initialCapacity, const PropertyTable&); + explicit PropertyTable(unsigned initialCapacity); + PropertyTable(JSGlobalData&, JSCell*, const PropertyTable&); + PropertyTable(JSGlobalData&, JSCell*, unsigned initialCapacity, const PropertyTable&); ~PropertyTable(); // Ordered iteration methods. @@ -176,7 +177,7 @@ public: void addDeletedOffset(unsigned offset); // Copy this PropertyTable, ensuring the copy has at least the capacity provided. - PassOwnPtr copy(unsigned newCapacity); + PassOwnPtr copy(JSGlobalData&, JSCell* owner, unsigned newCapacity); #ifndef NDEBUG size_t sizeInMemory(); @@ -184,6 +185,7 @@ public: #endif private: + PropertyTable(const PropertyTable&); // Used to insert a value known not to be in the table, and where we know capacity to be available. void reinsert(const ValueType& entry); @@ -243,7 +245,7 @@ inline PropertyTable::PropertyTable(unsigned initialCapacity) ASSERT(isPowerOf2(m_indexSize)); } -inline PropertyTable::PropertyTable(const PropertyTable& other) +inline PropertyTable::PropertyTable(JSGlobalData& globalData, JSCell* owner, const PropertyTable& other) : m_indexSize(other.m_indexSize) , m_indexMask(other.m_indexMask) , m_index(static_cast(fastMalloc(dataSize()))) @@ -255,8 +257,10 @@ inline PropertyTable::PropertyTable(const PropertyTable& other) memcpy(m_index, other.m_index, dataSize()); iterator end = this->end(); - for (iterator iter = begin(); iter != end; ++iter) + for (iterator iter = begin(); iter != end; ++iter) { iter->key->ref(); + writeBarrier(globalData, owner, iter->specificValue.get()); + } // Copy the m_deletedOffsets vector. Vector* otherDeletedOffsets = other.m_deletedOffsets.get(); @@ -264,7 +268,7 @@ inline PropertyTable::PropertyTable(const PropertyTable& other) m_deletedOffsets.set(new Vector(*otherDeletedOffsets)); } -inline PropertyTable::PropertyTable(unsigned initialCapacity, const PropertyTable& other) +inline PropertyTable::PropertyTable(JSGlobalData& globalData, JSCell* owner, unsigned initialCapacity, const PropertyTable& other) : m_indexSize(sizeForCapacity(initialCapacity)) , m_indexMask(m_indexSize - 1) , m_index(static_cast(fastZeroedMalloc(dataSize()))) @@ -279,6 +283,7 @@ inline PropertyTable::PropertyTable(unsigned initialCapacity, const PropertyTabl ASSERT(canInsert()); reinsert(*iter); iter->key->ref(); + writeBarrier(globalData, owner, iter->specificValue.get()); } // Copy the m_deletedOffsets vector. @@ -443,15 +448,15 @@ inline void PropertyTable::addDeletedOffset(unsigned offset) m_deletedOffsets->append(offset); } -inline PassOwnPtr PropertyTable::copy(unsigned newCapacity) +inline PassOwnPtr PropertyTable::copy(JSGlobalData& globalData, JSCell* owner, unsigned newCapacity) { ASSERT(newCapacity >= m_keyCount); // Fast case; if the new table will be the same m_indexSize as this one, we can memcpy it, // save rehashing all keys. if (sizeForCapacity(newCapacity) == m_indexSize) - return new PropertyTable(*this); - return new PropertyTable(newCapacity, *this); + return new PropertyTable(globalData, owner, *this); + return new PropertyTable(globalData, owner, newCapacity, *this); } #ifndef NDEBUG -- cgit v1.1