Changeset 178894 in webkit for trunk/Source/JavaScriptCore/runtime/JSObject.cpp
- Timestamp:
- Jan 22, 2015, 12:54:52 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r178756 r178894 340 340 // Try indexed put first. This is required for correctness, since loads on property names that appear like 341 341 // valid indices will never look in the named property storage. 342 unsigned i = propertyName.asIndex(); 343 if (i != PropertyName::NotAnIndex) { 344 putByIndex(thisObject, exec, i, value, slot.isStrictMode()); 342 if (Optional<uint32_t> index = propertyName.asIndex()) { 343 putByIndex(thisObject, exec, index.value(), value, slot.isStrictMode()); 345 344 return; 346 345 } … … 1199 1198 ASSERT(value.isGetterSetter() && (attributes & Accessor)); 1200 1199 1201 unsigned index = propertyName.asIndex(); 1202 if (index != PropertyName::NotAnIndex) { 1203 putDirectIndex(exec, index, value, attributes, PutDirectIndexLikePutDirect); 1200 if (Optional<uint32_t> index = propertyName.asIndex()) { 1201 putDirectIndex(exec, index.value(), value, attributes, PutDirectIndexLikePutDirect); 1204 1202 return; 1205 1203 } … … 1210 1208 void JSObject::putDirectCustomAccessor(VM& vm, PropertyName propertyName, JSValue value, unsigned attributes) 1211 1209 { 1212 ASSERT( propertyName.asIndex() == PropertyName::NotAnIndex);1210 ASSERT(!propertyName.asIndex()); 1213 1211 1214 1212 PutPropertySlot slot(this); … … 1258 1256 JSObject* thisObject = jsCast<JSObject*>(cell); 1259 1257 1260 unsigned i = propertyName.asIndex(); 1261 if (i != PropertyName::NotAnIndex) 1262 return thisObject->methodTable(exec->vm())->deletePropertyByIndex(thisObject, exec, i); 1258 if (Optional<uint32_t> index = propertyName.asIndex()) 1259 return thisObject->methodTable(exec->vm())->deletePropertyByIndex(thisObject, exec, index.value()); 1263 1260 1264 1261 if (!thisObject->staticFunctionsReified()) … … 2503 2500 void JSObject::putDirectMayBeIndex(ExecState* exec, PropertyName propertyName, JSValue value) 2504 2501 { 2505 unsigned asIndex = propertyName.asIndex(); 2506 if (asIndex == PropertyName::NotAnIndex) 2502 if (Optional<uint32_t> index = propertyName.asIndex()) 2503 putDirectIndex(exec, index.value(), value); 2504 else 2507 2505 putDirect(exec->vm(), propertyName, value); 2508 else2509 putDirectIndex(exec, asIndex, value);2510 2506 } 2511 2507 … … 2660 2656 { 2661 2657 // If it's an array index, then use the indexed property storage. 2662 unsigned index = propertyName.asIndex(); 2663 if (index != PropertyName::NotAnIndex) { 2658 if (Optional<uint32_t> index = propertyName.asIndex()) { 2664 2659 // 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. 2665 2660 // d. Reject if succeeded is false. … … 2668 2663 // 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. 2669 2664 // f. Return true. 2670 return object->defineOwnIndexedProperty(exec, index , descriptor, throwException);2665 return object->defineOwnIndexedProperty(exec, index.value(), descriptor, throwException); 2671 2666 } 2672 2667
Note:
See TracChangeset
for help on using the changeset viewer.