Commit dd40a7eb authored by barraclough@apple.com's avatar barraclough@apple.com

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

Remove putDirectVirtual

Reviewed by Sam Weinig.

This could most generously be described as 'vestigial'.
No performance impact.

* API/JSObjectRef.cpp:
(JSObjectSetProperty):
    - changed to use defineOwnProperty
* debugger/DebuggerActivation.cpp:
* debugger/DebuggerActivation.h:
    - remove putDirectVirtual
* interpreter/Interpreter.cpp:
(JSC::Interpreter::execute):
    - changed to use defineOwnProperty
* runtime/ClassInfo.h:
* runtime/JSActivation.cpp:
* runtime/JSActivation.h:
* runtime/JSCell.cpp:
* runtime/JSCell.h:
* runtime/JSGlobalObject.cpp:
* runtime/JSGlobalObject.h:
* runtime/JSObject.cpp:
* runtime/JSObject.h:
* runtime/JSProxy.cpp:
* runtime/JSProxy.h:
* runtime/JSSymbolTableObject.cpp:
* runtime/JSSymbolTableObject.h:
    - remove putDirectVirtual
* runtime/PropertyDescriptor.h:
(JSC::PropertyDescriptor::PropertyDescriptor):
    - added constructor for convenience



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154459 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 672cb851
......@@ -327,9 +327,10 @@ void JSObjectSetProperty(JSContextRef ctx, JSObjectRef object, JSStringRef prope
Identifier name(propertyName->identifier(&exec->vm()));
JSValue jsValue = toJS(exec, value);
if (attributes && !jsObject->hasProperty(exec, name))
jsObject->methodTable()->putDirectVirtual(jsObject, exec, name, jsValue, attributes);
else {
if (attributes && !jsObject->hasProperty(exec, name)) {
PropertyDescriptor desc(jsValue, attributes);
jsObject->methodTable()->defineOwnProperty(jsObject, exec, name, desc, false);
} else {
PutPropertySlot slot;
jsObject->methodTable()->put(jsObject, exec, name, jsValue, slot);
}
......
2013-08-21 Gavin Barraclough <barraclough@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=120128
Remove putDirectVirtual
Reviewed by Sam Weinig.
This could most generously be described as 'vestigial'.
No performance impact.
* API/JSObjectRef.cpp:
(JSObjectSetProperty):
- changed to use defineOwnProperty
* debugger/DebuggerActivation.cpp:
* debugger/DebuggerActivation.h:
- remove putDirectVirtual
* interpreter/Interpreter.cpp:
(JSC::Interpreter::execute):
- changed to use defineOwnProperty
* runtime/ClassInfo.h:
* runtime/JSActivation.cpp:
* runtime/JSActivation.h:
* runtime/JSCell.cpp:
* runtime/JSCell.h:
* runtime/JSGlobalObject.cpp:
* runtime/JSGlobalObject.h:
* runtime/JSObject.cpp:
* runtime/JSObject.h:
* runtime/JSProxy.cpp:
* runtime/JSProxy.h:
* runtime/JSSymbolTableObject.cpp:
* runtime/JSSymbolTableObject.h:
- remove putDirectVirtual
* runtime/PropertyDescriptor.h:
(JSC::PropertyDescriptor::PropertyDescriptor):
- added constructor for convenience
2013-08-22 Chris Curtis <chris_curtis@apple.com>
errorDescriptionForValue() should not assume error value is an Object
......
......@@ -77,12 +77,6 @@ void DebuggerActivation::put(JSCell* cell, ExecState* exec, PropertyName propert
thisObject->m_activation->methodTable()->put(thisObject->m_activation.get(), exec, propertyName, value, slot);
}
void DebuggerActivation::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName propertyName, JSValue value, unsigned attributes)
{
DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object);
thisObject->m_activation->methodTable()->putDirectVirtual(thisObject->m_activation.get(), exec, propertyName, value, attributes);
}
bool DebuggerActivation::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
{
DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(cell);
......
......@@ -45,7 +45,6 @@ namespace JSC {
static String className(const JSObject*);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes);
static bool deleteProperty(JSCell*, ExecState*, PropertyName);
static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool shouldThrow);
......
......@@ -735,12 +735,17 @@ JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, J
JSONPPath.swap(JSONPData[entry].m_path);
JSValue JSONPValue = JSONPData[entry].m_value.get();
if (JSONPPath.size() == 1 && JSONPPath[0].m_type == JSONPPathEntryTypeDeclare) {
if (globalObject->hasProperty(callFrame, JSONPPath[0].m_pathEntryName)) {
PutPropertySlot slot;
globalObject->methodTable()->put(globalObject, callFrame, JSONPPath[0].m_pathEntryName, JSONPValue, slot);
} else
globalObject->methodTable()->putDirectVirtual(globalObject, callFrame, JSONPPath[0].m_pathEntryName, JSONPValue, DontEnum | DontDelete);
// var declarations return undefined
// if (globalObject->hasProperty(callFrame, JSONPPath[0].m_pathEntryName)) {
// PutPropertySlot slot;
// globalObject->methodTable()->put(globalObject, callFrame, JSONPPath[0].m_pathEntryName, JSONPValue, slot);
// } else {
// PropertyDescriptor desc(JSONPValue, DontEnum | DontDelete);
// globalObject->methodTable()->defineOwnProperty(globalObject, callFrame, JSONPPath[0].m_pathEntryName, desc, false);
// }
globalObject->addRegisters(1);
globalObject->addVar(callFrame, JSONPPath[0].m_pathEntryName);
PutPropertySlot slot;
globalObject->methodTable()->put(globalObject, callFrame, JSONPPath[0].m_pathEntryName, JSONPValue, slot);
result = jsUndefined();
continue;
}
......
......@@ -89,9 +89,6 @@ struct MethodTable {
typedef bool (*CustomHasInstanceFunctionPtr)(JSObject*, ExecState*, JSValue);
CustomHasInstanceFunctionPtr customHasInstance;
typedef void (*PutWithAttributesFunctionPtr)(JSObject*, ExecState*, PropertyName propertyName, JSValue, unsigned attributes);
PutWithAttributesFunctionPtr putDirectVirtual;
typedef bool (*DefineOwnPropertyFunctionPtr)(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool);
DefineOwnPropertyFunctionPtr defineOwnProperty;
......@@ -140,7 +137,6 @@ struct MethodTable {
&ClassName::getPropertyNames, \
&ClassName::className, \
&ClassName::customHasInstance, \
&ClassName::putDirectVirtual, \
&ClassName::defineOwnProperty, \
&ClassName::slowDownAndWasteMemory, \
&ClassName::getTypedArrayImpl \
......
......@@ -193,22 +193,6 @@ void JSActivation::put(JSCell* cell, ExecState* exec, PropertyName propertyName,
thisObject->putOwnDataProperty(exec->vm(), propertyName, value, slot);
}
// FIXME: Make this function honor ReadOnly (const) and DontEnum
void JSActivation::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName propertyName, JSValue value, unsigned attributes)
{
JSActivation* thisObject = jsCast<JSActivation*>(object);
ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(thisObject));
if (thisObject->symbolTablePutWithAttributes(exec->vm(), propertyName, value, attributes))
return;
// We don't call through to JSObject because __proto__ and getter/setter
// properties are non-standard extensions that other implementations do not
// expose in the activation object.
ASSERT(!thisObject->hasGetterSetterProperties());
JSObject::putDirectVirtual(thisObject, exec, propertyName, value, attributes);
}
bool JSActivation::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
{
if (propertyName == exec->propertyNames().arguments)
......
......@@ -67,7 +67,6 @@ namespace JSC {
static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes);
static bool deleteProperty(JSCell*, ExecState*, PropertyName);
static JSValue toThis(JSCell*, ExecState*, ECMAMode);
......
......@@ -207,11 +207,6 @@ bool JSCell::customHasInstance(JSObject*, ExecState*, JSValue)
return false;
}
void JSCell::putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned)
{
RELEASE_ASSERT_NOT_REACHED();
}
bool JSCell::defineOwnProperty(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool)
{
RELEASE_ASSERT_NOT_REACHED();
......
......@@ -163,7 +163,6 @@ protected:
static NO_RETURN_DUE_TO_CRASH void getPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
static String className(const JSObject*);
JS_EXPORT_PRIVATE static bool customHasInstance(JSObject*, ExecState*, JSValue);
static NO_RETURN_DUE_TO_CRASH void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes);
static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool shouldThrow);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static bool getOwnPropertySlotByIndex(JSObject*, ExecState*, unsigned propertyName, PropertySlot&);
......
......@@ -168,24 +168,6 @@ void JSGlobalObject::put(JSCell* cell, ExecState* exec, PropertyName propertyNam
Base::put(thisObject, exec, propertyName, value, slot);
}
void JSGlobalObject::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName propertyName, JSValue value, unsigned attributes)
{
JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object);
ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(thisObject));
if (symbolTablePutWithAttributes(thisObject, exec->vm(), propertyName, value, attributes))
return;
JSValue valueBefore = thisObject->getDirect(exec->vm(), propertyName);
PutPropertySlot slot;
Base::put(thisObject, exec, propertyName, value, slot);
if (!valueBefore) {
JSValue valueAfter = thisObject->getDirect(exec->vm(), propertyName);
if (valueAfter)
JSObject::putDirectVirtual(thisObject, exec, propertyName, valueAfter, attributes);
}
}
bool JSGlobalObject::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool shouldThrow)
{
JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object);
......
......@@ -255,8 +255,6 @@ public:
bool hasOwnPropertyForWrite(ExecState*, PropertyName);
JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
JS_EXPORT_PRIVATE static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes);
JS_EXPORT_PRIVATE static void defineGetter(JSObject*, ExecState*, PropertyName, JSObject* getterFunc, unsigned attributes);
JS_EXPORT_PRIVATE static void defineSetter(JSObject*, ExecState*, PropertyName, JSObject* setterFunc, unsigned attributes);
JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool shouldThrow);
......
......@@ -1127,13 +1127,6 @@ void JSObject::switchToSlowPutArrayStorage(VM& vm)
}
}
void JSObject::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName propertyName, JSValue value, unsigned attributes)
{
ASSERT(!value.isGetterSetter() && !(attributes & Accessor));
PutPropertySlot slot;
object->putDirectInternal<PutModeDefineOwnProperty>(exec->vm(), propertyName, value, attributes, slot, getCallableObject(value));
}
void JSObject::setPrototype(VM& vm, JSValue prototype)
{
ASSERT(prototype);
......
......@@ -456,7 +456,6 @@ public:
// - accessors are not called.
// - attributes will be respected (after the call the property will exist with the given attributes)
// - the property name is assumed to not be an index.
JS_EXPORT_PRIVATE static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes);
void putDirect(VM&, PropertyName, JSValue, unsigned attributes = 0);
void putDirect(VM&, PropertyName, JSValue, PutPropertySlot&);
void putDirectWithoutTransition(VM&, PropertyName, JSValue, unsigned attributes = 0);
......
......@@ -94,12 +94,6 @@ void JSProxy::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, J
thisObject->target()->methodTable()->putByIndex(thisObject->target(), exec, propertyName, value, shouldThrow);
}
void JSProxy::putDirectVirtual(JSObject* object, ExecState* exec, PropertyName propertyName, JSValue value, unsigned attributes)
{
JSProxy* thisObject = jsCast<JSProxy*>(object);
thisObject->target()->putDirectVirtual(thisObject->target(), exec, propertyName, value, attributes);
}
bool JSProxy::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, const PropertyDescriptor& descriptor, bool shouldThrow)
{
JSProxy* thisObject = jsCast<JSProxy*>(object);
......
......@@ -78,7 +78,6 @@ protected:
JS_EXPORT_PRIVATE static bool getOwnPropertySlotByIndex(JSObject*, ExecState*, unsigned, PropertySlot&);
JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
JS_EXPORT_PRIVATE static void putByIndex(JSCell*, ExecState*, unsigned, JSValue, bool shouldThrow);
JS_EXPORT_PRIVATE static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes);
JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, PropertyName);
JS_EXPORT_PRIVATE static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned);
JS_EXPORT_PRIVATE static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
......
......@@ -72,9 +72,4 @@ void JSSymbolTableObject::getOwnNonIndexPropertyNames(JSObject* object, ExecStat
JSObject::getOwnNonIndexPropertyNames(thisObject, exec, propertyNames, mode);
}
void JSSymbolTableObject::putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned)
{
RELEASE_ASSERT_NOT_REACHED();
}
} // namespace JSC
......@@ -41,8 +41,6 @@ public:
SharedSymbolTable* symbolTable() const { return m_symbolTable.get(); }
static NO_RETURN_DUE_TO_CRASH void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes);
JS_EXPORT_PRIVATE static bool deleteProperty(JSCell*, ExecState*, PropertyName);
JS_EXPORT_PRIVATE static void getOwnNonIndexPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
......
......@@ -41,6 +41,14 @@ namespace JSC {
, m_seenAttributes(0)
{
}
PropertyDescriptor(JSValue value, unsigned attributes)
: m_value(value)
, m_attributes(attributes)
, m_seenAttributes(EnumerablePresent | ConfigurablePresent | WritablePresent)
{
ASSERT(m_value);
ASSERT(!m_value.isGetterSetter());
}
JS_EXPORT_PRIVATE bool writable() const;
JS_EXPORT_PRIVATE bool enumerable() const;
JS_EXPORT_PRIVATE bool configurable() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment