Changeset 182406 in webkit for trunk/Source/JavaScriptCore/runtime/JSObject.cpp
- Timestamp:
- Apr 6, 2015, 5:40:33 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r182280 r182406 380 380 // Try indexed put first. This is required for correctness, since loads on property names that appear like 381 381 // valid indices will never look in the named property storage. 382 unsigned i = propertyName.asIndex(); 383 if (i != PropertyName::NotAnIndex) { 384 putByIndex(thisObject, exec, i, value, slot.isStrictMode()); 382 if (Optional<uint32_t> index = parseIndex(propertyName)) { 383 putByIndex(thisObject, exec, index.value(), value, slot.isStrictMode()); 385 384 return; 386 385 } … … 1239 1238 ASSERT(value.isGetterSetter() && (attributes & Accessor)); 1240 1239 1241 unsigned index = propertyName.asIndex(); 1242 if (index != PropertyName::NotAnIndex) { 1243 putDirectIndex(exec, index, value, attributes, PutDirectIndexLikePutDirect); 1240 if (Optional<uint32_t> index = parseIndex(propertyName)) { 1241 putDirectIndex(exec, index.value(), value, attributes, PutDirectIndexLikePutDirect); 1244 1242 return; 1245 1243 } … … 1250 1248 void JSObject::putDirectCustomAccessor(VM& vm, PropertyName propertyName, JSValue value, unsigned attributes) 1251 1249 { 1252 ASSERT( propertyName.asIndex() == PropertyName::NotAnIndex);1250 ASSERT(!parseIndex(propertyName)); 1253 1251 1254 1252 PutPropertySlot slot(this); … … 1298 1296 JSObject* thisObject = jsCast<JSObject*>(cell); 1299 1297 1300 unsigned i = propertyName.asIndex(); 1301 if (i != PropertyName::NotAnIndex) 1302 return thisObject->methodTable(exec->vm())->deletePropertyByIndex(thisObject, exec, i); 1298 if (Optional<uint32_t> index = parseIndex(propertyName)) 1299 return thisObject->methodTable(exec->vm())->deletePropertyByIndex(thisObject, exec, index.value()); 1303 1300 1304 1301 if (!thisObject->staticFunctionsReified()) … … 2553 2550 void JSObject::putDirectMayBeIndex(ExecState* exec, PropertyName propertyName, JSValue value) 2554 2551 { 2555 unsigned asIndex = propertyName.asIndex(); 2556 if (asIndex == PropertyName::NotAnIndex) 2552 if (Optional<uint32_t> index = parseIndex(propertyName)) 2553 putDirectIndex(exec, index.value(), value); 2554 else 2557 2555 putDirect(exec->vm(), propertyName, value); 2558 else2559 putDirectIndex(exec, asIndex, value);2560 2556 } 2561 2557 … … 2710 2706 { 2711 2707 // If it's an array index, then use the indexed property storage. 2712 unsigned index = propertyName.asIndex(); 2713 if (index != PropertyName::NotAnIndex) { 2708 if (Optional<uint32_t> index = parseIndex(propertyName)) { 2714 2709 // c. Let succeeded be the result of calling the default [[DefineOwnProperty]] internal method (8.12.9) on A passing P, Desc, and false as arguments. 2715 2710 // d. Reject if succeeded is false. … … 2718 2713 // e.ii. Call the default [[DefineOwnProperty]] internal method (8.12.9) on A passing "length", oldLenDesc, and false as arguments. This call will always return true. 2719 2714 // f. Return true. 2720 return object->defineOwnIndexedProperty(exec, index , descriptor, throwException);2715 return object->defineOwnIndexedProperty(exec, index.value(), descriptor, throwException); 2721 2716 } 2722 2717
Note:
See TracChangeset
for help on using the changeset viewer.