Changeset 70749 in webkit


Ignore:
Timestamp:
Oct 28, 2010 12:00:37 AM (14 years ago)
Author:
xan@webkit.org
Message:

2010-10-28 Xan Lopez <xlopez@igalia.com>

Reviewed by Oliver Hunt.

Do not have two different asCell APIs in JSValue
https://bugs.webkit.org/show_bug.cgi?id=47979

Remove JSCell* asCell(JSValue) in favor of only using
JSValue::asCell().

  • API/APICast.h: (toRef):
  • jit/JITPropertyAccess32_64.cpp: (JSC::JIT::testPrototype):
  • jit/JITStubs.cpp: (JSC::JITThunks::tryCachePutByID): (JSC::JITThunks::tryCacheGetByID): (JSC::DEFINE_STUB_FUNCTION):
  • runtime/GetterSetter.h: (JSC::asGetterSetter):
  • runtime/JSByteArray.h: (JSC::asByteArray):
  • runtime/JSCell.h: (JSC::JSCell::getCallData): (JSC::JSCell::getConstructData):
  • runtime/JSString.h: (JSC::RopeBuilder::appendValueInConstructAndIncrementLength): (JSC::asString):
  • runtime/JSValue.h:
  • runtime/Operations.cpp: (JSC::jsIsObjectType):
  • runtime/Operations.h: (JSC::normalizePrototypeChain):
  • runtime/Protect.h: (JSC::gcProtect): (JSC::gcUnprotect):
Location:
trunk/JavaScriptCore
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/APICast.h

    r55633 r70749  
    112112        return 0;
    113113    if (!v.isCell())
    114         return reinterpret_cast<JSValueRef>(asCell(JSC::jsAPIValueWrapper(exec, v)));
    115     return reinterpret_cast<JSValueRef>(asCell(v));
     114        return reinterpret_cast<JSValueRef>(JSC::jsAPIValueWrapper(exec, v).asCell());
     115    return reinterpret_cast<JSValueRef>(v.asCell());
    116116#else
    117117    UNUSED_PARAM(exec);
  • trunk/JavaScriptCore/ChangeLog

    r70736 r70749  
     12010-10-28  Xan Lopez  <xlopez@igalia.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Do not have two different asCell APIs in JSValue
     6        https://bugs.webkit.org/show_bug.cgi?id=47979
     7
     8        Remove JSCell* asCell(JSValue) in favor of only using
     9        JSValue::asCell().
     10
     11        * API/APICast.h:
     12        (toRef):
     13        * jit/JITPropertyAccess32_64.cpp:
     14        (JSC::JIT::testPrototype):
     15        * jit/JITStubs.cpp:
     16        (JSC::JITThunks::tryCachePutByID):
     17        (JSC::JITThunks::tryCacheGetByID):
     18        (JSC::DEFINE_STUB_FUNCTION):
     19        * runtime/GetterSetter.h:
     20        (JSC::asGetterSetter):
     21        * runtime/JSByteArray.h:
     22        (JSC::asByteArray):
     23        * runtime/JSCell.h:
     24        (JSC::JSCell::getCallData):
     25        (JSC::JSCell::getConstructData):
     26        * runtime/JSString.h:
     27        (JSC::RopeBuilder::appendValueInConstructAndIncrementLength):
     28        (JSC::asString):
     29        * runtime/JSValue.h:
     30        * runtime/Operations.cpp:
     31        (JSC::jsIsObjectType):
     32        * runtime/Operations.h:
     33        (JSC::normalizePrototypeChain):
     34        * runtime/Protect.h:
     35        (JSC::gcProtect):
     36        (JSC::gcUnprotect):
     37
    1382010-10-27  Chao-ying Fu  <fu@mips.com>
    239
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r70703 r70749  
    12061206    }
    12071207   
    1208     JSCell* baseCell = asCell(baseValue);
     1208    JSCell* baseCell = baseValue.asCell();
    12091209    Structure* structure = baseCell->structure();
    12101210
     
    12961296    }
    12971297
    1298     Structure* structure = asCell(baseValue)->structure();
     1298    Structure* structure = baseValue.asCell()->structure();
    12991299
    13001300    if (structure->isUncacheableDictionary()) {
     
    16341634        }
    16351635       
    1636         callFrame->r(dst) = jsBoolean(!src.isCell() || !asCell(src)->structure()->typeInfo().masqueradesAsUndefined());
     1636        callFrame->r(dst) = jsBoolean(!src.isCell() || !src.asCell()->structure()->typeInfo().masqueradesAsUndefined());
    16371637        vPC += OPCODE_LENGTH(op_neq_null);
    16381638        NEXT_INSTRUCTION();
     
    24932493
    24942494        if (LIKELY(baseValue.isCell())) {
    2495             JSCell* baseCell = asCell(baseValue);
     2495            JSCell* baseCell = baseValue.asCell();
    24962496            Structure* structure = vPC[4].u.structure;
    24972497
     
    25242524
    25252525        if (LIKELY(baseValue.isCell())) {
    2526             JSCell* baseCell = asCell(baseValue);
     2526            JSCell* baseCell = baseValue.asCell();
    25272527            Structure* structure = vPC[4].u.structure;
    25282528
     
    25632563       
    25642564        if (LIKELY(baseValue.isCell())) {
    2565             JSCell* baseCell = asCell(baseValue);
     2565            JSCell* baseCell = baseValue.asCell();
    25662566            Structure* structure = vPC[4].u.structure;
    25672567           
     
    26082608       
    26092609        if (LIKELY(baseValue.isCell())) {
    2610             JSCell* baseCell = asCell(baseValue);
     2610            JSCell* baseCell = baseValue.asCell();
    26112611            Structure* structure = vPC[4].u.structure;
    26122612           
     
    26892689
    26902690        if (LIKELY(baseValue.isCell())) {
    2691             JSCell* baseCell = asCell(baseValue);
     2691            JSCell* baseCell = baseValue.asCell();
    26922692            Structure* structure = vPC[4].u.structure;
    26932693
     
    27382738       
    27392739        if (LIKELY(baseValue.isCell())) {
    2740             JSCell* baseCell = asCell(baseValue);
     2740            JSCell* baseCell = baseValue.asCell();
    27412741            Structure* structure = vPC[4].u.structure;
    27422742           
     
    27812781       
    27822782        if (LIKELY(baseValue.isCell())) {
    2783             JSCell* baseCell = asCell(baseValue);
     2783            JSCell* baseCell = baseValue.asCell();
    27842784            Structure* structure = vPC[4].u.structure;
    27852785           
     
    28382838       
    28392839        if (LIKELY(baseValue.isCell())) {
    2840             JSCell* baseCell = asCell(baseValue);
     2840            JSCell* baseCell = baseValue.asCell();
    28412841            Structure* structure = vPC[4].u.structure;
    28422842           
     
    28932893       
    28942894        if (LIKELY(baseValue.isCell())) {
    2895             JSCell* baseCell = asCell(baseValue);
     2895            JSCell* baseCell = baseValue.asCell();
    28962896            Structure* structure = vPC[4].u.structure;
    28972897           
     
    30193019       
    30203020        if (LIKELY(baseValue.isCell())) {
    3021             JSCell* baseCell = asCell(baseValue);
     3021            JSCell* baseCell = baseValue.asCell();
    30223022            Structure* oldStructure = vPC[4].u.structure;
    30233023            Structure* newStructure = vPC[5].u.structure;
     
    30713071
    30723072        if (LIKELY(baseValue.isCell())) {
    3073             JSCell* baseCell = asCell(baseValue);
     3073            JSCell* baseCell = baseValue.asCell();
    30743074            Structure* structure = vPC[4].u.structure;
    30753075
  • trunk/JavaScriptCore/jit/JITPropertyAccess32_64.cpp

    r66846 r70749  
    596596    // two less instructions and doesn't require any scratch registers.
    597597#if CPU(X86_64)
    598     move(ImmPtr(asCell(prototype)->structure()), regT3);
    599     failureCases.append(branchPtr(NotEqual, AbsoluteAddress(&asCell(prototype)->m_structure), regT3));
     598    move(ImmPtr(prototype.asCell()->structure()), regT3);
     599    failureCases.append(branchPtr(NotEqual, AbsoluteAddress(&prototype.asCell()->m_structure), regT3));
    600600#else
    601     failureCases.append(branchPtr(NotEqual, AbsoluteAddress(&asCell(prototype)->m_structure), ImmPtr(asCell(prototype)->structure())));
     601    failureCases.append(branchPtr(NotEqual, AbsoluteAddress(&prototype.asCell()->m_structure), ImmPtr(prototype.asCell()->structure())));
    602602#endif
    603603}
  • trunk/JavaScriptCore/jit/JITStubs.cpp

    r70711 r70749  
    849849    }
    850850   
    851     JSCell* baseCell = asCell(baseValue);
     851    JSCell* baseCell = baseValue.asCell();
    852852    Structure* structure = baseCell->structure();
    853853
     
    917917    }
    918918
    919     JSCell* baseCell = asCell(baseValue);
     919    JSCell* baseCell = baseValue.asCell();
    920920    Structure* structure = baseCell->structure();
    921921
     
    15621562    if (baseValue.isCell()
    15631563        && slot.isCacheableValue()
    1564         && !(structure = asCell(baseValue)->structure())->isUncacheableDictionary()
     1564        && !(structure = baseValue.asCell()->structure())->isUncacheableDictionary()
    15651565        && (slotBaseObject = asObject(slot.slotBase()))->getPropertySpecificValue(callFrame, ident, specific)
    15661566        && specific
     
    16361636    if (baseValue.isCell()
    16371637        && slot.isCacheable()
    1638         && !asCell(baseValue)->structure()->isUncacheableDictionary()
     1638        && !baseValue.asCell()->structure()->isUncacheableDictionary()
    16391639        && slot.slotBase() == baseValue) {
    16401640
     
    16571657        if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) {
    16581658            stubInfo->u.getByIdSelfList.listSize++;
    1659             JIT::compileGetByIdSelfList(callFrame->scopeChain()->globalData, codeBlock, stubInfo, polymorphicStructureList, listIndex, asCell(baseValue)->structure(), ident, slot, slot.cachedOffset());
     1659            JIT::compileGetByIdSelfList(callFrame->scopeChain()->globalData, codeBlock, stubInfo, polymorphicStructureList, listIndex, baseValue.asCell()->structure(), ident, slot, slot.cachedOffset());
    16601660
    16611661            if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1))
     
    17411741    CHECK_FOR_EXCEPTION();
    17421742
    1743     if (!baseValue.isCell() || !slot.isCacheable() || asCell(baseValue)->structure()->isDictionary()) {
     1743    if (!baseValue.isCell() || !slot.isCacheable() || baseValue.asCell()->structure()->isDictionary()) {
    17441744        ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail));
    17451745        return JSValue::encode(result);
    17461746    }
    17471747
    1748     Structure* structure = asCell(baseValue)->structure();
     1748    Structure* structure = baseValue.asCell()->structure();
    17491749    CodeBlock* codeBlock = callFrame->codeBlock();
    17501750    StructureStubInfo* stubInfo = &codeBlock->getStubInfo(STUB_RETURN_ADDRESS);
     
    17571757    if (slot.slotBase() == baseValue)
    17581758        ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail));
    1759     else if (slot.slotBase() == asCell(baseValue)->structure()->prototypeForLookup(callFrame)) {
    1760         ASSERT(!asCell(baseValue)->structure()->isDictionary());
     1759    else if (slot.slotBase() == baseValue.asCell()->structure()->prototypeForLookup(callFrame)) {
     1760        ASSERT(!baseValue.asCell()->structure()->isDictionary());
    17611761        // Since we're accessing a prototype in a loop, it's a good bet that it
    17621762        // should not be treated as a dictionary.
     
    17751775        }
    17761776    } else if (size_t count = normalizePrototypeChain(callFrame, baseValue, slot.slotBase(), propertyName, offset)) {
    1777         ASSERT(!asCell(baseValue)->structure()->isDictionary());
     1777        ASSERT(!baseValue.asCell()->structure()->isDictionary());
    17781778        int listIndex;
    17791779        PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(stubInfo, listIndex);
     
    23662366    if (LIKELY(baseValue.isCell() && subscript.isString())) {
    23672367        Identifier propertyName(callFrame, asString(subscript)->value(callFrame));
    2368         PropertySlot slot(asCell(baseValue));
     2368        PropertySlot slot(baseValue.asCell());
    23692369        // JSString::value may have thrown, but we shouldn't find a property with a null identifier,
    23702370        // so we should miss this case and wind up in the CHECK_FOR_EXCEPTION_AT_END, below.
    2371         if (asCell(baseValue)->fastGetOwnPropertySlot(callFrame, propertyName, slot)) {
     2371        if (baseValue.asCell()->fastGetOwnPropertySlot(callFrame, propertyName, slot)) {
    23722372            JSValue result = slot.getValue(callFrame, propertyName);
    23732373            CHECK_FOR_EXCEPTION();
     
    29022902    if (src2.isUndefined()) {
    29032903        return src1.isNull() ||
    2904                (src1.isCell() && asCell(src1)->structure()->typeInfo().masqueradesAsUndefined()) ||
    2905                src1.isUndefined();
     2904               (src1.isCell() && src1.asCell()->structure()->typeInfo().masqueradesAsUndefined())
     2905               || src1.isUndefined();
    29062906    }
    29072907   
    29082908    if (src2.isNull()) {
    29092909        return src1.isUndefined() ||
    2910                (src1.isCell() && asCell(src1)->structure()->typeInfo().masqueradesAsUndefined()) ||
    2911                src1.isNull();
     2910               (src1.isCell() && src1.asCell()->structure()->typeInfo().masqueradesAsUndefined())
     2911               || src1.isNull();
    29122912    }
    29132913
     
    29452945   
    29462946    if (src1.isUndefined())
    2947         return src2.isCell() && asCell(src2)->structure()->typeInfo().masqueradesAsUndefined();
     2947        return src2.isCell() && src2.asCell()->structure()->typeInfo().masqueradesAsUndefined();
    29482948   
    29492949    if (src1.isNull())
    2950         return src2.isCell() && asCell(src2)->structure()->typeInfo().masqueradesAsUndefined();
    2951 
    2952     JSCell* cell1 = asCell(src1);
     2950        return src2.isCell() && src2.asCell()->structure()->typeInfo().masqueradesAsUndefined();
     2951
     2952    JSCell* cell1 = src1.asCell();
    29532953
    29542954    if (cell1->isString()) {
     
    29652965            return jsToNumber(static_cast<JSString*>(cell1)->value(stackFrame.callFrame)) == 0.0;
    29662966
    2967         JSCell* cell2 = asCell(src2);
     2967        JSCell* cell2 = src2.asCell();
    29682968        if (cell2->isString())
    29692969            return static_cast<JSString*>(cell1)->value(stackFrame.callFrame) == static_cast<JSString*>(cell2)->value(stackFrame.callFrame);
  • trunk/JavaScriptCore/runtime/GetterSetter.h

    r55185 r70749  
    6565    inline GetterSetter* asGetterSetter(JSValue value)
    6666    {
    67         ASSERT(asCell(value)->isGetterSetter());
    68         return static_cast<GetterSetter*>(asCell(value));
     67        ASSERT(value.asCell()->isGetterSetter());
     68        return static_cast<GetterSetter*>(value.asCell());
    6969    }
    7070
  • trunk/JavaScriptCore/runtime/JSByteArray.h

    r70496 r70749  
    107107    inline JSByteArray* asByteArray(JSValue value)
    108108    {
    109         return static_cast<JSByteArray*>(asCell(value));
     109        return static_cast<JSByteArray*>(value.asCell());
    110110    }
    111111
  • trunk/JavaScriptCore/runtime/JSCell.h

    r70111 r70749  
    217217    inline CallType getCallData(JSValue value, CallData& callData)
    218218    {
    219         CallType result = value.isCell() ? asCell(value)->getCallData(callData) : CallTypeNone;
     219        CallType result = value.isCell() ? value.asCell()->getCallData(callData) : CallTypeNone;
    220220        ASSERT(result == CallTypeNone || value.isValidCallee());
    221221        return result;
     
    224224    inline ConstructType getConstructData(JSValue value, ConstructData& constructData)
    225225    {
    226         ConstructType result = value.isCell() ? asCell(value)->getConstructData(constructData) : ConstructTypeNone;
     226        ConstructType result = value.isCell() ? value.asCell()->getConstructData(constructData) : ConstructTypeNone;
    227227        ASSERT(result == ConstructTypeNone || value.isValidCallee());
    228228        return result;
  • trunk/JavaScriptCore/runtime/JSString.h

    r70496 r70749  
    380380        {
    381381            if (v.isString()) {
    382                 ASSERT(asCell(v)->isString());
    383                 JSString* s = static_cast<JSString*>(asCell(v));
     382                ASSERT(v.asCell()->isString());
     383                JSString* s = static_cast<JSString*>(v.asCell());
    384384                ASSERT(s->fiberCount() == 1);
    385385                appendStringInConstruct(index, s);
     
    452452    inline JSString* asString(JSValue value)
    453453    {
    454         ASSERT(asCell(value)->isString());
    455         return static_cast<JSString*>(asCell(value));
     454        ASSERT(value.asCell()->isString());
     455        return static_cast<JSString*>(value.asCell());
    456456    }
    457457
  • trunk/JavaScriptCore/runtime/JSValue.h

    r70699 r70749  
    358358    inline bool operator!=(const JSCell* a, const JSValue b) { return JSValue(a) != b; }
    359359
    360     // FIXME: We should deprecate this and just use JSValue::asCell() instead.
    361     JSCell* asCell(JSValue);
    362 
    363     inline JSCell* asCell(JSValue value)
    364     {
    365         return value.asCell();
    366     }
    367 
    368360    ALWAYS_INLINE int32_t JSValue::toInt32(ExecState* exec) const
    369361    {
  • trunk/JavaScriptCore/runtime/Operations.cpp

    r70496 r70749  
    8686        return v.isNull();
    8787
    88     JSType type = asCell(v)->structure()->typeInfo().type();
     88    JSType type = v.asCell()->structure()->typeInfo().type();
    8989    if (type == NumberType || type == StringType)
    9090        return false;
  • trunk/JavaScriptCore/runtime/Operations.h

    r70496 r70749  
    413413    inline size_t normalizePrototypeChain(CallFrame* callFrame, JSValue base, JSValue slotBase, const Identifier& propertyName, size_t& slotOffset)
    414414    {
    415         JSCell* cell = asCell(base);
     415        JSCell* cell = base.asCell();
    416416        size_t count = 0;
    417417
     
    425425                return 0;
    426426
    427             cell = asCell(v);
     427            cell = v.asCell();
    428428
    429429            // Since we're accessing a prototype in a loop, it's a good bet that it
     
    450450                return count;
    451451
    452             base = asCell(v);
     452            base = v.asCell();
    453453
    454454            // Since we're accessing a prototype in a loop, it's a good bet that it
  • trunk/JavaScriptCore/runtime/Protect.h

    r49734 r70749  
    5353    {
    5454        if (value && value.isCell())
    55             gcProtect(asCell(value));
     55            gcProtect(value.asCell());
    5656    }
    5757
     
    5959    {
    6060        if (value && value.isCell())
    61             gcUnprotect(asCell(value));
     61            gcUnprotect(value.asCell());
    6262    }
    6363
Note: See TracChangeset for help on using the changeset viewer.