Title: [154459] trunk/Source/_javascript_Core
Revision
154459
Author
[email protected]
Date
2013-08-22 13:35:09 -0700 (Thu, 22 Aug 2013)

Log Message

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

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSObjectRef.cpp (154458 => 154459)


--- trunk/Source/_javascript_Core/API/JSObjectRef.cpp	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/API/JSObjectRef.cpp	2013-08-22 20:35:09 UTC (rev 154459)
@@ -327,9 +327,10 @@
     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);
     }

Modified: trunk/Source/_javascript_Core/ChangeLog (154458 => 154459)


--- trunk/Source/_javascript_Core/ChangeLog	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-08-22 20:35:09 UTC (rev 154459)
@@ -1,3 +1,40 @@
+2013-08-21  Gavin Barraclough  <[email protected]>
+
+        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  <[email protected]>
 
         errorDescriptionForValue() should not assume error value is an Object

Modified: trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp (154458 => 154459)


--- trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp	2013-08-22 20:35:09 UTC (rev 154459)
@@ -77,12 +77,6 @@
     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);

Modified: trunk/Source/_javascript_Core/debugger/DebuggerActivation.h (154458 => 154459)


--- trunk/Source/_javascript_Core/debugger/DebuggerActivation.h	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/debugger/DebuggerActivation.h	2013-08-22 20:35:09 UTC (rev 154459)
@@ -45,7 +45,6 @@
         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);

Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (154458 => 154459)


--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2013-08-22 20:35:09 UTC (rev 154459)
@@ -735,12 +735,17 @@
             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;
             }

Modified: trunk/Source/_javascript_Core/runtime/ClassInfo.h (154458 => 154459)


--- trunk/Source/_javascript_Core/runtime/ClassInfo.h	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/runtime/ClassInfo.h	2013-08-22 20:35:09 UTC (rev 154459)
@@ -89,9 +89,6 @@
     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 @@
         &ClassName::getPropertyNames, \
         &ClassName::className, \
         &ClassName::customHasInstance, \
-        &ClassName::putDirectVirtual, \
         &ClassName::defineOwnProperty, \
         &ClassName::slowDownAndWasteMemory, \
         &ClassName::getTypedArrayImpl \

Modified: trunk/Source/_javascript_Core/runtime/JSActivation.cpp (154458 => 154459)


--- trunk/Source/_javascript_Core/runtime/JSActivation.cpp	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/runtime/JSActivation.cpp	2013-08-22 20:35:09 UTC (rev 154459)
@@ -193,22 +193,6 @@
     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)

Modified: trunk/Source/_javascript_Core/runtime/JSActivation.h (154458 => 154459)


--- trunk/Source/_javascript_Core/runtime/JSActivation.h	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/runtime/JSActivation.h	2013-08-22 20:35:09 UTC (rev 154459)
@@ -67,7 +67,6 @@
 
         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);

Modified: trunk/Source/_javascript_Core/runtime/JSCell.cpp (154458 => 154459)


--- trunk/Source/_javascript_Core/runtime/JSCell.cpp	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/runtime/JSCell.cpp	2013-08-22 20:35:09 UTC (rev 154459)
@@ -207,11 +207,6 @@
     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();

Modified: trunk/Source/_javascript_Core/runtime/JSCell.h (154458 => 154459)


--- trunk/Source/_javascript_Core/runtime/JSCell.h	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/runtime/JSCell.h	2013-08-22 20:35:09 UTC (rev 154459)
@@ -163,7 +163,6 @@
     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&);

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (154458 => 154459)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2013-08-22 20:35:09 UTC (rev 154459)
@@ -168,24 +168,6 @@
     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);

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (154458 => 154459)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h	2013-08-22 20:35:09 UTC (rev 154459)
@@ -255,8 +255,6 @@
     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);

Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (154458 => 154459)


--- trunk/Source/_javascript_Core/runtime/JSObject.cpp	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp	2013-08-22 20:35:09 UTC (rev 154459)
@@ -1127,13 +1127,6 @@
     }
 }
 
-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);

Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (154458 => 154459)


--- trunk/Source/_javascript_Core/runtime/JSObject.h	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h	2013-08-22 20:35:09 UTC (rev 154459)
@@ -456,7 +456,6 @@
     //  - 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);

Modified: trunk/Source/_javascript_Core/runtime/JSProxy.cpp (154458 => 154459)


--- trunk/Source/_javascript_Core/runtime/JSProxy.cpp	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/runtime/JSProxy.cpp	2013-08-22 20:35:09 UTC (rev 154459)
@@ -94,12 +94,6 @@
     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);

Modified: trunk/Source/_javascript_Core/runtime/JSProxy.h (154458 => 154459)


--- trunk/Source/_javascript_Core/runtime/JSProxy.h	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/runtime/JSProxy.h	2013-08-22 20:35:09 UTC (rev 154459)
@@ -78,7 +78,6 @@
     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);

Modified: trunk/Source/_javascript_Core/runtime/JSSymbolTableObject.cpp (154458 => 154459)


--- trunk/Source/_javascript_Core/runtime/JSSymbolTableObject.cpp	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/runtime/JSSymbolTableObject.cpp	2013-08-22 20:35:09 UTC (rev 154459)
@@ -72,9 +72,4 @@
     JSObject::getOwnNonIndexPropertyNames(thisObject, exec, propertyNames, mode);
 }
 
-void JSSymbolTableObject::putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned)
-{
-    RELEASE_ASSERT_NOT_REACHED();
-}
-
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/JSSymbolTableObject.h (154458 => 154459)


--- trunk/Source/_javascript_Core/runtime/JSSymbolTableObject.h	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/runtime/JSSymbolTableObject.h	2013-08-22 20:35:09 UTC (rev 154459)
@@ -41,8 +41,6 @@
     
     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);
     

Modified: trunk/Source/_javascript_Core/runtime/PropertyDescriptor.h (154458 => 154459)


--- trunk/Source/_javascript_Core/runtime/PropertyDescriptor.h	2013-08-22 20:27:27 UTC (rev 154458)
+++ trunk/Source/_javascript_Core/runtime/PropertyDescriptor.h	2013-08-22 20:35:09 UTC (rev 154459)
@@ -41,6 +41,14 @@
             , 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;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to