Changeset 185904 in webkit
- Timestamp:
- Jun 24, 2015, 1:14:14 AM (10 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r185902 r185904 1 2015-06-24 Darin Adler <darin@apple.com> 2 3 Fix Array.concat with RuntimeArray (regression from my last patch) 4 5 * runtime/ArrayPrototype.cpp: 6 (JSC::arrayProtoFuncConcat): Use getLength instead of JSArray::length. 7 8 * runtime/JSArray.cpp: 9 (JSC::JSArray::defineOwnProperty): Added comment about use of 10 JSArray::length here that is incorrect (in a really non-obvious way). 11 (JSC::JSArray::fillArgList): Ditto. 12 (JSC::JSArray::copyToArguments): Ditto. 13 14 * runtime/JSArray.h: Added a comment explaining that it is not always 15 safe to use JSArray::length. 16 1 17 2015-06-23 Mark Lam <mark.lam@apple.com> 2 18 -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r185899 r185904 202 202 if (isJSArray(thisObj)) { 203 203 JSArray* array = asArray(thisObj); 204 if (array->length() == length && a sArray(thisObj)->shiftCount<shiftCountMode>(exec, header, count))204 if (array->length() == length && array->shiftCount<shiftCountMode>(exec, header, count)) 205 205 return; 206 206 } … … 291 291 ASSERT(isJSArray(thisValue)); 292 292 JSArray* thisArray = asArray(thisValue); 293 293 294 294 unsigned length = thisArray->length(); 295 295 … … 415 415 416 416 for (unsigned i = 0; ; ++i) { 417 if (JSArray* currentArray = jsDynamicCast<JSArray*>(curArg)) 418 finalArraySize += currentArray->length(); 419 else 417 if (JSArray* currentArray = jsDynamicCast<JSArray*>(curArg)) { 418 // Can't use JSArray::length here because this might be a RuntimeArray! 419 finalArraySize += getLength(exec, currentArray); 420 if (exec->hadException()) 421 return JSValue::encode(jsUndefined()); 422 } else 420 423 ++finalArraySize; 421 424 if (i == argCount) … … 435 438 for (unsigned i = 0; ; ++i) { 436 439 if (JSArray* currentArray = jsDynamicCast<JSArray*>(curArg)) { 437 unsigned length = currentArray->length(); 440 // Can't use JSArray::length here because this might be a RuntimeArray! 441 unsigned length = getLength(exec, currentArray); 438 442 if (exec->hadException()) 439 443 return JSValue::encode(jsUndefined()); -
trunk/Source/JavaScriptCore/runtime/JSArray.cpp
r185773 r185904 112 112 113 113 // Based on SameValue check in 8.12.9, this is always okay. 114 // FIXME: Nothing prevents this from being called on a RuntimeArray, and the length function will always return 0 in that case. 114 115 if (newLen == array->length()) { 115 116 if (descriptor.writablePresent()) … … 161 162 // b. Reject if index >= oldLen and oldLenDesc.[[Writable]] is false. 162 163 uint32_t index = optionalIndex.value(); 164 // FIXME: Nothing prevents this from being called on a RuntimeArray, and the length function will always return 0 in that case. 163 165 if (index >= array->length() && !array->isLengthWritable()) 164 166 return reject(exec, throwException, "Attempting to define numeric property on array with non-writable length property."); … … 1091 1093 args.append(v.get()); 1092 1094 } 1093 1095 1096 // FIXME: What prevents this from being called with a RuntimeArray? The length function will always return 0 in that case. 1094 1097 for (; i < length(); ++i) 1095 1098 args.append(get(exec, i)); … … 1102 1105 unsigned vectorEnd; 1103 1106 length += offset; // We like to think of the length as being our length, rather than the output length. 1107 1108 // FIXME: What prevents this from being called with a RuntimeArray? The length function will always return 0 in that case. 1104 1109 ASSERT(length == this->length()); 1110 1105 1111 switch (indexingType()) { 1106 1112 case ArrayClass: -
trunk/Source/JavaScriptCore/runtime/JSArray.h
r185597 r185904 67 67 68 68 DECLARE_EXPORT_INFO; 69 69 70 // OK if we know this is a JSArray, but not if it could be an object of a derived class; for RuntimeArray this always returns 0. 70 71 unsigned length() const { return getArrayLength(); } 71 // OK to use on new arrays, but not if it might be a RegExpMatchArray. 72 73 // OK to use on new arrays, but not if it might be a RegExpMatchArray or RuntimeArray. 72 74 JS_EXPORT_PRIVATE bool setLength(ExecState*, unsigned, bool throwException = false); 73 75
Note:
See TracChangeset
for help on using the changeset viewer.