-void Structure::visitChildren(SlotVisitor& visitor)
-{
- ASSERT_GC_OBJECT_INHERITS(this, &s_info);
- ASSERT(structure()->typeInfo().overridesVisitChildren());
- JSCell::visitChildren(visitor);
- if (m_prototype)
- visitor.append(&m_prototype);
- if (m_cachedPrototypeChain)
- visitor.append(&m_cachedPrototypeChain);
- if (m_previous)
- visitor.append(&m_previous);
- if (m_specificValueInPrevious)
- visitor.append(&m_specificValueInPrevious);
- if (m_enumerationCache)
- visitor.append(&m_enumerationCache);
- if (m_propertyTable) {
- PropertyTable::iterator end = m_propertyTable->end();
- for (PropertyTable::iterator ptr = m_propertyTable->begin(); ptr != end; ++ptr) {
- if (ptr->specificValue)
- visitor.append(&ptr->specificValue);
+JSValue Structure::prototypeForLookup(CodeBlock* codeBlock) const
+{
+ return prototypeForLookup(codeBlock->globalObject());
+}
+
+void Structure::visitChildren(JSCell* cell, SlotVisitor& visitor)
+{
+ Structure* thisObject = jsCast<Structure*>(cell);
+ ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+ ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
+
+ JSCell::visitChildren(thisObject, visitor);
+ visitor.append(&thisObject->m_globalObject);
+ if (!thisObject->isObject())
+ thisObject->m_cachedPrototypeChain.clear();
+ else {
+ visitor.append(&thisObject->m_prototype);
+ visitor.append(&thisObject->m_cachedPrototypeChain);
+ }
+ visitor.append(&thisObject->m_previousOrRareData);
+ visitor.append(&thisObject->m_specificValueInPrevious);
+
+ if (thisObject->m_isPinnedPropertyTable) {
+ ASSERT(thisObject->m_propertyTableUnsafe);
+ visitor.append(&thisObject->m_propertyTableUnsafe);
+ } else if (thisObject->m_propertyTableUnsafe)
+ thisObject->m_propertyTableUnsafe.clear();
+}
+
+bool Structure::prototypeChainMayInterceptStoreTo(VM& vm, PropertyName propertyName)
+{
+ unsigned i = propertyName.asIndex();
+ if (i != PropertyName::NotAnIndex)
+ return anyObjectInChainMayInterceptIndexedAccesses();
+
+ for (Structure* current = this; ;) {
+ JSValue prototype = current->storedPrototype();
+ if (prototype.isNull())
+ return false;
+
+ current = prototype.asCell()->structure(vm);
+
+ unsigned attributes;
+ JSCell* specificValue;
+ PropertyOffset offset = current->get(vm, propertyName, attributes, specificValue);
+ if (!JSC::isValidOffset(offset))
+ continue;
+
+ if (attributes & (ReadOnly | Accessor))
+ return true;
+
+ return false;
+ }
+}
+
+void Structure::dump(PrintStream& out) const
+{
+ out.print(RawPointer(this), ":[", classInfo()->className, ", {");
+
+ Vector<Structure*, 8> structures;
+ Structure* structure;
+ PropertyTable* table;
+
+ const_cast<Structure*>(this)->findStructuresAndMapForMaterialization(
+ structures, structure, table);
+
+ CommaPrinter comma;
+
+ if (table) {
+ PropertyTable::iterator iter = table->begin();
+ PropertyTable::iterator end = table->end();
+ for (; iter != end; ++iter) {
+ out.print(comma, iter->key, ":", static_cast<int>(iter->offset));
+ if (iter->specificValue) {
+ DumpContext dummyContext;
+ out.print("=>", RawPointer(iter->specificValue.get()));
+ }
+ }
+
+ structure->m_lock.unlock();
+ }
+
+ for (unsigned i = structures.size(); i--;) {
+ Structure* structure = structures[i];
+ if (!structure->m_nameInPrevious)
+ continue;
+ out.print(comma, structure->m_nameInPrevious.get(), ":", static_cast<int>(structure->m_offset));
+ if (structure->m_specificValueInPrevious) {
+ DumpContext dummyContext;
+ out.print("=>", RawPointer(structure->m_specificValueInPrevious.get()));