Ignore:
Timestamp:
Jun 7, 2017, 9:54:05 AM (8 years ago)
Author:
Yusuke Suzuki
Message:

[JSC] has_generic_property never accepts non-String
https://bugs.webkit.org/show_bug.cgi?id=173057

Reviewed by Darin Adler.

We never pass non-String value to has_generic_property bytecode.

  • runtime/CommonSlowPaths.cpp:

(JSC::SLOW_PATH_DECL):

File:
1 edited

Legend:

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

    r217840 r217887  
    705705    if (base->structure(vm)->id() == enumerator->cachedStructureID())
    706706        RETURN(jsBoolean(true));
    707     RETURN(jsBoolean(base->hasPropertyGeneric(exec, asString(property.asCell())->toIdentifier(exec), PropertySlot::InternalMethodType::GetOwnProperty)));
     707    JSString* string = asString(property);
     708    auto propertyName = string->toIdentifier(exec);
     709    CHECK_EXCEPTION();
     710    RETURN(jsBoolean(base->hasPropertyGeneric(exec, propertyName, PropertySlot::InternalMethodType::GetOwnProperty)));
    708711}
    709712
     
    714717    CHECK_EXCEPTION();
    715718    JSValue property = OP(3).jsValue();
    716     bool result;
    717     if (property.isString())
    718         result = base->hasPropertyGeneric(exec, asString(property.asCell())->toIdentifier(exec), PropertySlot::InternalMethodType::GetOwnProperty);
    719     else {
    720         ASSERT(property.isUInt32());
    721         result = base->hasPropertyGeneric(exec, property.asUInt32(), PropertySlot::InternalMethodType::GetOwnProperty);
    722     }
    723     RETURN(jsBoolean(result));
     719    JSString* string = asString(property);
     720    auto propertyName = string->toIdentifier(exec);
     721    CHECK_EXCEPTION();
     722    RETURN(jsBoolean(base->hasPropertyGeneric(exec, propertyName, PropertySlot::InternalMethodType::GetOwnProperty)));
    724723}
    725724
     
    729728    JSValue baseValue = OP_C(2).jsValue();
    730729    JSValue property = OP(3).jsValue();
    731     ASSERT(property.isString());
    732     RETURN(baseValue.get(exec, asString(property)->toIdentifier(exec)));
     730    JSString* string = asString(property);
     731    auto propertyName = string->toIdentifier(exec);
     732    CHECK_EXCEPTION();
     733    RETURN(baseValue.get(exec, propertyName));
    733734}
    734735
Note: See TracChangeset for help on using the changeset viewer.