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