void Structure::materializePropertyMap(JSGlobalData& globalData) { ASSERT(structure()->classInfo() == &s_info); ASSERT(!m_propertyTable); Vector<Structure*, 8> structures; structures.append(this); Structure* structure = this; // Search for the last Structure with a property table. while ((structure = structure->previousID())) { if (structure->m_isPinnedPropertyTable) { ASSERT(structure->m_propertyTable); ASSERT(!structure->m_previous); m_propertyTable = structure->m_propertyTable->copy(globalData, 0, numberOfSlotsForLastOffset(m_offset, m_typeInfo.type())); break; } structures.append(structure); } if (!m_propertyTable) createPropertyMap(numberOfSlotsForLastOffset(m_offset, m_typeInfo.type())); for (ptrdiff_t i = structures.size() - 2; i >= 0; --i) { structure = structures[i]; if (!structure->m_nameInPrevious) continue; PropertyMapEntry entry(globalData, this, structure->m_nameInPrevious.get(), structure->m_offset, structure->m_attributesInPrevious, structure->m_specificValueInPrevious.get()); m_propertyTable->add(entry); } }
void Structure::materializePropertyMap(JSGlobalData& globalData) { ASSERT(structure()->classInfo() == &s_info); ASSERT(!propertyTable()); Vector<Structure*, 8> structures; structures.append(this); Structure* structure = this; // Search for the last Structure with a property table. while ((structure = structure->previousID())) { if (structure->m_isPinnedPropertyTable) { ASSERT(structure->propertyTable()); ASSERT(!structure->previousID()); propertyTable().set(globalData, this, structure->propertyTable()->copy(globalData, 0, numberOfSlotsForLastOffset(m_offset, m_inlineCapacity))); break; } structures.append(structure); } if (!propertyTable()) createPropertyMap(globalData, numberOfSlotsForLastOffset(m_offset, m_inlineCapacity)); for (ptrdiff_t i = structures.size() - 1; i >= 0; --i) { structure = structures[i]; if (!structure->m_nameInPrevious) continue; PropertyMapEntry entry(globalData, this, structure->m_nameInPrevious.get(), structure->m_offset, structure->m_attributesInPrevious, structure->m_specificValueInPrevious.get()); propertyTable()->add(entry, m_offset, PropertyTable::PropertyOffsetMustNotChange); } checkOffsetConsistency(); }
PassOwnPtr<PropertyTable> Structure::copyPropertyTableForPinning(JSGlobalData& globalData, Structure* owner) { return adoptPtr(m_propertyTable ? new PropertyTable(globalData, owner, *m_propertyTable) : new PropertyTable(numberOfSlotsForLastOffset(m_offset, m_typeInfo.type()))); }
PropertyTable* Structure::copyPropertyTableForPinning(JSGlobalData& globalData, Structure* owner) { if (propertyTable()) return PropertyTable::clone(globalData, owner, *propertyTable().get()); return PropertyTable::create(globalData, numberOfSlotsForLastOffset(m_offset, m_inlineCapacity)); }