Changeset 178928 in webkit for trunk/Source/JavaScriptCore/runtime/Arguments.cpp
- Timestamp:
- Jan 22, 2015, 11:34:34 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/Arguments.cpp
r178894 r178928 162 162 { 163 163 Arguments* thisObject = jsCast<Arguments*>(object); 164 if (Optional<uint32_t> index = propertyName.asIndex()) {165 if (JSValue value = thisObject->tryGetArgument(index.value())) {166 slot.setValue(thisObject, None, value);167 return true;168 }164 unsigned i = propertyName.asIndex(); 165 if (JSValue value = thisObject->tryGetArgument(i)) { 166 RELEASE_ASSERT(i < PropertyName::NotAnIndex); 167 slot.setValue(thisObject, None, value); 168 return true; 169 169 } 170 170 … … 225 225 { 226 226 Arguments* thisObject = jsCast<Arguments*>(cell); 227 Optional<uint32_t> index= propertyName.asIndex();228 if ( index && thisObject->trySetArgument(exec->vm(), index.value(), value))227 unsigned i = propertyName.asIndex(); 228 if (thisObject->trySetArgument(exec->vm(), i, value)) 229 229 return; 230 230 … … 268 268 269 269 Arguments* thisObject = jsCast<Arguments*>(cell); 270 Optional<uint32_t> index = propertyName.asIndex(); 271 if (index && index.value() < thisObject->m_numArguments) { 270 unsigned i = propertyName.asIndex(); 271 if (i < thisObject->m_numArguments) { 272 RELEASE_ASSERT(i < PropertyName::NotAnIndex); 272 273 if (!Base::deleteProperty(cell, exec, propertyName)) 273 274 return false; 274 if (thisObject->tryDeleteArgument(exec->vm(), i ndex.value()))275 if (thisObject->tryDeleteArgument(exec->vm(), i)) 275 276 return true; 276 277 } … … 298 299 { 299 300 Arguments* thisObject = jsCast<Arguments*>(object); 300 Optional<uint32_t> optionalIndex = propertyName.asIndex(); 301 if (optionalIndex && optionalIndex.value() < thisObject->m_numArguments) { 301 unsigned i = propertyName.asIndex(); 302 if (i < thisObject->m_numArguments) { 303 RELEASE_ASSERT(i < PropertyName::NotAnIndex); 302 304 // If the property is not yet present on the object, and is not yet marked as deleted, then add it now. 303 uint32_t index = optionalIndex.value();304 305 PropertySlot slot(thisObject); 305 if (!thisObject->isDeletedArgument(i ndex) && !JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot)) {306 JSValue value = thisObject->tryGetArgument(i ndex);306 if (!thisObject->isDeletedArgument(i) && !JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot)) { 307 JSValue value = thisObject->tryGetArgument(i); 307 308 ASSERT(value); 308 309 object->putDirectMayBeIndex(exec, propertyName, value); … … 313 314 // From ES 5.1, 10.6 Arguments Object 314 315 // 5. If the value of isMapped is not undefined, then 315 if (thisObject->isArgument(i ndex)) {316 if (thisObject->isArgument(i)) { 316 317 // a. If IsAccessorDescriptor(Desc) is true, then 317 318 if (descriptor.isAccessorDescriptor()) { 318 319 // i. Call the [[Delete]] internal method of map passing P, and false as the arguments. 319 thisObject->tryDeleteArgument(exec->vm(), i ndex);320 thisObject->tryDeleteArgument(exec->vm(), i); 320 321 } else { // b. Else 321 322 // i. If Desc.[[Value]] is present, then 322 323 // 1. Call the [[Put]] internal method of map passing P, Desc.[[Value]], and Throw as the arguments. 323 324 if (descriptor.value()) 324 thisObject->trySetArgument(exec->vm(), i ndex, descriptor.value());325 thisObject->trySetArgument(exec->vm(), i, descriptor.value()); 325 326 // ii. If Desc.[[Writable]] is present and its value is false, then 326 327 // 1. Call the [[Delete]] internal method of map passing P and false as arguments. 327 328 if (descriptor.writablePresent() && !descriptor.writable()) 328 thisObject->tryDeleteArgument(exec->vm(), i ndex);329 thisObject->tryDeleteArgument(exec->vm(), i); 329 330 } 330 331 }
Note:
See TracChangeset
for help on using the changeset viewer.