Changeset 128706 in webkit
- Timestamp:
- Sep 16, 2012 12:22:46 AM (12 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r128705 r128706 1 2012-09-16 Filip Pizlo <fpizlo@apple.com> 2 3 JSObject.cpp and JSArray.cpp have inconsistent tests for the invalid array index case 4 https://bugs.webkit.org/show_bug.cgi?id=96878 5 6 Reviewed by Sam Weinig. 7 8 Removed the uses of UNLIKELY() because I don't believe they are buying us anything, 9 since we're already on the slow path. Also found other places where we're testing for 10 the invalid array index case using unusual predicates rather than just using 11 MAX_ARRAY_INDEX. With this change, I believe that all of our tests for invalid 12 array indices (i.e. indices that should be treated as non-indexed properties) 13 uniformly use MAX_ARRAY_INDEX and PropertyName::NotAnIndex. 14 15 * runtime/JSArray.cpp: 16 (JSC::JSArray::push): 17 * runtime/JSObject.cpp: 18 (JSC::JSObject::putByIndex): 19 (JSC::JSObject::defineOwnIndexedProperty): 20 1 21 2012-09-15 Filip Pizlo <fpizlo@apple.com> 2 22 -
trunk/Source/JavaScriptCore/runtime/JSArray.cpp
r128680 r128706 478 478 } 479 479 480 // Pushing to an array of length 2^32-1stores the property, but throws a range error.481 if ( UNLIKELY(storage->length() == 0xFFFFFFFFu)) {480 // Pushing to an array of invalid length (2^31-1) stores the property, but throws a range error. 481 if (storage->length() > MAX_ARRAY_INDEX) { 482 482 methodTable()->putByIndex(this, exec, storage->length(), value, true); 483 483 // Per ES5.1 15.4.4.7 step 6 & 15.4.5.1 step 3.d. -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r128705 r128706 348 348 thisObject->checkIndexingConsistency(); 349 349 350 if ( UNLIKELY(propertyName > MAX_ARRAY_INDEX)) {350 if (propertyName > MAX_ARRAY_INDEX) { 351 351 PutPropertySlot slot(shouldThrow); 352 352 thisObject->methodTable()->put(thisObject, exec, Identifier::from(exec, propertyName), value, slot); … … 981 981 bool JSObject::defineOwnIndexedProperty(ExecState* exec, unsigned index, PropertyDescriptor& descriptor, bool throwException) 982 982 { 983 ASSERT(index != 0xFFFFFFFF);983 ASSERT(index <= MAX_ARRAY_INDEX); 984 984 985 985 if (!inSparseIndexingMode()) {
Note: See TracChangeset
for help on using the changeset viewer.