Ignore:
Timestamp:
Jan 22, 2015, 11:34:34 AM (10 years ago)
Author:
[email protected]
Message:

Unreviewed, rolling out r178894.
https://bugs.webkit.org/show_bug.cgi?id=140775

Broke JSC and bindings tests (Requested by ap_ on #webkit).

Reverted changeset:

"put_by_val_direct need to check the property is index or not
for using putDirect / putDirectIndex"
https://bugs.webkit.org/show_bug.cgi?id=140426
http://trac.webkit.org/changeset/178894

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Arguments.cpp

    r178894 r178928  
    162162{
    163163    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;
    169169    }
    170170
     
    225225{
    226226    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))
    229229        return;
    230230
     
    268268
    269269    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);
    272273        if (!Base::deleteProperty(cell, exec, propertyName))
    273274            return false;
    274         if (thisObject->tryDeleteArgument(exec->vm(), index.value()))
     275        if (thisObject->tryDeleteArgument(exec->vm(), i))
    275276            return true;
    276277    }
     
    298299{
    299300    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);
    302304        // 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();
    304305        PropertySlot slot(thisObject);
    305         if (!thisObject->isDeletedArgument(index) && !JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot)) {
    306             JSValue value = thisObject->tryGetArgument(index);
     306        if (!thisObject->isDeletedArgument(i) && !JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot)) {
     307            JSValue value = thisObject->tryGetArgument(i);
    307308            ASSERT(value);
    308309            object->putDirectMayBeIndex(exec, propertyName, value);
     
    313314        // From ES 5.1, 10.6 Arguments Object
    314315        // 5. If the value of isMapped is not undefined, then
    315         if (thisObject->isArgument(index)) {
     316        if (thisObject->isArgument(i)) {
    316317            // a. If IsAccessorDescriptor(Desc) is true, then
    317318            if (descriptor.isAccessorDescriptor()) {
    318319                // i. Call the [[Delete]] internal method of map passing P, and false as the arguments.
    319                 thisObject->tryDeleteArgument(exec->vm(), index);
     320                thisObject->tryDeleteArgument(exec->vm(), i);
    320321            } else { // b. Else
    321322                // i. If Desc.[[Value]] is present, then
    322323                // 1. Call the [[Put]] internal method of map passing P, Desc.[[Value]], and Throw as the arguments.
    323324                if (descriptor.value())
    324                     thisObject->trySetArgument(exec->vm(), index, descriptor.value());
     325                    thisObject->trySetArgument(exec->vm(), i, descriptor.value());
    325326                // ii. If Desc.[[Writable]] is present and its value is false, then
    326327                // 1. Call the [[Delete]] internal method of map passing P and false as arguments.
    327328                if (descriptor.writablePresent() && !descriptor.writable())
    328                     thisObject->tryDeleteArgument(exec->vm(), index);
     329                    thisObject->tryDeleteArgument(exec->vm(), i);
    329330            }
    330331        }
Note: See TracChangeset for help on using the changeset viewer.