-inline PropertyTable::PropertyTable(unsigned initialCapacity)
- : m_indexSize(sizeForCapacity(initialCapacity))
- , m_indexMask(m_indexSize - 1)
- , m_index(static_cast<unsigned*>(fastZeroedMalloc(dataSize())))
- , m_keyCount(0)
- , m_deletedCount(0)
-{
- ASSERT(isPowerOf2(m_indexSize));
-}
-
-inline PropertyTable::PropertyTable(JSGlobalData&, JSCell* owner, const PropertyTable& other)
- : m_indexSize(other.m_indexSize)
- , m_indexMask(other.m_indexMask)
- , m_index(static_cast<unsigned*>(fastMalloc(dataSize())))
- , m_keyCount(other.m_keyCount)
- , m_deletedCount(other.m_deletedCount)
-{
- ASSERT(isPowerOf2(m_indexSize));
-
- memcpy(m_index, other.m_index, dataSize());
-
- iterator end = this->end();
- for (iterator iter = begin(); iter != end; ++iter) {
- iter->key->ref();
- Heap::writeBarrier(owner, iter->specificValue.get());
- }
-
- // Copy the m_deletedOffsets vector.
- Vector<unsigned>* otherDeletedOffsets = other.m_deletedOffsets.get();
- if (otherDeletedOffsets)
- m_deletedOffsets = adoptPtr(new Vector<unsigned>(*otherDeletedOffsets));
-}
-
-inline PropertyTable::PropertyTable(JSGlobalData&, JSCell* owner, unsigned initialCapacity, const PropertyTable& other)
- : m_indexSize(sizeForCapacity(initialCapacity))
- , m_indexMask(m_indexSize - 1)
- , m_index(static_cast<unsigned*>(fastZeroedMalloc(dataSize())))
- , m_keyCount(0)
- , m_deletedCount(0)
-{
- ASSERT(isPowerOf2(m_indexSize));
- ASSERT(initialCapacity >= other.m_keyCount);
-
- const_iterator end = other.end();
- for (const_iterator iter = other.begin(); iter != end; ++iter) {
- ASSERT(canInsert());
- reinsert(*iter);
- iter->key->ref();
- Heap::writeBarrier(owner, iter->specificValue.get());
- }
-
- // Copy the m_deletedOffsets vector.
- Vector<unsigned>* otherDeletedOffsets = other.m_deletedOffsets.get();
- if (otherDeletedOffsets)
- m_deletedOffsets = adoptPtr(new Vector<unsigned>(*otherDeletedOffsets));
-}
-
-inline PropertyTable::~PropertyTable()
-{
- iterator end = this->end();
- for (iterator iter = begin(); iter != end; ++iter)
- iter->key->deref();
-
- fastFree(m_index);
-}
-