Title: [207036] trunk/Source/_javascript_Core
Revision
207036
Author
[email protected]
Date
2016-10-10 17:45:45 -0700 (Mon, 10 Oct 2016)

Log Message

Change ArrayPrototype.cpp's putLength() and setLength() to take a VM& so that we can use vm.propertyNames.
https://bugs.webkit.org/show_bug.cgi?id=163260

Reviewed by Saam Barati.

In all cases where we call these, we already have the VM& anyway.

* runtime/ArrayPrototype.cpp:
(JSC::putLength):
(JSC::setLength):
(JSC::arrayProtoFuncPop):
(JSC::arrayProtoFuncPush):
(JSC::arrayProtoFuncShift):
(JSC::arrayProtoFuncSlice):
(JSC::arrayProtoFuncSplice):
(JSC::arrayProtoFuncUnShift):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (207035 => 207036)


--- trunk/Source/_javascript_Core/ChangeLog	2016-10-11 00:11:40 UTC (rev 207035)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-10-11 00:45:45 UTC (rev 207036)
@@ -1,5 +1,24 @@
 2016-10-10  Mark Lam  <[email protected]>
 
+        Change ArrayPrototype.cpp's putLength() and setLength() to take a VM& so that we can use vm.propertyNames.
+        https://bugs.webkit.org/show_bug.cgi?id=163260
+
+        Reviewed by Saam Barati.
+
+        In all cases where we call these, we already have the VM& anyway.
+
+        * runtime/ArrayPrototype.cpp:
+        (JSC::putLength):
+        (JSC::setLength):
+        (JSC::arrayProtoFuncPop):
+        (JSC::arrayProtoFuncPush):
+        (JSC::arrayProtoFuncShift):
+        (JSC::arrayProtoFuncSlice):
+        (JSC::arrayProtoFuncSplice):
+        (JSC::arrayProtoFuncUnShift):
+
+2016-10-10  Mark Lam  <[email protected]>
+
         Rename the StrictModeReadonlyPropertyWriteError string to ReadonlyPropertyWriteError.
         https://bugs.webkit.org/show_bug.cgi?id=163239
 

Modified: trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp (207035 => 207036)


--- trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2016-10-11 00:11:40 UTC (rev 207035)
+++ trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp	2016-10-11 00:45:45 UTC (rev 207036)
@@ -163,17 +163,17 @@
     return slot.getValue(exec, index);
 }
 
-static ALWAYS_INLINE void putLength(ExecState* exec, JSObject* obj, JSValue value)
+static ALWAYS_INLINE void putLength(ExecState* exec, VM& vm, JSObject* obj, JSValue value)
 {
     PutPropertySlot slot(obj);
-    obj->methodTable()->put(obj, exec, exec->propertyNames().length, value, slot);
+    obj->methodTable()->put(obj, exec, vm.propertyNames->length, value, slot);
 }
 
-static ALWAYS_INLINE void setLength(ExecState* exec, JSObject* obj, unsigned value)
+static ALWAYS_INLINE void setLength(ExecState* exec, VM& vm, JSObject* obj, unsigned value)
 {
     if (isJSArray(obj))
         jsCast<JSArray*>(obj)->setLength(exec, value);
-    putLength(exec, obj, jsNumber(value));
+    putLength(exec, vm, obj, jsNumber(value));
 }
 
 inline bool speciesWatchpointsValid(ExecState* exec, JSObject* thisObject)
@@ -679,7 +679,7 @@
 
     JSValue result;
     if (length == 0) {
-        putLength(exec, thisObj, jsNumber(length));
+        putLength(exec, vm, thisObj, jsNumber(length));
         result = jsUndefined();
     } else {
         result = thisObj->get(exec, length - 1);
@@ -688,7 +688,7 @@
             throwTypeError(exec, scope, ASCIILiteral("Unable to delete property."));
             return JSValue::encode(jsUndefined());
         }
-        putLength(exec, thisObj, jsNumber(length - 1));
+        putLength(exec, vm, thisObj, jsNumber(length - 1));
     }
     return JSValue::encode(result);
 }
@@ -724,7 +724,7 @@
     }
     
     JSValue newLength(static_cast<int64_t>(length) + static_cast<int64_t>(exec->argumentCount()));
-    putLength(exec, thisObj, newLength);
+    putLength(exec, vm, thisObj, newLength);
     return JSValue::encode(newLength);
 }
 
@@ -826,13 +826,13 @@
 
     JSValue result;
     if (length == 0) {
-        putLength(exec, thisObj, jsNumber(length));
+        putLength(exec, vm, thisObj, jsNumber(length));
         result = jsUndefined();
     } else {
         result = thisObj->getIndex(exec, 0);
         shift<JSArray::ShiftCountForShift>(exec, thisObj, 0, 1, 0, length);
         RETURN_IF_EXCEPTION(scope, encodedJSValue());
-        putLength(exec, thisObj, jsNumber(length - 1));
+        putLength(exec, vm, thisObj, jsNumber(length - 1));
     }
     return JSValue::encode(result);
 }
@@ -876,7 +876,7 @@
         if (v)
             result->putDirectIndex(exec, n, v);
     }
-    setLength(exec, result, n);
+    setLength(exec, vm, result, n);
     return JSValue::encode(result);
 }
 
@@ -906,8 +906,8 @@
             RETURN_IF_EXCEPTION(scope, encodedJSValue());
         }
 
-        setLength(exec, result, 0);
-        setLength(exec, thisObj, length);
+        setLength(exec, vm, result, 0);
+        setLength(exec, vm, thisObj, length);
         return JSValue::encode(result);
     }
 
@@ -972,7 +972,7 @@
         RETURN_IF_EXCEPTION(scope, encodedJSValue());
     }
     
-    setLength(exec, thisObj, length - deleteCount + additionalArgs);
+    setLength(exec, vm, thisObj, length - deleteCount + additionalArgs);
     return JSValue::encode(result);
 }
 
@@ -998,7 +998,7 @@
         RETURN_IF_EXCEPTION(scope, encodedJSValue());
     }
     JSValue result = jsNumber(length + nrArgs);
-    putLength(exec, thisObj, result);
+    putLength(exec, vm, thisObj, result);
     return JSValue::encode(result);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to