Changeset 251951 in webkit


Ignore:
Timestamp:
Nov 1, 2019 4:07:34 PM (4 years ago)
Author:
sbarati@apple.com
Message:

Refactor uses of StructureStubInfo 'thisGPR' to a union for thisGPR and prototypeGPR
https://bugs.webkit.org/show_bug.cgi?id=203693

Reviewed by Mark Lam and Yusuke Suzuki.

I'm going to be adding a third overload for this field when making
GetByVal inline caching part of StructureStubInfo. It's nicer for
each use case of this field to use it by the proper name.

  • bytecode/AccessCase.cpp:

(JSC::AccessCase::generateWithGuard):
(JSC::AccessCase::generateImpl):

  • bytecode/PolymorphicAccess.cpp:

(JSC::PolymorphicAccess::regenerate):

  • bytecode/PolymorphicAccess.h:

(JSC::AccessGenerationState::AccessGenerationState):

  • bytecode/StructureStubInfo.h:
  • jit/JITInlineCacheGenerator.cpp:

(JSC::JITByIdGenerator::JITByIdGenerator):
(JSC::JITGetByIdWithThisGenerator::JITGetByIdWithThisGenerator):
(JSC::JITInstanceOfGenerator::JITInstanceOfGenerator):

Location:
trunk/Source/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r251940 r251951  
     12019-11-01  Saam Barati  <sbarati@apple.com>
     2
     3        Refactor uses of StructureStubInfo 'thisGPR' to a union for thisGPR and prototypeGPR
     4        https://bugs.webkit.org/show_bug.cgi?id=203693
     5
     6        Reviewed by Mark Lam and Yusuke Suzuki.
     7
     8        I'm going to be adding a third overload for this field when making
     9        GetByVal inline caching part of StructureStubInfo. It's nicer for
     10        each use case of this field to use it by the proper name.
     11
     12        * bytecode/AccessCase.cpp:
     13        (JSC::AccessCase::generateWithGuard):
     14        (JSC::AccessCase::generateImpl):
     15        * bytecode/PolymorphicAccess.cpp:
     16        (JSC::PolymorphicAccess::regenerate):
     17        * bytecode/PolymorphicAccess.h:
     18        (JSC::AccessGenerationState::AccessGenerationState):
     19        * bytecode/StructureStubInfo.h:
     20        * jit/JITInlineCacheGenerator.cpp:
     21        (JSC::JITByIdGenerator::JITByIdGenerator):
     22        (JSC::JITGetByIdWithThisGenerator::JITGetByIdWithThisGenerator):
     23        (JSC::JITInstanceOfGenerator::JITInstanceOfGenerator):
     24
    1252019-11-01  Alexey Shvayka  <shvaikalesh@gmail.com>
    226
  • trunk/Source/JavaScriptCore/bytecode/AccessCase.cpp

    r251425 r251951  
    466466    JSValueRegs valueRegs = state.valueRegs;
    467467    GPRReg baseGPR = state.baseGPR;
    468     GPRReg thisGPR = state.thisGPR != InvalidGPRReg ? state.thisGPR : baseGPR;
    469468    GPRReg scratchGPR = state.scratchGPR;
    470469
     
    604603        fallThrough.append(
    605604            jit.branchPtr(
    606                 CCallHelpers::NotEqual, thisGPR,
     605                CCallHelpers::NotEqual, state.u.prototypeGPR,
    607606                CCallHelpers::TrustedImmPtr(as<InstanceOfAccessCase>().prototype())));
    608607        break;
    609608       
    610609    case InstanceOfGeneric: {
    611         // Legend: value = `base instanceof this`.
     610        GPRReg prototypeGPR = state.u.prototypeGPR;
     611        // Legend: value = `base instanceof prototypeGPR`.
    612612       
    613613        GPRReg valueGPR = valueRegs.payloadGPR();
     
    616616        allocator.lock(baseGPR);
    617617        allocator.lock(valueGPR);
    618         allocator.lock(thisGPR);
     618        allocator.lock(prototypeGPR);
    619619        allocator.lock(scratchGPR);
    620620       
     
    622622       
    623623        if (!state.stubInfo->prototypeIsKnownObject)
    624             state.failAndIgnore.append(jit.branchIfNotObject(thisGPR));
     624            state.failAndIgnore.append(jit.branchIfNotObject(prototypeGPR));
    625625       
    626626        ScratchRegisterAllocator::PreservedState preservedState =
     
    660660        jit.move(scratch2GPR, valueGPR);
    661661       
    662         CCallHelpers::Jump isInstance = jit.branchPtr(CCallHelpers::Equal, valueGPR, thisGPR);
     662        CCallHelpers::Jump isInstance = jit.branchPtr(CCallHelpers::Equal, valueGPR, prototypeGPR);
    663663
    664664#if USE(JSVALUE64)
     
    717717    JSValueRegs valueRegs = state.valueRegs;
    718718    GPRReg baseGPR = state.baseGPR;
    719     GPRReg thisGPR = state.thisGPR != InvalidGPRReg ? state.thisGPR : baseGPR;
     719    GPRReg thisGPR = state.u.thisGPR != InvalidGPRReg ? state.u.thisGPR : baseGPR;
    720720    GPRReg scratchGPR = state.scratchGPR;
    721721
  • trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp

    r251425 r251951  
    396396   
    397397    state.baseGPR = stubInfo.baseGPR();
    398     state.thisGPR = stubInfo.patch.thisGPR;
     398    state.u.thisGPR = stubInfo.patch.u.thisGPR;
    399399    state.valueRegs = stubInfo.valueRegs();
    400400
     
    402402    state.allocator = &allocator;
    403403    allocator.lock(state.baseGPR);
    404     if (state.thisGPR != InvalidGPRReg)
    405         allocator.lock(state.thisGPR);
     404    if (state.u.thisGPR != InvalidGPRReg)
     405        allocator.lock(state.u.thisGPR);
    406406    allocator.lock(state.valueRegs);
    407407#if USE(JSVALUE32_64)
  • trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.h

    r250540 r251951  
    194194        , m_calculatedCallSiteIndex(false)
    195195    {
     196        u.thisGPR = InvalidGPRReg;
    196197    }
    197198    VM& m_vm;
     
    206207    MacroAssembler::JumpList failAndIgnore;
    207208    GPRReg baseGPR { InvalidGPRReg };
    208     GPRReg thisGPR { InvalidGPRReg };
     209    union {
     210        GPRReg thisGPR;
     211        GPRReg prototypeGPR;
     212    } u;
    209213    JSValueRegs valueRegs;
    210214    GPRReg scratchGPR { InvalidGPRReg };
  • trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.h

    r251425 r251951  
    202202        GPRReg baseGPR;
    203203        GPRReg valueGPR;
    204         GPRReg thisGPR;
     204        union {
     205            GPRReg thisGPR;
     206            GPRReg prototypeGPR;
     207        } u;
    205208#if USE(JSVALUE32_64)
    206209        GPRReg valueTagGPR;
  • trunk/Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp

    r251425 r251951  
    7575    m_stubInfo->patch.baseGPR = base.payloadGPR();
    7676    m_stubInfo->patch.valueGPR = value.payloadGPR();
    77     m_stubInfo->patch.thisGPR = InvalidGPRReg;
     77    m_stubInfo->patch.u.thisGPR = InvalidGPRReg;
    7878#if USE(JSVALUE32_64)
    7979    m_stubInfo->patch.baseTagGPR = base.tagGPR();
     
    123123    RELEASE_ASSERT(thisRegs.payloadGPR() != thisRegs.tagGPR());
    124124
    125     m_stubInfo->patch.thisGPR = thisRegs.payloadGPR();
     125    m_stubInfo->patch.u.thisGPR = thisRegs.payloadGPR();
    126126#if USE(JSVALUE32_64)
    127127    m_stubInfo->patch.thisTagGPR = thisRegs.tagGPR();
     
    187187    m_stubInfo->patch.baseGPR = value;
    188188    m_stubInfo->patch.valueGPR = result;
    189     m_stubInfo->patch.thisGPR = prototype;
     189    m_stubInfo->patch.u.prototypeGPR = prototype;
    190190#if USE(JSVALUE32_64)
    191191    m_stubInfo->patch.baseTagGPR = InvalidGPRReg;
Note: See TracChangeset for help on using the changeset viewer.