Changeset 178928 in webkit for trunk/Source/JavaScriptCore/jit/JITOperations.cpp
- Timestamp:
- Jan 22, 2015, 11:34:34 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r178894 r178928 52 52 #include "LegacyProfiler.h" 53 53 #include "ObjectConstructor.h" 54 #include "PropertyName.h"55 54 #include "Repatch.h" 56 55 #include "RepatchBuffer.h" … … 482 481 static void directPutByVal(CallFrame* callFrame, JSObject* baseObject, JSValue subscript, JSValue value) 483 482 { 484 bool isStrictMode = callFrame->codeBlock()->isStrictMode();485 483 if (LIKELY(subscript.isUInt32())) { 486 uint32_t index = subscript.asUInt32(); 487 ASSERT_WITH_MESSAGE(index != PropertyName::NotAnIndex, "Since JSValue::isUInt32 returns true only when the boxed value is int32_t and positive, it doesn't return true for uint32_t max value that is PropertyName::NotAnIndex."); 488 baseObject->putDirectIndex(callFrame, index, value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow); 489 return; 490 } 491 492 if (subscript.isDouble()) { 493 double subscriptAsDouble = subscript.asDouble(); 494 uint32_t subscriptAsUInt32 = static_cast<uint32_t>(subscriptAsDouble); 495 if (subscriptAsDouble == subscriptAsUInt32 && subscriptAsUInt32 != PropertyName::NotAnIndex) { 496 baseObject->putDirectIndex(callFrame, subscriptAsUInt32, value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow); 497 return; 498 } 499 } 500 501 if (isName(subscript)) { 502 PutPropertySlot slot(baseObject, isStrictMode); 484 uint32_t i = subscript.asUInt32(); 485 baseObject->putDirectIndex(callFrame, i, value); 486 } else if (isName(subscript)) { 487 PutPropertySlot slot(baseObject, callFrame->codeBlock()->isStrictMode()); 503 488 baseObject->putDirect(callFrame->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot); 504 return; 505 } 506 507 // Don't put to an object if toString throws an exception. 508 Identifier property = subscript.toString(callFrame)->toIdentifier(callFrame); 509 if (callFrame->vm().exception()) 510 return; 511 512 PropertyName propertyName(property); 513 if (Optional<uint32_t> index = propertyName.asIndex()) 514 baseObject->putDirectIndex(callFrame, index.value(), value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow); 515 else { 516 PutPropertySlot slot(baseObject, isStrictMode); 517 baseObject->putDirect(callFrame->vm(), propertyName, value, slot); 489 } else { 490 Identifier property = subscript.toString(callFrame)->toIdentifier(callFrame); 491 if (!callFrame->vm().exception()) { // Don't put to an object if toString threw an exception. 492 PutPropertySlot slot(baseObject, callFrame->codeBlock()->isStrictMode()); 493 baseObject->putDirect(callFrame->vm(), property, value, slot); 494 } 518 495 } 519 496 }
Note:
See TracChangeset
for help on using the changeset viewer.