Changeset 207036 in webkit
- Timestamp:
- Oct 10, 2016 5:45:45 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r207023 r207036 1 2016-10-10 Mark Lam <mark.lam@apple.com> 2 3 Change ArrayPrototype.cpp's putLength() and setLength() to take a VM& so that we can use vm.propertyNames. 4 https://bugs.webkit.org/show_bug.cgi?id=163260 5 6 Reviewed by Saam Barati. 7 8 In all cases where we call these, we already have the VM& anyway. 9 10 * runtime/ArrayPrototype.cpp: 11 (JSC::putLength): 12 (JSC::setLength): 13 (JSC::arrayProtoFuncPop): 14 (JSC::arrayProtoFuncPush): 15 (JSC::arrayProtoFuncShift): 16 (JSC::arrayProtoFuncSlice): 17 (JSC::arrayProtoFuncSplice): 18 (JSC::arrayProtoFuncUnShift): 19 1 20 2016-10-10 Mark Lam <mark.lam@apple.com> 2 21 -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r206386 r207036 164 164 } 165 165 166 static ALWAYS_INLINE void putLength(ExecState* exec, JSObject* obj, JSValue value)166 static ALWAYS_INLINE void putLength(ExecState* exec, VM& vm, JSObject* obj, JSValue value) 167 167 { 168 168 PutPropertySlot slot(obj); 169 obj->methodTable()->put(obj, exec, exec->propertyNames().length, value, slot);170 } 171 172 static ALWAYS_INLINE void setLength(ExecState* exec, JSObject* obj, unsigned value)169 obj->methodTable()->put(obj, exec, vm.propertyNames->length, value, slot); 170 } 171 172 static ALWAYS_INLINE void setLength(ExecState* exec, VM& vm, JSObject* obj, unsigned value) 173 173 { 174 174 if (isJSArray(obj)) 175 175 jsCast<JSArray*>(obj)->setLength(exec, value); 176 putLength(exec, obj, jsNumber(value));176 putLength(exec, vm, obj, jsNumber(value)); 177 177 } 178 178 … … 680 680 JSValue result; 681 681 if (length == 0) { 682 putLength(exec, thisObj, jsNumber(length));682 putLength(exec, vm, thisObj, jsNumber(length)); 683 683 result = jsUndefined(); 684 684 } else { … … 689 689 return JSValue::encode(jsUndefined()); 690 690 } 691 putLength(exec, thisObj, jsNumber(length - 1));691 putLength(exec, vm, thisObj, jsNumber(length - 1)); 692 692 } 693 693 return JSValue::encode(result); … … 725 725 726 726 JSValue newLength(static_cast<int64_t>(length) + static_cast<int64_t>(exec->argumentCount())); 727 putLength(exec, thisObj, newLength);727 putLength(exec, vm, thisObj, newLength); 728 728 return JSValue::encode(newLength); 729 729 } … … 827 827 JSValue result; 828 828 if (length == 0) { 829 putLength(exec, thisObj, jsNumber(length));829 putLength(exec, vm, thisObj, jsNumber(length)); 830 830 result = jsUndefined(); 831 831 } else { … … 833 833 shift<JSArray::ShiftCountForShift>(exec, thisObj, 0, 1, 0, length); 834 834 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 835 putLength(exec, thisObj, jsNumber(length - 1));835 putLength(exec, vm, thisObj, jsNumber(length - 1)); 836 836 } 837 837 return JSValue::encode(result); … … 877 877 result->putDirectIndex(exec, n, v); 878 878 } 879 setLength(exec, result, n);879 setLength(exec, vm, result, n); 880 880 return JSValue::encode(result); 881 881 } … … 907 907 } 908 908 909 setLength(exec, result, 0);910 setLength(exec, thisObj, length);909 setLength(exec, vm, result, 0); 910 setLength(exec, vm, thisObj, length); 911 911 return JSValue::encode(result); 912 912 } … … 973 973 } 974 974 975 setLength(exec, thisObj, length - deleteCount + additionalArgs);975 setLength(exec, vm, thisObj, length - deleteCount + additionalArgs); 976 976 return JSValue::encode(result); 977 977 } … … 999 999 } 1000 1000 JSValue result = jsNumber(length + nrArgs); 1001 putLength(exec, thisObj, result);1001 putLength(exec, vm, thisObj, result); 1002 1002 return JSValue::encode(result); 1003 1003 }
Note: See TracChangeset
for help on using the changeset viewer.