Commit 914c3eeb authored by mhahnenberg@apple.com's avatar mhahnenberg@apple.com

Add static version of JSCell::deleteProperty

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

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Added static version of both versions of put to all classes that
override them and changed the virtual versions to call the static
versions.  This is the first step in de-virtualizing JSCell::deleteProperty.

* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(JSC::::deleteProperty):
* debugger/DebuggerActivation.cpp:
(JSC::DebuggerActivation::deleteProperty):
* debugger/DebuggerActivation.h:
* runtime/Arguments.cpp:
(JSC::Arguments::deleteProperty):
* runtime/Arguments.h:
* runtime/JSActivation.cpp:
(JSC::JSActivation::deleteProperty):
* runtime/JSActivation.h:
* runtime/JSArray.cpp:
(JSC::JSArray::deleteProperty):
* runtime/JSArray.h:
* runtime/JSCell.cpp:
(JSC::JSCell::deleteProperty):
* runtime/JSCell.h:
* runtime/JSFunction.cpp:
(JSC::JSFunction::deleteProperty):
* runtime/JSFunction.h:
* runtime/JSNotAnObject.cpp:
(JSC::JSNotAnObject::deleteProperty):
* runtime/JSNotAnObject.h:
* runtime/JSObject.cpp:
(JSC::JSObject::deleteProperty):
* runtime/JSObject.h:
* runtime/JSVariableObject.cpp:
(JSC::JSVariableObject::deleteProperty):
* runtime/JSVariableObject.h:
* runtime/RegExpMatchesArray.h:
(JSC::RegExpMatchesArray::deleteProperty):
* runtime/StrictEvalActivation.cpp:
(JSC::StrictEvalActivation::deleteProperty):
* runtime/StrictEvalActivation.h:
* runtime/StringObject.cpp:
(JSC::StringObject::deleteProperty):
* runtime/StringObject.h:

Source/WebCore:

No new tests.

Added static version of both versions of put to all classes that
override them and changed the virtual versions to call the static
versions.  This is the first step in de-virtualizing JSCell::deleteProperty.

* bridge/objc/objc_runtime.h:
* bridge/objc/objc_runtime.mm:
(JSC::Bindings::ObjcFallbackObjectImp::deleteProperty):
* bridge/runtime_array.cpp:
(JSC::RuntimeArray::deleteProperty):
* bridge/runtime_array.h:
* bridge/runtime_object.cpp:
(JSC::Bindings::RuntimeObject::deleteProperty):
* bridge/runtime_object.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@97002 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 82cb7a18
......@@ -185,7 +185,9 @@ private:
static void put(JSCell*, ExecState*, const Identifier&, JSValue, PutPropertySlot&);
virtual bool deleteProperty(ExecState*, const Identifier&);
static bool deleteProperty(JSCell*, ExecState*, const Identifier&);
virtual bool deleteProperty(ExecState*, unsigned);
static bool deleteProperty(JSCell*, ExecState*, unsigned);
virtual bool hasInstance(ExecState* exec, JSValue value, JSValue proto);
......
......@@ -268,11 +268,18 @@ void JSCallbackObject<Parent>::put(JSCell* cell, ExecState* exec, const Identifi
template <class Parent>
bool JSCallbackObject<Parent>::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
return deleteProperty(this, exec, propertyName);
}
template <class Parent>
bool JSCallbackObject<Parent>::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName)
{
JSCallbackObject* thisObject = static_cast<JSCallbackObject*>(cell);
JSContextRef ctx = toRef(exec);
JSObjectRef thisRef = toRef(this);
JSObjectRef thisRef = toRef(thisObject);
RefPtr<OpaqueJSString> propertyNameRef;
for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass) {
for (JSClassRef jsClass = thisObject->classRef(); jsClass; jsClass = jsClass->parentClass) {
if (JSObjectDeletePropertyCallback deleteProperty = jsClass->deleteProperty) {
if (!propertyNameRef)
propertyNameRef = OpaqueJSString::create(propertyName.ustring());
......@@ -305,13 +312,19 @@ bool JSCallbackObject<Parent>::deleteProperty(ExecState* exec, const Identifier&
}
}
return Parent::deleteProperty(exec, propertyName);
return Parent::deleteProperty(thisObject, exec, propertyName);
}
template <class Parent>
bool JSCallbackObject<Parent>::deleteProperty(ExecState* exec, unsigned propertyName)
{
return deleteProperty(exec, Identifier::from(exec, propertyName));
return deleteProperty(this, exec, propertyName);
}
template <class Parent>
bool JSCallbackObject<Parent>::deleteProperty(JSCell* cell, ExecState* exec, unsigned propertyName)
{
return static_cast<JSCallbackObject*>(cell)->deleteProperty(exec, Identifier::from(exec, propertyName));
}
template <class Parent>
......
2011-10-07 Mark Hahnenberg <mhahnenberg@apple.com>
Add static version of JSCell::deleteProperty
https://bugs.webkit.org/show_bug.cgi?id=69659
Reviewed by Geoffrey Garen.
Added static version of both versions of put to all classes that
override them and changed the virtual versions to call the static
versions. This is the first step in de-virtualizing JSCell::deleteProperty.
* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(JSC::::deleteProperty):
* debugger/DebuggerActivation.cpp:
(JSC::DebuggerActivation::deleteProperty):
* debugger/DebuggerActivation.h:
* runtime/Arguments.cpp:
(JSC::Arguments::deleteProperty):
* runtime/Arguments.h:
* runtime/JSActivation.cpp:
(JSC::JSActivation::deleteProperty):
* runtime/JSActivation.h:
* runtime/JSArray.cpp:
(JSC::JSArray::deleteProperty):
* runtime/JSArray.h:
* runtime/JSCell.cpp:
(JSC::JSCell::deleteProperty):
* runtime/JSCell.h:
* runtime/JSFunction.cpp:
(JSC::JSFunction::deleteProperty):
* runtime/JSFunction.h:
* runtime/JSNotAnObject.cpp:
(JSC::JSNotAnObject::deleteProperty):
* runtime/JSNotAnObject.h:
* runtime/JSObject.cpp:
(JSC::JSObject::deleteProperty):
* runtime/JSObject.h:
* runtime/JSVariableObject.cpp:
(JSC::JSVariableObject::deleteProperty):
* runtime/JSVariableObject.h:
* runtime/RegExpMatchesArray.h:
(JSC::RegExpMatchesArray::deleteProperty):
* runtime/StrictEvalActivation.cpp:
(JSC::StrictEvalActivation::deleteProperty):
* runtime/StrictEvalActivation.h:
* runtime/StringObject.cpp:
(JSC::StringObject::deleteProperty):
* runtime/StringObject.h:
2011-10-07 Mark Hahnenberg <mhahnenberg@apple.com>
Remove getCallDataVirtual methods
......@@ -82,7 +82,12 @@ void DebuggerActivation::putWithAttributes(ExecState* exec, const Identifier& pr
bool DebuggerActivation::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
return m_activation->deleteProperty(exec, propertyName);
return deleteProperty(this, exec, propertyName);
}
bool DebuggerActivation::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName)
{
return static_cast<DebuggerActivation*>(cell)->m_activation->deleteProperty(exec, propertyName);
}
void DebuggerActivation::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
......
......@@ -48,6 +48,7 @@ namespace JSC {
static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue, unsigned attributes);
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName);
virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes);
......
......@@ -318,52 +318,64 @@ void Arguments::put(JSCell* cell, ExecState* exec, const Identifier& propertyNam
bool Arguments::deleteProperty(ExecState* exec, unsigned i)
{
if (i < d->numArguments) {
if (!d->deletedArguments) {
d->deletedArguments = adoptArrayPtr(new bool[d->numArguments]);
memset(d->deletedArguments.get(), 0, sizeof(bool) * d->numArguments);
return deleteProperty(this, exec, i);
}
bool Arguments::deleteProperty(JSCell* cell, ExecState* exec, unsigned i)
{
Arguments* thisObject = static_cast<Arguments*>(cell);
if (i < thisObject->d->numArguments) {
if (!thisObject->d->deletedArguments) {
thisObject->d->deletedArguments = adoptArrayPtr(new bool[thisObject->d->numArguments]);
memset(thisObject->d->deletedArguments.get(), 0, sizeof(bool) * thisObject->d->numArguments);
}
if (!d->deletedArguments[i]) {
d->deletedArguments[i] = true;
if (!thisObject->d->deletedArguments[i]) {
thisObject->d->deletedArguments[i] = true;
return true;
}
}
return JSObject::deleteProperty(exec, Identifier(exec, UString::number(i)));
return JSObject::deleteProperty(thisObject, exec, Identifier(exec, UString::number(i)));
}
bool Arguments::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
return deleteProperty(this, exec, propertyName);
}
bool Arguments::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName)
{
Arguments* thisObject = static_cast<Arguments*>(cell);
bool isArrayIndex;
unsigned i = propertyName.toArrayIndex(isArrayIndex);
if (isArrayIndex && i < d->numArguments) {
if (!d->deletedArguments) {
d->deletedArguments = adoptArrayPtr(new bool[d->numArguments]);
memset(d->deletedArguments.get(), 0, sizeof(bool) * d->numArguments);
if (isArrayIndex && i < thisObject->d->numArguments) {
if (!thisObject->d->deletedArguments) {
thisObject->d->deletedArguments = adoptArrayPtr(new bool[thisObject->d->numArguments]);
memset(thisObject->d->deletedArguments.get(), 0, sizeof(bool) * thisObject->d->numArguments);
}
if (!d->deletedArguments[i]) {
d->deletedArguments[i] = true;
if (!thisObject->d->deletedArguments[i]) {
thisObject->d->deletedArguments[i] = true;
return true;
}
}
if (propertyName == exec->propertyNames().length && !d->overrodeLength) {
d->overrodeLength = true;
if (propertyName == exec->propertyNames().length && !thisObject->d->overrodeLength) {
thisObject->d->overrodeLength = true;
return true;
}
if (propertyName == exec->propertyNames().callee && !d->overrodeCallee) {
if (!d->isStrictMode) {
d->overrodeCallee = true;
if (propertyName == exec->propertyNames().callee && !thisObject->d->overrodeCallee) {
if (!thisObject->d->isStrictMode) {
thisObject->d->overrodeCallee = true;
return true;
}
createStrictModeCalleeIfNecessary(exec);
thisObject->createStrictModeCalleeIfNecessary(exec);
}
if (propertyName == exec->propertyNames().caller && !d->isStrictMode)
createStrictModeCallerIfNecessary(exec);
if (propertyName == exec->propertyNames().caller && !thisObject->d->isStrictMode)
thisObject->createStrictModeCallerIfNecessary(exec);
return JSObject::deleteProperty(exec, propertyName);
return JSObject::deleteProperty(thisObject, exec, propertyName);
}
} // namespace JSC
......@@ -133,7 +133,9 @@ namespace JSC {
virtual void put(ExecState*, unsigned propertyName, JSValue);
static void put(JSCell*, ExecState*, unsigned propertyName, JSValue);
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName);
virtual bool deleteProperty(ExecState*, unsigned propertyName);
static bool deleteProperty(JSCell*, ExecState*, unsigned propertyName);
void createStrictModeCallerIfNecessary(ExecState*);
void createStrictModeCalleeIfNecessary(ExecState*);
......
......@@ -200,11 +200,16 @@ void JSActivation::putWithAttributes(ExecState* exec, const Identifier& property
}
bool JSActivation::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
return deleteProperty(this, exec, propertyName);
}
bool JSActivation::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName)
{
if (propertyName == exec->propertyNames().arguments)
return false;
return Base::deleteProperty(exec, propertyName);
return Base::deleteProperty(cell, exec, propertyName);
}
JSObject* JSActivation::toThisObject(ExecState* exec) const
......
......@@ -69,6 +69,7 @@ namespace JSC {
virtual void putWithAttributes(ExecState*, const Identifier&, JSValue, unsigned attributes);
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName);
virtual JSObject* toThisObject(ExecState*) const;
......
......@@ -497,32 +497,44 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu
bool JSArray::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
return deleteProperty(this, exec, propertyName);
}
bool JSArray::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName)
{
JSArray* thisObject = static_cast<JSArray*>(cell);
bool isArrayIndex;
unsigned i = propertyName.toArrayIndex(isArrayIndex);
if (isArrayIndex)
return deleteProperty(exec, i);
return thisObject->deleteProperty(exec, i);
if (propertyName == exec->propertyNames().length)
return false;
return JSObject::deleteProperty(exec, propertyName);
return JSObject::deleteProperty(thisObject, exec, propertyName);
}
bool JSArray::deleteProperty(ExecState* exec, unsigned i)
{
checkConsistency();
return deleteProperty(this, exec, i);
}
ArrayStorage* storage = m_storage;
bool JSArray::deleteProperty(JSCell* cell, ExecState* exec, unsigned i)
{
JSArray* thisObject = static_cast<JSArray*>(cell);
thisObject->checkConsistency();
ArrayStorage* storage = thisObject->m_storage;
if (i < m_vectorLength) {
if (i < thisObject->m_vectorLength) {
WriteBarrier<Unknown>& valueSlot = storage->m_vector[i];
if (!valueSlot) {
checkConsistency();
thisObject->checkConsistency();
return false;
}
valueSlot.clear();
--storage->m_numValuesInVector;
checkConsistency();
thisObject->checkConsistency();
return true;
}
......@@ -531,16 +543,16 @@ bool JSArray::deleteProperty(ExecState* exec, unsigned i)
SparseArrayValueMap::iterator it = map->find(i);
if (it != map->end()) {
map->remove(it);
checkConsistency();
thisObject->checkConsistency();
return true;
}
}
}
checkConsistency();
thisObject->checkConsistency();
if (i > MAX_ARRAY_INDEX)
return deleteProperty(exec, Identifier::from(exec, i));
return thisObject->deleteProperty(exec, Identifier::from(exec, i));
return false;
}
......
......@@ -173,7 +173,9 @@ namespace JSC {
static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName);
virtual bool deleteProperty(ExecState*, unsigned propertyName);
static bool deleteProperty(JSCell*, ExecState*, unsigned propertyName);
virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
static void visitChildren(JSCell*, SlotVisitor&);
......
......@@ -110,12 +110,22 @@ void JSCell::put(JSCell* cell, ExecState* exec, unsigned identifier, JSValue val
bool JSCell::deleteProperty(ExecState* exec, const Identifier& identifier)
{
return toObject(exec, exec->lexicalGlobalObject())->deleteProperty(exec, identifier);
return deleteProperty(this, exec, identifier);
}
bool JSCell::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& identifier)
{
return cell->toObject(exec, exec->lexicalGlobalObject())->deleteProperty(exec, identifier);
}
bool JSCell::deleteProperty(ExecState* exec, unsigned identifier)
{
return toObject(exec, exec->lexicalGlobalObject())->deleteProperty(exec, identifier);
return deleteProperty(this, exec, identifier);
}
bool JSCell::deleteProperty(JSCell* cell, ExecState* exec, unsigned identifier)
{
return cell->toObject(exec, exec->lexicalGlobalObject())->deleteProperty(exec, identifier);
}
JSObject* JSCell::toThisObject(ExecState* exec) const
......
......@@ -95,7 +95,9 @@ namespace JSC {
static void put(JSCell*, ExecState*, unsigned propertyName, JSValue);
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName);
virtual bool deleteProperty(ExecState*, unsigned propertyName);
static bool deleteProperty(JSCell*, ExecState*, unsigned propertyName);
virtual JSObject* toThisObject(ExecState*) const;
......
......@@ -329,11 +329,17 @@ void JSFunction::put(JSCell* cell, ExecState* exec, const Identifier& propertyNa
bool JSFunction::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
if (isHostFunction())
return Base::deleteProperty(exec, propertyName);
return deleteProperty(this, exec, propertyName);
}
bool JSFunction::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName)
{
JSFunction* thisObject = static_cast<JSFunction*>(cell);
if (thisObject->isHostFunction())
return Base::deleteProperty(thisObject, exec, propertyName);
if (propertyName == exec->propertyNames().arguments || propertyName == exec->propertyNames().length)
return false;
return Base::deleteProperty(exec, propertyName);
return Base::deleteProperty(thisObject, exec, propertyName);
}
// ECMA 13.2.2 [[Construct]]
......
......@@ -145,6 +145,7 @@ namespace JSC {
static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName);
static JSValue argumentsGetter(ExecState*, JSValue, const Identifier&);
static JSValue callerGetter(ExecState*, JSValue, const Identifier&);
......
......@@ -96,13 +96,23 @@ void JSNotAnObject::put(JSCell*, ExecState* exec, unsigned, JSValue)
ASSERT_UNUSED(exec, exec->hadException());
}
bool JSNotAnObject::deleteProperty(ExecState* exec, const Identifier&)
bool JSNotAnObject::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
return deleteProperty(this, exec, propertyName);
}
bool JSNotAnObject::deleteProperty(JSCell*, ExecState* exec, const Identifier&)
{
ASSERT_UNUSED(exec, exec->hadException());
return false;
}
bool JSNotAnObject::deleteProperty(ExecState* exec, unsigned)
bool JSNotAnObject::deleteProperty(ExecState* exec, unsigned propertyName)
{
return deleteProperty(this, exec, propertyName);
}
bool JSNotAnObject::deleteProperty(JSCell*, ExecState* exec, unsigned)
{
ASSERT_UNUSED(exec, exec->hadException());
return false;
......
......@@ -81,7 +81,9 @@ namespace JSC {
static void put(JSCell*, ExecState*, unsigned propertyName, JSValue);
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName);
virtual bool deleteProperty(ExecState*, unsigned propertyName);
static bool deleteProperty(JSCell*, ExecState*, unsigned propertyName);
virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
};
......
......@@ -242,20 +242,26 @@ bool JSObject::hasProperty(ExecState* exec, unsigned propertyName) const
return const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot);
}
// ECMA 8.6.2.5
bool JSObject::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
return deleteProperty(this, exec, propertyName);
}
// ECMA 8.6.2.5
bool JSObject::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName)
{
JSObject* thisObject = static_cast<JSObject*>(cell);
unsigned attributes;
JSCell* specificValue;
if (structure()->get(exec->globalData(), propertyName, attributes, specificValue) != WTF::notFound) {
if (thisObject->structure()->get(exec->globalData(), propertyName, attributes, specificValue) != WTF::notFound) {
if ((attributes & DontDelete))
return false;
removeDirect(exec->globalData(), propertyName);
thisObject->removeDirect(exec->globalData(), propertyName);
return true;
}
// Look in the static hashtable of properties
const HashEntry* entry = findPropertyHashEntry(exec, propertyName);
const HashEntry* entry = thisObject->findPropertyHashEntry(exec, propertyName);
if (entry && entry->attributes() & DontDelete)
return false; // this builtin property can't be deleted
......@@ -271,7 +277,12 @@ bool JSObject::hasOwnProperty(ExecState* exec, const Identifier& propertyName) c
bool JSObject::deleteProperty(ExecState* exec, unsigned propertyName)
{
return deleteProperty(exec, Identifier::from(exec, propertyName));
return deleteProperty(this, exec, propertyName);
}
bool JSObject::deleteProperty(JSCell* cell, ExecState* exec, unsigned propertyName)
{
return static_cast<JSObject*>(cell)->deleteProperty(exec, Identifier::from(exec, propertyName));
}
static ALWAYS_INLINE JSValue callDefaultValueFunction(ExecState* exec, const JSObject* object, const Identifier& propertyName)
......
......@@ -124,7 +124,9 @@ namespace JSC {
bool hasOwnProperty(ExecState*, const Identifier& propertyName) const;
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName);
virtual bool deleteProperty(ExecState*, unsigned propertyName);
static bool deleteProperty(JSCell*, ExecState*, unsigned propertyName);
virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const;
......
......@@ -36,10 +36,16 @@ namespace JSC {
bool JSVariableObject::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
if (symbolTable().contains(propertyName.impl()))
return deleteProperty(this, exec, propertyName);
}
bool JSVariableObject::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName)
{
JSVariableObject* thisObject = static_cast<JSVariableObject*>(cell);
if (thisObject->symbolTable().contains(propertyName.impl()))
return false;
return JSObject::deleteProperty(exec, propertyName);
return JSObject::deleteProperty(thisObject, exec, propertyName);
}
void JSVariableObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
......
......@@ -51,6 +51,7 @@ namespace JSC {
virtual void putWithAttributes(ExecState*, const Identifier&, JSValue, unsigned attributes) = 0;
virtual bool deleteProperty(ExecState*, const Identifier&);
static bool deleteProperty(JSCell*, ExecState*, const Identifier&);
virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
virtual bool isVariableObject() const;
......
......@@ -92,16 +92,28 @@ namespace JSC {
virtual bool deleteProperty(ExecState* exec, const Identifier& propertyName)
{
if (subclassData())
fillArrayInstance(exec);
return JSArray::deleteProperty(exec, propertyName);
return deleteProperty(this, exec, propertyName);
}
static bool deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName)
{
RegExpMatchesArray* thisObject = static_cast<RegExpMatchesArray*>(cell);
if (thisObject->subclassData())
thisObject->fillArrayInstance(exec);
return JSArray::deleteProperty(thisObject, exec, propertyName);
}
virtual bool deleteProperty(ExecState* exec, unsigned propertyName)
{
if (subclassData())
fillArrayInstance(exec);
return JSArray::deleteProperty(exec, propertyName);
return deleteProperty(this, exec, propertyName);
}
static bool deleteProperty(JSCell* cell, ExecState* exec, unsigned propertyName)
{
RegExpMatchesArray* thisObject = static_cast<RegExpMatchesArray*>(cell);
if (thisObject->subclassData())
thisObject->fillArrayInstance(exec);
return JSArray::deleteProperty(thisObject, exec, propertyName);
}
virtual void getOwnPropertyNames(ExecState* exec, PropertyNameArray& arr, EnumerationMode mode = ExcludeDontEnumProperties)
......
......@@ -35,7 +35,12 @@ StrictEvalActivation::StrictEvalActivation(ExecState* exec)
{
}
bool StrictEvalActivation::deleteProperty(ExecState*, const Identifier&)
bool StrictEvalActivation::deleteProperty(ExecState* exec, const Identifier& identifier)
{
return deleteProperty(this, exec, identifier);
}
bool StrictEvalActivation::deleteProperty(JSCell*, ExecState*, const Identifier&)
{
return false;
}
......
......@@ -42,6 +42,7 @@ public:
}
virtual bool deleteProperty(ExecState*, const Identifier&);
static bool deleteProperty(JSCell*, ExecState*, const Identifier&);
virtual JSObject* toThisObject(ExecState*) const;
static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
......
......@@ -76,13 +76,19 @@ void StringObject::put(JSCell* cell, ExecState* exec, const Identifier& property
bool StringObject::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
return deleteProperty(this, exec, propertyName);
}
bool StringObject::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& propertyName)
{
StringObject* thisObject = static_cast<StringObject*>(cell);
if (propertyName == exec->propertyNames().length)
return false;
bool isStrictUInt32;
unsigned i = propertyName.toUInt32(isStrictUInt32);
if (isStrictUInt32 && internalValue()->canGetIndex(i))
if (isStrictUInt32 && thisObject->internalValue()->canGetIndex(i))
return false;
return JSObject::deleteProperty(exec, propertyName);
return JSObject::deleteProperty(thisObject, exec, propertyName);
}
void StringObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
......
......@@ -54,6 +54,7 @@ namespace JSC {
static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName);
virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
static const JS_EXPORTDATA ClassInfo s_info;
......
2011-10-07 Mark Hahnenberg <mhahnenberg@apple.com>
Add static version of JSCell::deleteProperty
https://bugs.webkit.org/show_bug.cgi?id=69659
Reviewed by Geoffrey Garen.
No new tests.
Added static version of both versions of put to all classes that
override them and changed the virtual versions to call the static