Commit 1986964e authored by mhahnenberg@apple.com's avatar mhahnenberg@apple.com

Add static version of JSCell::getOwnPropertySlot

https://bugs.webkit.org/show_bug.cgi?id=69593

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Added static version of getOwnPropertySlot to every class that overrides
JSCell::getOwnPropertySlot.  The virtual versions now call the static versions.
This is the first step in de-virtualizing JSCell::getOwnPropertySlot.

* JavaScriptCore.exp:
* debugger/DebuggerActivation.cpp:
(JSC::DebuggerActivation::getOwnPropertySlot):
* debugger/DebuggerActivation.h:
* runtime/Arguments.cpp:
(JSC::Arguments::getOwnPropertySlot):
* runtime/Arguments.h:
* runtime/ArrayConstructor.h:
* runtime/ArrayPrototype.cpp:
(JSC::ArrayPrototype::getOwnPropertySlot):
* runtime/ArrayPrototype.h:
* runtime/BooleanPrototype.cpp:
(JSC::BooleanPrototype::getOwnPropertySlot):
* runtime/BooleanPrototype.h:
* runtime/DateConstructor.cpp:
(JSC::DateConstructor::getOwnPropertySlot):
* runtime/DateConstructor.h:
* runtime/DatePrototype.cpp:
(JSC::DatePrototype::getOwnPropertySlot):
* runtime/DatePrototype.h:
* runtime/ErrorPrototype.cpp:
(JSC::ErrorPrototype::getOwnPropertySlot):
* runtime/ErrorPrototype.h:
* runtime/JSActivation.cpp:
(JSC::JSActivation::getOwnPropertySlot):
* runtime/JSActivation.h:
* runtime/JSArray.cpp:
(JSC::JSArray::getOwnPropertySlot):
* runtime/JSArray.h:
* runtime/JSBoundFunction.cpp:
(JSC::JSBoundFunction::getOwnPropertySlot):
* runtime/JSBoundFunction.h:
* runtime/JSByteArray.cpp:
(JSC::JSByteArray::getOwnPropertySlot):
* runtime/JSByteArray.h:
* runtime/JSCell.cpp:
(JSC::JSCell::getOwnPropertySlot):
* runtime/JSCell.h:
* runtime/JSFunction.cpp:
(JSC::JSFunction::getOwnPropertySlot):
* runtime/JSFunction.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::getOwnPropertySlot):
* runtime/JSGlobalObject.h:
* runtime/JSNotAnObject.cpp:
(JSC::JSNotAnObject::getOwnPropertySlot):
* runtime/JSNotAnObject.h:
* runtime/JSONObject.cpp:
(JSC::JSONObject::getOwnPropertySlot):
* runtime/JSONObject.h:
* runtime/JSObject.cpp:
(JSC::JSObject::getOwnPropertySlot):
* runtime/JSObject.h:
(JSC::JSObject::getOwnPropertySlot):
* runtime/JSStaticScopeObject.cpp:
(JSC::JSStaticScopeObject::getOwnPropertySlot):
* runtime/JSStaticScopeObject.h:
* runtime/JSString.cpp:
(JSC::JSString::getOwnPropertySlot):
* runtime/JSString.h:
* runtime/MathObject.cpp:
(JSC::MathObject::getOwnPropertySlot):
* runtime/MathObject.h:
* runtime/NumberConstructor.cpp:
(JSC::NumberConstructor::getOwnPropertySlot):
* runtime/NumberConstructor.h:
* runtime/NumberPrototype.cpp:
(JSC::NumberPrototype::getOwnPropertySlot):
* runtime/NumberPrototype.h:
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructor::getOwnPropertySlot):
* runtime/ObjectConstructor.h:
* runtime/ObjectPrototype.cpp:
(JSC::ObjectPrototype::getOwnPropertySlot):
* runtime/ObjectPrototype.h:
* runtime/RegExpConstructor.cpp:
(JSC::RegExpConstructor::getOwnPropertySlot):
* runtime/RegExpConstructor.h:
* runtime/RegExpMatchesArray.h:
(JSC::RegExpMatchesArray::getOwnPropertySlot):
* runtime/RegExpObject.cpp:
(JSC::RegExpObject::getOwnPropertySlot):
* runtime/RegExpObject.h:
* runtime/RegExpPrototype.cpp:
(JSC::RegExpPrototype::getOwnPropertySlot):
* runtime/RegExpPrototype.h:
* runtime/StringConstructor.cpp:
(JSC::StringConstructor::getOwnPropertySlot):
* runtime/StringConstructor.h:
* runtime/StringObject.cpp:
(JSC::StringObject::getOwnPropertySlot):
* runtime/StringObject.h:
* runtime/StringPrototype.cpp:
(JSC::StringPrototype::getOwnPropertySlot):
* runtime/StringPrototype.h:

Source/JavaScriptGlue:

Added static version of getOwnPropertySlot to every class that overrides
JSCell::getOwnPropertySlot.  The virtual versions now call the static versions.
This is the first step in de-virtualizing JSCell::getOwnPropertySlot.

* UserObjectImp.cpp:
(UserObjectImp::getOwnPropertySlot):
* UserObjectImp.h:

Source/WebCore:

No new tests.

Added static version of getOwnPropertySlot to every class that overrides
JSCell::getOwnPropertySlot.  The virtual versions now call the static versions.
This is the first step in de-virtualizing JSCell::getOwnPropertySlot.

* bindings/js/JSDOMWindowShell.cpp:
(WebCore::JSDOMWindowShell::getOwnPropertySlot):
* bindings/js/JSDOMWindowShell.h:
* bridge/objc/objc_runtime.h:
* bridge/objc/objc_runtime.mm:
(JSC::Bindings::ObjcFallbackObjectImp::getOwnPropertySlot):
* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::QtRuntimeMetaMethod::getOwnPropertySlot):
(JSC::Bindings::QtRuntimeConnectionMethod::getOwnPropertySlot):
* bridge/qt/qt_runtime.h:
* bridge/runtime_array.cpp:
(JSC::RuntimeArray::getOwnPropertySlot):
* bridge/runtime_array.h:
* bridge/runtime_method.cpp:
(JSC::RuntimeMethod::getOwnPropertySlot):
* bridge/runtime_method.h:
* bridge/runtime_object.cpp:
(JSC::Bindings::RuntimeObject::getOwnPropertySlot):
* bridge/runtime_object.h:

Source/WebKit2:

Added static version of getOwnPropertySlot to every class that overrides
JSCell::getOwnPropertySlot.  The virtual versions now call the static versions.
This is the first step in de-virtualizing JSCell::getOwnPropertySlot.

* WebProcess/Plugins/Netscape/JSNPObject.cpp:
(WebKit::JSNPObject::getOwnPropertySlot):
* WebProcess/Plugins/Netscape/JSNPObject.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@97015 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2839ad3c
2011-10-08 Mark Hahnenberg <mhahnenberg@apple.com>
Add static version of JSCell::getOwnPropertySlot
https://bugs.webkit.org/show_bug.cgi?id=69593
Reviewed by Geoffrey Garen.
Added static version of getOwnPropertySlot to every class that overrides
JSCell::getOwnPropertySlot. The virtual versions now call the static versions.
This is the first step in de-virtualizing JSCell::getOwnPropertySlot.
* JavaScriptCore.exp:
* debugger/DebuggerActivation.cpp:
(JSC::DebuggerActivation::getOwnPropertySlot):
* debugger/DebuggerActivation.h:
* runtime/Arguments.cpp:
(JSC::Arguments::getOwnPropertySlot):
* runtime/Arguments.h:
* runtime/ArrayConstructor.h:
* runtime/ArrayPrototype.cpp:
(JSC::ArrayPrototype::getOwnPropertySlot):
* runtime/ArrayPrototype.h:
* runtime/BooleanPrototype.cpp:
(JSC::BooleanPrototype::getOwnPropertySlot):
* runtime/BooleanPrototype.h:
* runtime/DateConstructor.cpp:
(JSC::DateConstructor::getOwnPropertySlot):
* runtime/DateConstructor.h:
* runtime/DatePrototype.cpp:
(JSC::DatePrototype::getOwnPropertySlot):
* runtime/DatePrototype.h:
* runtime/ErrorPrototype.cpp:
(JSC::ErrorPrototype::getOwnPropertySlot):
* runtime/ErrorPrototype.h:
* runtime/JSActivation.cpp:
(JSC::JSActivation::getOwnPropertySlot):
* runtime/JSActivation.h:
* runtime/JSArray.cpp:
(JSC::JSArray::getOwnPropertySlot):
* runtime/JSArray.h:
* runtime/JSBoundFunction.cpp:
(JSC::JSBoundFunction::getOwnPropertySlot):
* runtime/JSBoundFunction.h:
* runtime/JSByteArray.cpp:
(JSC::JSByteArray::getOwnPropertySlot):
* runtime/JSByteArray.h:
* runtime/JSCell.cpp:
(JSC::JSCell::getOwnPropertySlot):
* runtime/JSCell.h:
* runtime/JSFunction.cpp:
(JSC::JSFunction::getOwnPropertySlot):
* runtime/JSFunction.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::getOwnPropertySlot):
* runtime/JSGlobalObject.h:
* runtime/JSNotAnObject.cpp:
(JSC::JSNotAnObject::getOwnPropertySlot):
* runtime/JSNotAnObject.h:
* runtime/JSONObject.cpp:
(JSC::JSONObject::getOwnPropertySlot):
* runtime/JSONObject.h:
* runtime/JSObject.cpp:
(JSC::JSObject::getOwnPropertySlot):
* runtime/JSObject.h:
(JSC::JSObject::getOwnPropertySlot):
* runtime/JSStaticScopeObject.cpp:
(JSC::JSStaticScopeObject::getOwnPropertySlot):
* runtime/JSStaticScopeObject.h:
* runtime/JSString.cpp:
(JSC::JSString::getOwnPropertySlot):
* runtime/JSString.h:
* runtime/MathObject.cpp:
(JSC::MathObject::getOwnPropertySlot):
* runtime/MathObject.h:
* runtime/NumberConstructor.cpp:
(JSC::NumberConstructor::getOwnPropertySlot):
* runtime/NumberConstructor.h:
* runtime/NumberPrototype.cpp:
(JSC::NumberPrototype::getOwnPropertySlot):
* runtime/NumberPrototype.h:
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructor::getOwnPropertySlot):
* runtime/ObjectConstructor.h:
* runtime/ObjectPrototype.cpp:
(JSC::ObjectPrototype::getOwnPropertySlot):
* runtime/ObjectPrototype.h:
* runtime/RegExpConstructor.cpp:
(JSC::RegExpConstructor::getOwnPropertySlot):
* runtime/RegExpConstructor.h:
* runtime/RegExpMatchesArray.h:
(JSC::RegExpMatchesArray::getOwnPropertySlot):
* runtime/RegExpObject.cpp:
(JSC::RegExpObject::getOwnPropertySlot):
* runtime/RegExpObject.h:
* runtime/RegExpPrototype.cpp:
(JSC::RegExpPrototype::getOwnPropertySlot):
* runtime/RegExpPrototype.h:
* runtime/StringConstructor.cpp:
(JSC::StringConstructor::getOwnPropertySlot):
* runtime/StringConstructor.h:
* runtime/StringObject.cpp:
(JSC::StringObject::getOwnPropertySlot):
* runtime/StringObject.h:
* runtime/StringPrototype.cpp:
(JSC::StringPrototype::getOwnPropertySlot):
* runtime/StringPrototype.h:
2011-10-08 Yuqiang Xian <yuqiang.xian@intel.com>
JSVALUE32_64 DFG JIT - GetLocal should produce a cell result for Array predictions
......@@ -323,6 +323,7 @@ __ZN3JSC8JSObject17putWithAttributesEPNS_12JSGlobalDataEjNS_7JSValueEj
__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj
__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEjbRNS_15PutPropertySlotE
__ZN3JSC8JSObject17putWithAttributesEPNS_9ExecStateEjNS_7JSValueEj
__ZN3JSC8JSObject18getOwnPropertySlotEPNS_6JSCellEPNS_9ExecStateEjRNS_12PropertySlotE
__ZN3JSC8JSObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
__ZN3JSC8JSObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
__ZN3JSC8JSObject21getPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
......
......@@ -62,7 +62,12 @@ UString DebuggerActivation::className() const
bool DebuggerActivation::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return m_activation->getOwnPropertySlot(exec, propertyName, slot);
return getOwnPropertySlot(this, exec, propertyName, slot);
}
bool DebuggerActivation::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return static_cast<DebuggerActivation*>(cell)->m_activation->getOwnPropertySlot(exec, propertyName, slot);
}
void DebuggerActivation::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
......
......@@ -44,6 +44,7 @@ namespace JSC {
static void visitChildren(JSCell*, SlotVisitor&);
virtual UString className() const;
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&);
virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue, unsigned attributes);
......
......@@ -147,15 +147,21 @@ void Arguments::fillArgList(ExecState* exec, MarkedArgumentBuffer& args)
bool Arguments::getOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& slot)
{
if (i < d->numArguments && (!d->deletedArguments || !d->deletedArguments[i])) {
if (i < d->numParameters) {
slot.setValue(d->registers[d->firstParameterIndex + i].get());
return getOwnPropertySlot(this, exec, i, slot);
}
bool Arguments::getOwnPropertySlot(JSCell* cell, ExecState* exec, unsigned i, PropertySlot& slot)
{
Arguments* thisObject = static_cast<Arguments*>(cell);
if (i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) {
if (i < thisObject->d->numParameters) {
slot.setValue(thisObject->d->registers[thisObject->d->firstParameterIndex + i].get());
} else
slot.setValue(d->extraArguments[i - d->numParameters].get());
slot.setValue(thisObject->d->extraArguments[i - thisObject->d->numParameters].get());
return true;
}
return JSObject::getOwnPropertySlot(exec, Identifier(exec, UString::number(i)), slot);
return JSObject::getOwnPropertySlot(thisObject, exec, Identifier(exec, UString::number(i)), slot);
}
void Arguments::createStrictModeCallerIfNecessary(ExecState* exec)
......
......@@ -125,7 +125,9 @@ namespace JSC {
private:
void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc);
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
static bool getOwnPropertySlot(JSCell*, ExecState*, unsigned propertyName, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
......
......@@ -52,6 +52,8 @@ namespace JSC {
private:
ArrayConstructor(JSGlobalObject*, Structure*);
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual ConstructType getConstructData(ConstructData&);
......
......@@ -127,7 +127,12 @@ void ArrayPrototype::finishCreation(JSGlobalObject* globalObject)
bool ArrayPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticFunctionSlot<JSArray>(exec, ExecState::arrayPrototypeTable(exec), this, propertyName, slot);
return getOwnPropertySlot(this, exec, propertyName, slot);
}
bool ArrayPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticFunctionSlot<JSArray>(exec, ExecState::arrayPrototypeTable(exec), static_cast<ArrayPrototype*>(cell), propertyName, slot);
}
bool ArrayPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
......
......@@ -40,7 +40,8 @@ namespace JSC {
return prototype;
}
bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
static const ClassInfo s_info;
......
......@@ -64,7 +64,12 @@ void BooleanPrototype::finishCreation(ExecState* exec, JSGlobalObject*)
bool BooleanPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
{
return getStaticFunctionSlot<BooleanObject>(exec, ExecState::booleanPrototypeTable(exec), this, propertyName, slot);
return getOwnPropertySlot(this, exec, propertyName, slot);
}
bool BooleanPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
{
return getStaticFunctionSlot<BooleanObject>(exec, ExecState::booleanPrototypeTable(exec), static_cast<BooleanPrototype*>(cell), propertyName, slot);
}
bool BooleanPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
......
......@@ -50,6 +50,8 @@ namespace JSC {
private:
BooleanPrototype(ExecState*, Structure*);
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
};
......
......@@ -87,7 +87,12 @@ void DateConstructor::finishCreation(ExecState* exec, DatePrototype* datePrototy
bool DateConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
{
return getStaticFunctionSlot<InternalFunction>(exec, ExecState::dateConstructorTable(exec), this, propertyName, slot);
return getOwnPropertySlot(this, exec, propertyName, slot);
}
bool DateConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
{
return getStaticFunctionSlot<InternalFunction>(exec, ExecState::dateConstructorTable(exec), static_cast<DateConstructor*>(cell), propertyName, slot);
}
bool DateConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
......
......@@ -56,6 +56,8 @@ namespace JSC {
static CallType getCallData(JSCell*, CallData&);
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
};
......
......@@ -445,9 +445,13 @@ void DatePrototype::finishCreation(ExecState* exec, JSGlobalObject*)
bool DatePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticFunctionSlot<JSObject>(exec, ExecState::dateTable(exec), this, propertyName, slot);
return getOwnPropertySlot(this, exec, propertyName, slot);
}
bool DatePrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticFunctionSlot<JSObject>(exec, ExecState::dateTable(exec), static_cast<DatePrototype*>(cell), propertyName, slot);
}
bool DatePrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
......
......@@ -41,6 +41,8 @@ namespace JSC {
return prototype;
}
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
static const ClassInfo s_info;
......
......@@ -64,7 +64,12 @@ void ErrorPrototype::finishCreation(ExecState* exec, JSGlobalObject*)
bool ErrorPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
{
return getStaticFunctionSlot<ErrorInstance>(exec, ExecState::errorPrototypeTable(exec), this, propertyName, slot);
return getOwnPropertySlot(this, exec, propertyName, slot);
}
bool ErrorPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
{
return getStaticFunctionSlot<ErrorInstance>(exec, ExecState::errorPrototypeTable(exec), static_cast<ErrorPrototype*>(cell), propertyName, slot);
}
bool ErrorPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
......
......@@ -53,6 +53,7 @@ namespace JSC {
private:
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
};
......
......@@ -143,23 +143,29 @@ inline bool JSActivation::symbolTablePutWithAttributes(JSGlobalData& globalData,
bool JSActivation::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getOwnPropertySlot(this, exec, propertyName, slot);
}
bool JSActivation::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
JSActivation* thisObject = static_cast<JSActivation*>(cell);
if (propertyName == exec->propertyNames().arguments) {
slot.setCustom(this, getArgumentsGetter());
slot.setCustom(thisObject, thisObject->getArgumentsGetter());
return true;
}
if (symbolTableGet(propertyName, slot))
if (thisObject->symbolTableGet(propertyName, slot))
return true;
if (WriteBarrierBase<Unknown>* location = getDirectLocation(exec->globalData(), propertyName)) {
if (WriteBarrierBase<Unknown>* location = thisObject->getDirectLocation(exec->globalData(), propertyName)) {
slot.setValue(location->get());
return true;
}
// We don't call through to JSObject because there's no way to give an
// activation object getter properties or a prototype.
ASSERT(!hasGetterSetterProperties());
ASSERT(prototype().isNull());
ASSERT(!thisObject->hasGetterSetterProperties());
ASSERT(thisObject->prototype().isNull());
return false;
}
......
......@@ -62,6 +62,7 @@ namespace JSC {
virtual bool isActivationObject() const { return true; }
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&);
virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode);
virtual void put(ExecState*, const Identifier&, JSValue, PutPropertySlot&);
......
......@@ -247,15 +247,21 @@ JSArray::~JSArray()
bool JSArray::getOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& slot)
{
ArrayStorage* storage = m_storage;
return getOwnPropertySlot(this, exec, i, slot);
}
bool JSArray::getOwnPropertySlot(JSCell* cell, ExecState* exec, unsigned i, PropertySlot& slot)
{
JSArray* thisObject = static_cast<JSArray*>(cell);
ArrayStorage* storage = thisObject->m_storage;
if (i >= storage->m_length) {
if (i > MAX_ARRAY_INDEX)
return getOwnPropertySlot(exec, Identifier::from(exec, i), slot);
return thisObject->getOwnPropertySlot(exec, Identifier::from(exec, i), slot);
return false;
}
if (i < m_vectorLength) {
if (i < thisObject->m_vectorLength) {
JSValue value = storage->m_vector[i].get();
if (value) {
slot.setValue(value);
......@@ -271,22 +277,28 @@ bool JSArray::getOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& slot
}
}
return JSObject::getOwnPropertySlot(exec, Identifier::from(exec, i), slot);
return JSObject::getOwnPropertySlot(thisObject, exec, Identifier::from(exec, i), slot);
}
bool JSArray::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getOwnPropertySlot(this, exec, propertyName, slot);
}
bool JSArray::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
JSArray* thisObject = static_cast<JSArray*>(cell);
if (propertyName == exec->propertyNames().length) {
slot.setValue(jsNumber(length()));
slot.setValue(jsNumber(thisObject->length()));
return true;
}
bool isArrayIndex;
unsigned i = propertyName.toArrayIndex(isArrayIndex);
if (isArrayIndex)
return JSArray::getOwnPropertySlot(exec, i, slot);
return JSArray::getOwnPropertySlot(thisObject, exec, i, slot);
return JSObject::getOwnPropertySlot(exec, propertyName, slot);
return JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot);
}
bool JSArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
......
......@@ -95,7 +95,9 @@ namespace JSC {
}
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
static bool getOwnPropertySlot(JSCell*, ExecState*, unsigned propertyName, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual void put(ExecState*, unsigned propertyName, JSValue); // FIXME: Make protected and add setItem.
static void put(JSCell*, ExecState*, unsigned propertyName, JSValue);
......
......@@ -97,6 +97,11 @@ bool JSBoundFunction::hasInstance(ExecState* exec, JSValue value, JSValue)
}
bool JSBoundFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getOwnPropertySlot(this, exec, propertyName, slot);
}
bool JSBoundFunction::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
if (propertyName == exec->propertyNames().arguments) {
throwTypeError(exec, StrictModeArgumentsAccessError);
......@@ -110,7 +115,7 @@ bool JSBoundFunction::getOwnPropertySlot(ExecState* exec, const Identifier& prop
return true;
}
return Base::getOwnPropertySlot(exec, propertyName, slot);
return Base::getOwnPropertySlot(cell, exec, propertyName, slot);
}
bool JSBoundFunction::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
......
......@@ -40,6 +40,7 @@ public:
static JSBoundFunction* create(ExecState*, JSGlobalObject*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int, const Identifier&);
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual bool hasInstance(ExecState*, JSValue value, JSValue proto);
......
......@@ -56,13 +56,19 @@ Structure* JSByteArray::createStructure(JSGlobalData& globalData, JSGlobalObject
bool JSByteArray::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getOwnPropertySlot(this, exec, propertyName, slot);
}
bool JSByteArray::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
JSByteArray* thisObject = static_cast<JSByteArray*>(cell);
bool ok;
unsigned index = propertyName.toUInt32(ok);
if (ok && canAccessIndex(index)) {
slot.setValue(getIndex(exec, index));
if (ok && thisObject->canAccessIndex(index)) {
slot.setValue(thisObject->getIndex(exec, index));
return true;
}
return JSObject::getOwnPropertySlot(exec, propertyName, slot);
return JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot);
}
bool JSByteArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
......@@ -78,11 +84,17 @@ bool JSByteArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& pr
bool JSByteArray::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
{
if (canAccessIndex(propertyName)) {
slot.setValue(getIndex(exec, propertyName));
return getOwnPropertySlot(this, exec, propertyName, slot);
}
bool JSByteArray::getOwnPropertySlot(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot)
{
JSByteArray* thisObject = static_cast<JSByteArray*>(cell);
if (thisObject->canAccessIndex(propertyName)) {
slot.setValue(thisObject->getIndex(exec, propertyName));
return true;
}
return JSObject::getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
return JSObject::getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot);
}
void JSByteArray::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
......
......@@ -89,7 +89,9 @@ namespace JSC {
static Structure* createStructure(JSGlobalData&, JSGlobalObject*, JSValue prototype, const JSC::ClassInfo* = &s_info);
virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
virtual bool getOwnPropertySlot(JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&);
static void put(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&);
......
......@@ -70,11 +70,16 @@ ConstructType JSCell::getConstructData(ConstructData&)
}
bool JSCell::getOwnPropertySlot(ExecState* exec, const Identifier& identifier, PropertySlot& slot)
{
return getOwnPropertySlot(this, exec, identifier, slot);
}
bool JSCell::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& identifier, PropertySlot& slot)
{
// This is not a general purpose implementation of getOwnPropertySlot.
// It should only be called by JSValue::get.
// It calls getPropertySlot, not getOwnPropertySlot.
JSObject* object = toObject(exec, exec->lexicalGlobalObject());
JSObject* object = cell->toObject(exec, exec->lexicalGlobalObject());
slot.setBase(object);
if (!object->getPropertySlot(exec, identifier, slot))
slot.setUndefined();
......@@ -82,11 +87,16 @@ bool JSCell::getOwnPropertySlot(ExecState* exec, const Identifier& identifier, P
}
bool JSCell::getOwnPropertySlot(ExecState* exec, unsigned identifier, PropertySlot& slot)
{
return getOwnPropertySlot(this, exec, identifier, slot);
}
bool JSCell::getOwnPropertySlot(JSCell* cell, ExecState* exec, unsigned identifier, PropertySlot& slot)
{
// This is not a general purpose implementation of getOwnPropertySlot.
// It should only be called by JSValue::get.
// It calls getPropertySlot, not getOwnPropertySlot.
JSObject* object = toObject(exec, exec->lexicalGlobalObject());
JSObject* object = cell->toObject(exec, exec->lexicalGlobalObject());
slot.setBase(object);
if (!object->getPropertySlot(exec, identifier, slot))
slot.setUndefined();
......
......@@ -136,7 +136,9 @@ namespace JSC {
private:
// Base implementation; for non-object classes implements getPropertySlot.
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier& propertyName, PropertySlot&);
virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
static bool getOwnPropertySlot(JSCell*, ExecState*, unsigned propertyName, PropertySlot&);
WriteBarrier<Structure> m_structure;
};
......
......@@ -204,50 +204,56 @@ JSValue JSFunction::lengthGetter(ExecState*, JSValue slotBase, const Identifier&
bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
if (isHostFunction())
return Base::getOwnPropertySlot(exec, propertyName, slot);
return getOwnPropertySlot(this, exec, propertyName, slot);
}
bool JSFunction::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
JSFunction* thisObject = static_cast<JSFunction*>(cell);
if (thisObject->isHostFunction())
return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
if (propertyName == exec->propertyNames().prototype) {
WriteBarrierBase<Unknown>* location = getDirectLocation(exec->globalData(), propertyName);
WriteBarrierBase<Unknown>* location = thisObject->getDirectLocation(exec->globalData(), propertyName);
if (!location) {
JSObject* prototype = constructEmptyObject(exec, globalObject()->emptyObjectStructure());
prototype->putDirect(exec->globalData(), exec->propertyNames().constructor, this, DontEnum);
JSObject* prototype = constructEmptyObject(exec, thisObject->globalObject()->emptyObjectStructure());
prototype->putDirect(exec->globalData(), exec->propertyNames().constructor, thisObject, DontEnum);
PutPropertySlot slot;
putDirect(exec->globalData(), exec->propertyNames().prototype, prototype, DontDelete | DontEnum, false, slot);
location = getDirectLocation(exec->globalData(), exec->propertyNames().prototype);
thisObject->putDirect(exec->globalData(), exec->propertyNames().prototype, prototype, DontDelete | DontEnum, false, slot);
location = thisObject->getDirectLocation(exec->globalData(), exec->propertyNames().prototype);
}
slot.setValue(this, location->get(), offsetForLocation(location));
slot.setValue(thisObject, location->get(), thisObject->offsetForLocation(location));
}
if (propertyName == exec->propertyNames().arguments) {
if (jsExecutable()->isStrictMode()) {
if (thisObject->jsExecutable()->isStrictMode()) {
throwTypeError(exec, StrictModeArgumentsAccessError);
slot.setValue(jsNull());
return true;
}
slot.setCacheableCustom(this, argumentsGetter);