JSDOMWindow::put should not do the same thing twice
authorbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Feb 2016 19:04:11 +0000 (19:04 +0000)
committerbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Feb 2016 19:04:11 +0000 (19:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=154334

Reviewed by Chris Dumez.

It either calls JSGlobalObject::put or Base::put. Hint: these are basically the same thing.
In the latter case it might call lookupPut. That's redundant; JSObject::put handles static
table entries.

Source/JavaScriptCore:

* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::hasOwnPropertyForWrite): Deleted.
    - no longer needed.

Source/WebCore:

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::put):
    - just call Base::put.
(WebCore::JSDOMWindow::putByIndex):
    - just call Base::putByIndex.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196702 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/JSGlobalObject.h
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSDOMWindowCustom.cpp

index 5ec31a9..52c7c32 100644 (file)
@@ -1,3 +1,18 @@
+2016-02-17  Gavin Barraclough  <barraclough@apple.com>
+
+        JSDOMWindow::put should not do the same thing twice
+        https://bugs.webkit.org/show_bug.cgi?id=154334
+
+        Reviewed by Chris Dumez.
+
+        It either calls JSGlobalObject::put or Base::put. Hint: these are basically the same thing.
+        In the latter case it might call lookupPut. That's redundant; JSObject::put handles static
+        table entries.
+
+        * runtime/JSGlobalObject.h:
+        (JSC::JSGlobalObject::hasOwnPropertyForWrite): Deleted.
+            - no longer needed.
+
 2016-02-16  Filip Pizlo  <fpizlo@apple.com>
 
         FTL_USES_B3 should be unconditionally true
index 421b5ba..b87a270 100644 (file)
@@ -396,7 +396,6 @@ public:
     JS_EXPORT_PRIVATE static void visitChildren(JSCell*, SlotVisitor&);
 
     JS_EXPORT_PRIVATE static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
-    bool hasOwnPropertyForWrite(ExecState*, PropertyName);
     JS_EXPORT_PRIVATE static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
 
     JS_EXPORT_PRIVATE static void defineGetter(JSObject*, ExecState*, PropertyName, JSObject* getterFunc, unsigned attributes);
@@ -717,15 +716,6 @@ inline JSGlobalObject* asGlobalObject(JSValue value)
     return jsCast<JSGlobalObject*>(asObject(value));
 }
 
-inline bool JSGlobalObject::hasOwnPropertyForWrite(ExecState* exec, PropertyName propertyName)
-{
-    PropertySlot slot(this);
-    if (Base::getOwnPropertySlot(this, exec, propertyName, slot))
-        return true;
-    bool slotIsWriteable;
-    return symbolTableGet(this, propertyName, slot, slotIsWriteable);
-}
-
 inline JSArray* constructEmptyArray(ExecState* exec, ArrayAllocationProfile* profile, JSGlobalObject* globalObject, unsigned initialLength = 0, JSValue newTarget = JSValue())
 {
     Structure* structure;
index d14c43d..3395397 100644 (file)
@@ -1,3 +1,20 @@
+2016-02-17  Gavin Barraclough  <barraclough@apple.com>
+
+        JSDOMWindow::put should not do the same thing twice
+        https://bugs.webkit.org/show_bug.cgi?id=154334
+
+        Reviewed by Chris Dumez.
+
+        It either calls JSGlobalObject::put or Base::put. Hint: these are basically the same thing.
+        In the latter case it might call lookupPut. That's redundant; JSObject::put handles static
+        table entries.
+
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::put):
+            - just call Base::put.
+        (WebCore::JSDOMWindow::putByIndex):
+            - just call Base::putByIndex.
+
 2016-02-17  Nan Wang  <n_wang@apple.com>
 
         AX: Implement sentence related text marker functions using TextIterator
index 84473ca..441f4df 100644 (file)
@@ -356,17 +356,6 @@ void JSDOMWindow::put(JSCell* cell, ExecState* exec, PropertyName propertyName,
         return;
     }
 
-    // Optimization: access JavaScript global variables directly before involving the DOM.
-    if (thisObject->JSGlobalObject::hasOwnPropertyForWrite(exec, propertyName)) {
-        JSGlobalObject::put(thisObject, exec, propertyName, value, slot);
-        return;
-    }
-
-    if (!thisObject->staticFunctionsReified()) {
-        if (lookupPut(exec, propertyName, thisObject, value, *s_info.staticPropHashTable, slot))
-            return;
-    }
-
     Base::put(thisObject, exec, propertyName, value, slot);
 }
 
@@ -376,12 +365,6 @@ void JSDOMWindow::putByIndex(JSCell* cell, ExecState* exec, unsigned index, JSVa
     if (!thisObject->wrapped().frame() || !BindingSecurity::shouldAllowAccessToDOMWindow(exec, thisObject->wrapped()))
         return;
     
-    // Optimization: access JavaScript global variables directly before involving the DOM.
-    if (thisObject->JSGlobalObject::hasOwnPropertyForWrite(exec, Identifier::from(exec, index))) {
-        JSGlobalObject::putByIndex(thisObject, exec, index, value, shouldThrow);
-        return;
-    }
-    
     Base::putByIndex(thisObject, exec, index, value, shouldThrow);
 }