Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (95502 => 95503)
--- trunk/Source/_javascript_Core/runtime/JSObject.cpp 2011-09-20 01:20:12 UTC (rev 95502)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp 2011-09-20 01:21:51 UTC (rev 95503)
@@ -136,7 +136,7 @@
unsigned attributes;
JSCell* specificValue;
- if ((m_structure->get(globalData, propertyName, attributes, specificValue) != WTF::notFound) && attributes & ReadOnly) {
+ if ((structure()->get(globalData, propertyName, attributes, specificValue) != WTF::notFound) && attributes & ReadOnly) {
if (slot.isStrictMode())
throwError(exec, createTypeError(exec, StrictModeReadonlyPropertyWriteError));
return;
@@ -233,7 +233,7 @@
{
unsigned attributes;
JSCell* specificValue;
- if (m_structure->get(exec->globalData(), propertyName, attributes, specificValue) != WTF::notFound) {
+ if (structure()->get(exec->globalData(), propertyName, attributes, specificValue) != WTF::notFound) {
if ((attributes & DontDelete))
return false;
removeDirect(exec->globalData(), propertyName);
@@ -334,7 +334,7 @@
JSValue object = getDirect(exec->globalData(), propertyName);
if (object && object.isGetterSetter()) {
- ASSERT(m_structure->hasGetterSetterProperties());
+ ASSERT(structure()->hasGetterSetterProperties());
asGetterSetter(object)->setGetter(exec->globalData(), getterFunction);
return;
}
@@ -348,11 +348,11 @@
// getters and setters, though, we also need to change our Structure
// if we override an existing non-getter or non-setter.
if (slot.type() != PutPropertySlot::NewProperty) {
- if (!m_structure->isDictionary())
- setStructure(exec->globalData(), Structure::getterSetterTransition(globalData, m_structure.get()));
+ if (!structure()->isDictionary())
+ setStructure(exec->globalData(), Structure::getterSetterTransition(globalData, structure()));
}
- m_structure->setHasGetterSetterProperties(true);
+ structure()->setHasGetterSetterProperties(true);
getterSetter->setGetter(globalData, getterFunction);
}
@@ -365,7 +365,7 @@
JSValue object = getDirect(exec->globalData(), propertyName);
if (object && object.isGetterSetter()) {
- ASSERT(m_structure->hasGetterSetterProperties());
+ ASSERT(structure()->hasGetterSetterProperties());
asGetterSetter(object)->setSetter(exec->globalData(), setterFunction);
return;
}
@@ -378,11 +378,11 @@
// getters and setters, though, we also need to change our Structure
// if we override an existing non-getter or non-setter.
if (slot.type() != PutPropertySlot::NewProperty) {
- if (!m_structure->isDictionary())
- setStructure(exec->globalData(), Structure::getterSetterTransition(exec->globalData(), m_structure.get()));
+ if (!structure()->isDictionary())
+ setStructure(exec->globalData(), Structure::getterSetterTransition(exec->globalData(), structure()));
}
- m_structure->setHasGetterSetterProperties(true);
+ structure()->setHasGetterSetterProperties(true);
getterSetter->setSetter(exec->globalData(), setterFunction);
}
@@ -453,7 +453,7 @@
bool JSObject::getPropertySpecificValue(ExecState* exec, const Identifier& propertyName, JSCell*& specificValue) const
{
unsigned attributes;
- if (m_structure->get(exec->globalData(), propertyName, attributes, specificValue) != WTF::notFound)
+ if (structure()->get(exec->globalData(), propertyName, attributes, specificValue) != WTF::notFound)
return true;
// This could be a function within the static table? - should probably
@@ -486,7 +486,7 @@
void JSObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
- m_structure->getPropertyNames(exec->globalData(), propertyNames, mode);
+ structure()->getPropertyNames(exec->globalData(), propertyNames, mode);
getClassPropertyNames(exec, classInfo(), propertyNames, mode);
}
@@ -536,7 +536,7 @@
if (isSealed(globalData))
return;
preventExtensions(globalData);
- setStructure(globalData, Structure::sealTransition(globalData, m_structure.get()));
+ setStructure(globalData, Structure::sealTransition(globalData, structure()));
}
void JSObject::freeze(JSGlobalData& globalData)
@@ -544,29 +544,29 @@
if (isFrozen(globalData))
return;
preventExtensions(globalData);
- setStructure(globalData, Structure::freezeTransition(globalData, m_structure.get()));
+ setStructure(globalData, Structure::freezeTransition(globalData, structure()));
}
void JSObject::preventExtensions(JSGlobalData& globalData)
{
if (isExtensible())
- setStructure(globalData, Structure::preventExtensionsTransition(globalData, m_structure.get()));
+ setStructure(globalData, Structure::preventExtensionsTransition(globalData, structure()));
}
void JSObject::removeDirect(JSGlobalData& globalData, const Identifier& propertyName)
{
- if (m_structure->get(globalData, propertyName) == WTF::notFound)
+ if (structure()->get(globalData, propertyName) == WTF::notFound)
return;
size_t offset;
- if (m_structure->isUncacheableDictionary()) {
- offset = m_structure->removePropertyWithoutTransition(globalData, propertyName);
+ if (structure()->isUncacheableDictionary()) {
+ offset = structure()->removePropertyWithoutTransition(globalData, propertyName);
if (offset != WTF::notFound)
putUndefinedAtDirectOffset(offset);
return;
}
- setStructure(globalData, Structure::removePropertyTransition(globalData, m_structure.get(), propertyName, offset));
+ setStructure(globalData, Structure::removePropertyTransition(globalData, structure(), propertyName, offset));
if (offset != WTF::notFound)
putUndefinedAtDirectOffset(offset);
}
@@ -584,7 +584,7 @@
Structure* JSObject::createInheritorID(JSGlobalData& globalData)
{
- m_inheritorID.set(globalData, this, createEmptyObjectStructure(globalData, m_structure->globalObject(), this));
+ m_inheritorID.set(globalData, this, createEmptyObjectStructure(globalData, structure()->globalObject(), this));
ASSERT(m_inheritorID->isEmpty());
return m_inheritorID.get();
}
@@ -593,7 +593,7 @@
{
ASSERT(newSize > oldSize);
- // It's important that this function not rely on m_structure, since
+ // It's important that this function not rely on structure(), since
// we might be in the middle of a transition.
PropertyStorage newPropertyStorage = 0;
newPropertyStorage = new WriteBarrierBase<Unknown>[newSize];
@@ -614,7 +614,7 @@
{
unsigned attributes = 0;
JSCell* cell = 0;
- size_t offset = m_structure->get(exec->globalData(), propertyName, attributes, cell);
+ size_t offset = structure()->get(exec->globalData(), propertyName, attributes, cell);
if (offset == WTF::notFound)
return false;
descriptor.setDescriptor(getDirectOffset(offset), attributes);
Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (95502 => 95503)
--- trunk/Source/_javascript_Core/runtime/JSObject.h 2011-09-20 01:20:12 UTC (rev 95502)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h 2011-09-20 01:21:51 UTC (rev 95503)
@@ -90,7 +90,6 @@
void setPrototype(JSGlobalData&, JSValue prototype);
bool setPrototypeWithCycleCheck(JSGlobalData&, JSValue prototype);
- void setStructure(JSGlobalData&, Structure*);
Structure* inheritorID(JSGlobalData&);
virtual UString className() const;
@@ -148,20 +147,20 @@
// This get function only looks at the property map.
JSValue getDirect(JSGlobalData& globalData, const Identifier& propertyName) const
{
- size_t offset = m_structure->get(globalData, propertyName);
+ size_t offset = structure()->get(globalData, propertyName);
return offset != WTF::notFound ? getDirectOffset(offset) : JSValue();
}
WriteBarrierBase<Unknown>* getDirectLocation(JSGlobalData& globalData, const Identifier& propertyName)
{
- size_t offset = m_structure->get(globalData, propertyName);
+ size_t offset = structure()->get(globalData, propertyName);
return offset != WTF::notFound ? locationForOffset(offset) : 0;
}
WriteBarrierBase<Unknown>* getDirectLocation(JSGlobalData& globalData, const Identifier& propertyName, unsigned& attributes)
{
JSCell* specificFunction;
- size_t offset = m_structure->get(globalData, propertyName, attributes, specificFunction);
+ size_t offset = structure()->get(globalData, propertyName, attributes, specificFunction);
return offset != WTF::notFound ? locationForOffset(offset) : 0;
}
@@ -173,8 +172,8 @@
void transitionTo(JSGlobalData&, Structure*);
void removeDirect(JSGlobalData&, const Identifier& propertyName);
- bool hasCustomProperties() { return m_structure->didTransition(); }
- bool hasGetterSetterProperties() { return m_structure->hasGetterSetterProperties(); }
+ bool hasCustomProperties() { return structure()->didTransition(); }
+ bool hasGetterSetterProperties() { return structure()->hasGetterSetterProperties(); }
bool putDirect(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr, bool checkReadOnly, PutPropertySlot&);
void putDirect(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr = 0);
@@ -203,9 +202,9 @@
void seal(JSGlobalData&);
void freeze(JSGlobalData&);
void preventExtensions(JSGlobalData&);
- bool isSealed(JSGlobalData& globalData) { return m_structure->isSealed(globalData); }
- bool isFrozen(JSGlobalData& globalData) { return m_structure->isFrozen(globalData); }
- bool isExtensible() { return m_structure->isExtensible(); }
+ bool isSealed(JSGlobalData& globalData) { return structure()->isSealed(globalData); }
+ bool isFrozen(JSGlobalData& globalData) { return structure()->isFrozen(globalData); }
+ bool isExtensible() { return structure()->isExtensible(); }
void allocatePropertyStorage(JSGlobalData&, size_t oldSize, size_t newSize);
bool isUsingInlineStorage() const { return static_cast<const void*>(m_propertyStorage.get()) == static_cast<const void*>(this + 1); }
@@ -219,7 +218,7 @@
void flattenDictionaryObject(JSGlobalData& globalData)
{
- m_structure->flattenDictionaryStructure(globalData, this);
+ structure()->flattenDictionaryStructure(globalData, this);
}
JSGlobalObject* globalObject() const
@@ -240,11 +239,11 @@
{
Base::finishCreation(globalData);
ASSERT(inherits(&s_info));
- ASSERT(m_structure->propertyStorageCapacity() < baseExternalStorageCapacity);
- ASSERT(m_structure->isEmpty());
+ ASSERT(structure()->propertyStorageCapacity() < baseExternalStorageCapacity);
+ ASSERT(structure()->isEmpty());
ASSERT(prototype().isNull() || Heap::heap(this) == Heap::heap(prototype()));
ASSERT_UNUSED(inlineStorage, static_cast<void*>(inlineStorage) == static_cast<void*>(this + 1));
- ASSERT(m_structure->isObject());
+ ASSERT(structure()->isObject());
}
static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
@@ -444,7 +443,7 @@
inline JSValue JSObject::prototype() const
{
- return m_structure->storedPrototype();
+ return structure()->storedPrototype();
}
inline bool JSObject::setPrototypeWithCycleCheck(JSGlobalData& globalData, JSValue prototype)
@@ -463,15 +462,9 @@
inline void JSObject::setPrototype(JSGlobalData& globalData, JSValue prototype)
{
ASSERT(prototype);
- setStructure(globalData, Structure::changePrototypeTransition(globalData, m_structure.get(), prototype));
+ setStructure(globalData, Structure::changePrototypeTransition(globalData, structure(), prototype));
}
-inline void JSObject::setStructure(JSGlobalData& globalData, Structure* structure)
-{
- ASSERT(structure->typeInfo().overridesVisitChildren() == m_structure->typeInfo().overridesVisitChildren());
- m_structure.set(globalData, this, structure);
-}
-
inline Structure* JSObject::inheritorID(JSGlobalData& globalData)
{
if (m_inheritorID) {
@@ -500,7 +493,7 @@
ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
if (WriteBarrierBase<Unknown>* location = getDirectLocation(exec->globalData(), propertyName)) {
- if (m_structure->hasGetterSetterProperties() && location->isGetterSetter())
+ if (structure()->hasGetterSetterProperties() && location->isGetterSetter())
fillGetterPropertySlot(slot, location);
else
slot.setValue(this, location->get(), offsetForLocation(location));
@@ -537,10 +530,10 @@
// case by checking whether the hash has yet been set for this string.
ALWAYS_INLINE JSValue JSCell::fastGetOwnProperty(ExecState* exec, const UString& name)
{
- if (!m_structure->typeInfo().overridesGetOwnPropertySlot() && !m_structure->hasGetterSetterProperties()) {
+ if (!structure()->typeInfo().overridesGetOwnPropertySlot() && !structure()->hasGetterSetterProperties()) {
size_t offset = name.impl()->hasHash()
- ? m_structure->get(exec->globalData(), Identifier(exec, name))
- : m_structure->get(exec->globalData(), name);
+ ? structure()->get(exec->globalData(), Identifier(exec, name))
+ : structure()->get(exec->globalData(), name);
if (offset != WTF::notFound)
return asObject(this)->locationForOffset(offset)->get();
}
@@ -598,15 +591,15 @@
ASSERT(value);
ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
- if (m_structure->isDictionary()) {
+ if (structure()->isDictionary()) {
unsigned currentAttributes;
JSCell* currentSpecificFunction;
- size_t offset = m_structure->get(globalData, propertyName, currentAttributes, currentSpecificFunction);
+ size_t offset = structure()->get(globalData, propertyName, currentAttributes, currentSpecificFunction);
if (offset != WTF::notFound) {
// If there is currently a specific function, and there now either isn't,
// or the new value is different, then despecify.
if (currentSpecificFunction && (specificFunction != currentSpecificFunction))
- m_structure->despecifyDictionaryFunction(globalData, propertyName);
+ structure()->despecifyDictionaryFunction(globalData, propertyName);
if (checkReadOnly && currentAttributes & ReadOnly)
return false;
@@ -625,12 +618,12 @@
if (checkReadOnly && !isExtensible())
return false;
- size_t currentCapacity = m_structure->propertyStorageCapacity();
- offset = m_structure->addPropertyWithoutTransition(globalData, propertyName, attributes, specificFunction);
- if (currentCapacity != m_structure->propertyStorageCapacity())
- allocatePropertyStorage(globalData, currentCapacity, m_structure->propertyStorageCapacity());
+ size_t currentCapacity = structure()->propertyStorageCapacity();
+ offset = structure()->addPropertyWithoutTransition(globalData, propertyName, attributes, specificFunction);
+ if (currentCapacity != structure()->propertyStorageCapacity())
+ allocatePropertyStorage(globalData, currentCapacity, structure()->propertyStorageCapacity());
- ASSERT(offset < m_structure->propertyStorageCapacity());
+ ASSERT(offset < structure()->propertyStorageCapacity());
putDirectOffset(globalData, offset, value);
// See comment on setNewProperty call below.
if (!specificFunction)
@@ -639,8 +632,8 @@
}
size_t offset;
- size_t currentCapacity = m_structure->propertyStorageCapacity();
- if (Structure* structure = Structure::addPropertyTransitionToExistingStructure(m_structure.get(), propertyName, attributes, specificFunction, offset)) {
+ size_t currentCapacity = structure()->propertyStorageCapacity();
+ if (Structure* structure = Structure::addPropertyTransitionToExistingStructure(this->structure(), propertyName, attributes, specificFunction, offset)) {
if (currentCapacity != structure->propertyStorageCapacity())
allocatePropertyStorage(globalData, currentCapacity, structure->propertyStorageCapacity());
@@ -656,7 +649,7 @@
unsigned currentAttributes;
JSCell* currentSpecificFunction;
- offset = m_structure->get(globalData, propertyName, currentAttributes, currentSpecificFunction);
+ offset = structure()->get(globalData, propertyName, currentAttributes, currentSpecificFunction);
if (offset != WTF::notFound) {
if (checkReadOnly && currentAttributes & ReadOnly)
return false;
@@ -677,7 +670,7 @@
return true;
}
// case (2) Despecify, fall through to (3).
- setStructure(globalData, Structure::despecifyFunctionTransition(globalData, m_structure.get(), propertyName));
+ setStructure(globalData, Structure::despecifyFunctionTransition(globalData, structure(), propertyName));
}
// case (3) set the slot, do the put, return.
@@ -689,7 +682,7 @@
if (checkReadOnly && !isExtensible())
return false;
- Structure* structure = Structure::addPropertyTransition(globalData, m_structure.get(), propertyName, attributes, specificFunction, offset);
+ Structure* structure = Structure::addPropertyTransition(globalData, this->structure(), propertyName, attributes, specificFunction, offset);
if (currentCapacity != structure->propertyStorageCapacity())
allocatePropertyStorage(globalData, currentCapacity, structure->propertyStorageCapacity());
@@ -725,17 +718,17 @@
inline void JSObject::putDirectWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes)
{
- size_t currentCapacity = m_structure->propertyStorageCapacity();
- size_t offset = m_structure->addPropertyWithoutTransition(globalData, propertyName, attributes, getJSFunction(globalData, value));
- if (currentCapacity != m_structure->propertyStorageCapacity())
- allocatePropertyStorage(globalData, currentCapacity, m_structure->propertyStorageCapacity());
+ size_t currentCapacity = structure()->propertyStorageCapacity();
+ size_t offset = structure()->addPropertyWithoutTransition(globalData, propertyName, attributes, getJSFunction(globalData, value));
+ if (currentCapacity != structure()->propertyStorageCapacity())
+ allocatePropertyStorage(globalData, currentCapacity, structure()->propertyStorageCapacity());
putDirectOffset(globalData, offset, value);
}
inline void JSObject::transitionTo(JSGlobalData& globalData, Structure* newStructure)
{
- if (m_structure->propertyStorageCapacity() != newStructure->propertyStorageCapacity())
- allocatePropertyStorage(globalData, m_structure->propertyStorageCapacity(), newStructure->propertyStorageCapacity());
+ if (structure()->propertyStorageCapacity() != newStructure->propertyStorageCapacity())
+ allocatePropertyStorage(globalData, structure()->propertyStorageCapacity(), newStructure->propertyStorageCapacity());
setStructure(globalData, newStructure);
}
@@ -826,7 +819,7 @@
JSCell::visitChildren(visitor);
PropertyStorage storage = propertyStorage();
- size_t storageSize = m_structure->propertyStorageSize();
+ size_t storageSize = structure()->propertyStorageSize();
visitor.appendValues(storage, storageSize);
if (m_inheritorID)
visitor.append(&m_inheritorID);