Changeset 252974 in webkit


Ignore:
Timestamp:
Dec 1, 2019 6:54:11 PM (4 years ago)
Author:
Caio Lima
Message:

Implement GetByVal inline caching for 32-bit JITs
https://bugs.webkit.org/show_bug.cgi?id=204082

Reviewed by Saam Barati.

We are adding 32-bit support for GetByVal cases added on r252684.
This requires changes on some of the IC code generated to properly
support JSVALUE32_64. The major difference from JSVALUE64 is the
usage of tagGPR to inspect value types and store results.

  • bytecode/AccessCase.cpp:

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

  • bytecode/GetterSetterAccessCase.cpp:

(JSC::GetterSetterAccessCase::emitDOMJITGetter):

  • bytecode/PolymorphicAccess.cpp:

(JSC::PolymorphicAccess::regenerate):

  • bytecode/StructureStubInfo.h:

Since a generator can't have thisGPR and propertyGPR at se same time,
we created a new union to share thisTagGPR and propertyTagGPR,
matching the approach we have for JITInlineCacheGenerator::patch.u.

(JSC::StructureStubInfo::propertyRegs const):
(JSC::StructureStubInfo::baseRegs const):

To simplify scratch register allocation, we added baseRegs() and
propertyRegs() to StructureStubInfo, so we can easily retrive
payload and tag GPRs for those operands, keeping them locked.

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • jit/JITInlineCacheGenerator.cpp:

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

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emitSlow_op_get_by_val):

Location:
trunk/Source/JavaScriptCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r252949 r252974  
     12019-12-01  Caio Lima  <ticaiolima@gmail.com>
     2
     3        Implement GetByVal inline caching for 32-bit JITs
     4        https://bugs.webkit.org/show_bug.cgi?id=204082
     5
     6        Reviewed by Saam Barati.
     7
     8        We are adding 32-bit support for GetByVal cases added on r252684.
     9        This requires changes on some of the IC code generated to properly
     10        support JSVALUE32_64. The major difference from JSVALUE64 is the
     11        usage of tagGPR to inspect value types and store results.
     12
     13        * bytecode/AccessCase.cpp:
     14        (JSC::AccessCase::generateWithGuard):
     15        (JSC::AccessCase::generateImpl):
     16        * bytecode/GetterSetterAccessCase.cpp:
     17        (JSC::GetterSetterAccessCase::emitDOMJITGetter):
     18        * bytecode/PolymorphicAccess.cpp:
     19        (JSC::PolymorphicAccess::regenerate):
     20        * bytecode/StructureStubInfo.h:
     21
     22        Since a generator can't have `thisGPR` and `propertyGPR` at se same time,
     23        we created a new `union` to share `thisTagGPR` and `propertyTagGPR`,
     24        matching the approach we have for `JITInlineCacheGenerator::patch.u`.
     25
     26        (JSC::StructureStubInfo::propertyRegs const):
     27        (JSC::StructureStubInfo::baseRegs const):
     28
     29        To simplify scratch register allocation, we added `baseRegs()` and
     30        `propertyRegs()` to `StructureStubInfo`, so we can easily retrive
     31        payload and tag GPRs for those operands, keeping them locked.
     32
     33        * dfg/DFGSpeculativeJIT32_64.cpp:
     34        (JSC::DFG::SpeculativeJIT::compile):
     35        * jit/JITInlineCacheGenerator.cpp:
     36        (JSC::JITByIdGenerator::JITByIdGenerator):
     37        (JSC::JITGetByIdWithThisGenerator::JITGetByIdWithThisGenerator):
     38        (JSC::JITInstanceOfGenerator::JITInstanceOfGenerator):
     39        (JSC::JITGetByValGenerator::JITGetByValGenerator):
     40        * jit/JITPropertyAccess32_64.cpp:
     41        (JSC::JIT::emit_op_get_by_val):
     42        (JSC::JIT::emitSlow_op_get_by_val):
     43
    1442019-11-29  Eike Rathke  <erack@redhat.com>
    245
  • trunk/Source/JavaScriptCore/bytecode/AccessCase.cpp

    r252756 r252974  
    872872
    873873        ScratchRegisterAllocator allocator(stubInfo.patch.usedRegisters);
    874         allocator.lock(baseGPR);
    875         allocator.lock(valueRegs.payloadGPR());
    876         allocator.lock(propertyGPR);
     874        allocator.lock(stubInfo.baseRegs());
     875        allocator.lock(valueRegs);
     876        allocator.lock(stubInfo.propertyRegs());
    877877        allocator.lock(scratchGPR);
    878878       
     
    903903        jit.neg32(scratch2GPR);
    904904        jit.loadPtr(CCallHelpers::Address(baseGPR, ScopedArguments::offsetOfStorage()), scratch3GPR);
    905         jit.loadValue(CCallHelpers::BaseIndex(scratch3GPR, scratch2GPR, CCallHelpers::TimesEight), JSValueRegs::payloadOnly(scratchGPR));
     905#if USE(JSVALUE64)
     906        jit.loadValue(CCallHelpers::BaseIndex(scratch3GPR, scratch2GPR, CCallHelpers::TimesEight), JSValueRegs(scratchGPR));
    906907        failAndIgnore.append(jit.branchIfEmpty(scratchGPR));
    907908        jit.move(scratchGPR, valueRegs.payloadGPR());
     909#else
     910        jit.loadValue(CCallHelpers::BaseIndex(scratch3GPR, scratch2GPR, CCallHelpers::TimesEight), JSValueRegs(scratch2GPR, scratchGPR));
     911        failAndIgnore.append(jit.branchIfEmpty(scratch2GPR));
     912        jit.move(scratchGPR, valueRegs.payloadGPR());
     913        jit.move(scratch2GPR, valueRegs.tagGPR());
     914#endif
    908915
    909916        done.link(&jit);
     
    960967
    961968        ScratchRegisterAllocator allocator(stubInfo.patch.usedRegisters);
    962         allocator.lock(baseGPR);
    963         allocator.lock(valueRegs.payloadGPR());
    964         allocator.lock(propertyGPR);
     969        allocator.lock(stubInfo.baseRegs());
     970        allocator.lock(valueRegs);
     971        allocator.lock(stubInfo.propertyRegs());
    965972        allocator.lock(scratchGPR);
    966973        GPRReg scratch2GPR = allocator.allocateScratchGPR();
     
    10421049
    10431050        ScratchRegisterAllocator allocator(stubInfo.patch.usedRegisters);
    1044         allocator.lock(baseGPR);
    1045         allocator.lock(valueRegs.payloadGPR());
    1046         allocator.lock(propertyGPR);
     1051        allocator.lock(stubInfo.baseRegs());
     1052        allocator.lock(valueRegs);
     1053        allocator.lock(stubInfo.propertyRegs());
    10471054        allocator.lock(scratchGPR);
    10481055        GPRReg scratch2GPR = allocator.allocateScratchGPR();
     
    10731080        jit.move(CCallHelpers::TrustedImmPtr(vm.smallStrings.singleCharacterStrings()), scratchGPR);
    10741081        jit.loadPtr(CCallHelpers::BaseIndex(scratchGPR, scratch2GPR, CCallHelpers::ScalePtr, 0), valueRegs.payloadGPR());
     1082        jit.boxCell(valueRegs.payloadGPR(), valueRegs);
    10751083        allocator.restoreReusedRegistersByPopping(jit, preservedState);
    10761084        state.succeed();
     
    11011109
    11021110        ScratchRegisterAllocator allocator(stubInfo.patch.usedRegisters);
    1103         allocator.lock(baseGPR);
    1104         allocator.lock(valueRegs.payloadGPR());
    1105         allocator.lock(propertyGPR);
     1111        allocator.lock(stubInfo.baseRegs());
     1112        allocator.lock(valueRegs);
     1113        allocator.lock(stubInfo.propertyRegs());
    11061114        allocator.lock(scratchGPR);
    11071115        GPRReg scratch2GPR = allocator.allocateScratchGPR();
     1116#if USE(JSVALUE32_64)
     1117        GPRReg scratch3GPR = allocator.allocateScratchGPR();
     1118#endif
    11081119        ScratchRegisterAllocator::PreservedState preservedState;
    11091120
     
    11231134
    11241135            jit.zeroExtend32ToPtr(propertyGPR, scratch2GPR);
    1125             jit.loadValue(CCallHelpers::BaseIndex(scratchGPR, scratch2GPR, CCallHelpers::TimesEight, ArrayStorage::vectorOffset()), JSValueRegs::payloadOnly(scratchGPR));
     1136#if USE(JSVALUE64)
     1137            jit.loadValue(CCallHelpers::BaseIndex(scratchGPR, scratch2GPR, CCallHelpers::TimesEight, ArrayStorage::vectorOffset()), JSValueRegs(scratchGPR));
    11261138            isEmpty = jit.branchIfEmpty(scratchGPR);
    11271139            jit.move(scratchGPR, valueRegs.payloadGPR());
     1140#else
     1141            jit.loadValue(CCallHelpers::BaseIndex(scratchGPR, scratch2GPR, CCallHelpers::TimesEight, ArrayStorage::vectorOffset()), JSValueRegs(scratch3GPR, scratchGPR));
     1142            isEmpty = jit.branchIfEmpty(scratch3GPR);
     1143            jit.move(scratchGPR, valueRegs.payloadGPR());
     1144            jit.move(scratch3GPR, valueRegs.tagGPR());
     1145#endif
    11281146        } else {
    11291147            IndexingType expectedShape;
     
    11561174                jit.boxDouble(state.scratchFPR, valueRegs);
    11571175            } else {
    1158                 jit.loadValue(CCallHelpers::BaseIndex(scratchGPR, scratch2GPR, CCallHelpers::TimesEight), JSValueRegs::payloadOnly(scratchGPR));
     1176#if USE(JSVALUE64)
     1177                jit.loadValue(CCallHelpers::BaseIndex(scratchGPR, scratch2GPR, CCallHelpers::TimesEight), JSValueRegs(scratchGPR));
    11591178                isEmpty = jit.branchIfEmpty(scratchGPR);
    11601179                jit.move(scratchGPR, valueRegs.payloadGPR());
     1180#else
     1181                jit.loadValue(CCallHelpers::BaseIndex(scratchGPR, scratch2GPR, CCallHelpers::TimesEight), JSValueRegs(scratch3GPR, scratchGPR));
     1182                isEmpty = jit.branchIfEmpty(scratch3GPR);
     1183                jit.move(scratchGPR, valueRegs.payloadGPR());
     1184                jit.move(scratch3GPR, valueRegs.tagGPR());
     1185#endif
    11611186            }
    11621187        }
     
    11951220       
    11961221        ScratchRegisterAllocator allocator(stubInfo.patch.usedRegisters);
    1197         allocator.lock(baseGPR);
    1198         allocator.lock(valueGPR);
    1199         allocator.lock(prototypeGPR);
     1222        allocator.lock(stubInfo.baseRegs());
     1223        allocator.lock(valueRegs);
     1224        allocator.lock(stubInfo.propertyRegs());
    12001225        allocator.lock(scratchGPR);
    12011226       
     
    17081733
    17091734        ScratchRegisterAllocator allocator(stubInfo.patch.usedRegisters);
    1710         allocator.lock(baseGPR);
    1711 #if USE(JSVALUE32_64)
    1712         allocator.lock(stubInfo.patch.baseTagGPR);
    1713 #endif
     1735        allocator.lock(stubInfo.baseRegs());
    17141736        allocator.lock(valueRegs);
    17151737        allocator.lock(scratchGPR);
  • trunk/Source/JavaScriptCore/bytecode/GetterSetterAccessCase.cpp

    r252684 r252974  
    140140
    141141    ScratchRegisterAllocator allocator(stubInfo.patch.usedRegisters);
    142     allocator.lock(baseGPR);
    143 #if USE(JSVALUE32_64)
    144     allocator.lock(stubInfo.patch.baseTagGPR);
    145 #endif
     142    allocator.lock(stubInfo.baseRegs());
    146143    allocator.lock(valueRegs);
    147144    allocator.lock(scratchGPR);
  • trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp

    r252684 r252974  
    453453#if USE(JSVALUE32_64)
    454454    allocator.lock(stubInfo.patch.baseTagGPR);
     455    if (stubInfo.patch.v.thisTagGPR != InvalidGPRReg)
     456        allocator.lock(stubInfo.patch.v.thisTagGPR);
    455457#endif
    456458
     
    522524                CCallHelpers::Jump notInt32;
    523525
    524                 if (!stubInfo.propertyIsInt32)
     526                if (!stubInfo.propertyIsInt32) {
     527#if USE(JSVALUE64)
    525528                    notInt32 = jit.branchIfNotInt32(state.u.propertyGPR);
     529#else
     530                    notInt32 = jit.branchIfNotInt32(state.stubInfo->patch.v.propertyTagGPR);
     531#endif
     532                }
    526533                for (unsigned i = cases.size(); i--;) {
    527534                    fallThrough.link(&jit);
     
    543550
    544551            if (needsStringPropertyCheck) {
     552                CCallHelpers::JumpList notString;
    545553                GPRReg propertyGPR = state.u.propertyGPR;
    546                 CCallHelpers::JumpList notString;
    547554                if (!stubInfo.propertyIsString) {
     555#if USE(JSVALUE32_64)
     556                    GPRReg propertyTagGPR = state.stubInfo->patch.v.propertyTagGPR;
     557                    notString.append(jit.branchIfNotCell(propertyTagGPR));
     558#else
    548559                    notString.append(jit.branchIfNotCell(propertyGPR));
     560#endif
    549561                    notString.append(jit.branchIfNotString(propertyGPR));
    550562                }
     563
    551564                jit.loadPtr(MacroAssembler::Address(propertyGPR, JSString::offsetOfValue()), state.scratchGPR);
    552565
     
    572585                if (!stubInfo.propertyIsSymbol) {
    573586                    GPRReg propertyGPR = state.u.propertyGPR;
     587#if USE(JSVALUE32_64)
     588                    GPRReg propertyTagGPR = state.stubInfo->patch.v.propertyTagGPR;
     589                    notSymbol.append(jit.branchIfNotCell(propertyTagGPR));
     590#else
    574591                    notSymbol.append(jit.branchIfNotCell(propertyGPR));
     592#endif
    575593                    notSymbol.append(jit.branchIfNotSymbol(propertyGPR));
    576594                }
  • trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.h

    r252763 r252974  
    221221#if USE(JSVALUE32_64)
    222222        GPRReg valueTagGPR;
     223        // FIXME: [32-bits] Check if StructureStubInfo::patch.baseTagGPR is used somewhere.
     224        // https://bugs.webkit.org/show_bug.cgi?id=204726
    223225        GPRReg baseTagGPR;
    224         GPRReg thisTagGPR;
     226        union {
     227            GPRReg thisTagGPR;
     228            GPRReg propertyTagGPR;
     229        } v;
    225230#endif
    226231    } patch;
     
    248253#endif
    249254            patch.valueGPR);
     255    }
     256
     257    JSValueRegs propertyRegs() const
     258    {
     259        return JSValueRegs(
     260#if USE(JSVALUE32_64)
     261            patch.v.propertyTagGPR,
     262#endif
     263            patch.u.propertyGPR);
     264    }
     265
     266    JSValueRegs baseRegs() const
     267    {
     268        return JSValueRegs(
     269#if USE(JSVALUE32_64)
     270            patch.baseTagGPR,
     271#endif
     272            patch.baseGPR);
    250273    }
    251274
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp

    r252690 r252974  
    22602260        }
    22612261        case Array::Generic: {
    2262             // FIXME: Implement IC here:
    2263             // https://bugs.webkit.org/show_bug.cgi?id=204082
    2264             if (m_graph.varArgChild(node, 0).useKind() == ObjectUse) {
    2265                 if (m_graph.varArgChild(node, 1).useKind() == StringUse) {
    2266                     compileGetByValForObjectWithString(node);
    2267                     break;
     2262            if (m_graph.m_slowGetByVal.contains(node)) {
     2263                if (m_graph.varArgChild(node, 0).useKind() == ObjectUse) {
     2264                    if (m_graph.varArgChild(node, 1).useKind() == StringUse) {
     2265                        compileGetByValForObjectWithString(node);
     2266                        break;
     2267                    }
     2268
     2269                    if (m_graph.varArgChild(node, 1).useKind() == SymbolUse) {
     2270                        compileGetByValForObjectWithSymbol(node);
     2271                        break;
     2272                    }
    22682273                }
    22692274
    2270                 if (m_graph.varArgChild(node, 1).useKind() == SymbolUse) {
    2271                     compileGetByValForObjectWithSymbol(node);
    2272                     break;
    2273                 }
     2275                SpeculateCellOperand base(this, m_graph.varArgChild(node, 0)); // Save a register, speculate cell. We'll probably be right.
     2276                JSValueOperand property(this, m_graph.varArgChild(node, 1));
     2277                GPRReg baseGPR = base.gpr();
     2278                JSValueRegs propertyRegs = property.jsValueRegs();
     2279               
     2280                flushRegisters();
     2281                JSValueRegsFlushedCallResult result(this);
     2282                JSValueRegs resultRegs = result.regs();
     2283                callOperation(operationGetByValCell, resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), baseGPR, propertyRegs);
     2284                m_jit.exceptionCheck();
     2285               
     2286                jsValueResult(resultRegs, node);
     2287                break;
    22742288            }
    22752289
    2276             SpeculateCellOperand base(this, m_graph.varArgChild(node, 0)); // Save a register, speculate cell. We'll probably be right.
    2277             JSValueOperand property(this, m_graph.varArgChild(node, 1));
    2278             GPRReg baseGPR = base.gpr();
     2290            speculate(node, m_graph.varArgChild(node, 0));
     2291            speculate(node, m_graph.varArgChild(node, 1));
     2292
     2293            JSValueOperand base(this, m_graph.varArgChild(node, 0), ManualOperandSpeculation);
     2294            JSValueOperand property(this, m_graph.varArgChild(node, 1), ManualOperandSpeculation);
     2295            GPRTemporary resultTag(this, Reuse, property, TagWord);
     2296            GPRTemporary resultPayload(this, Reuse, property, PayloadWord);
     2297
     2298            JSValueRegs baseRegs = base.jsValueRegs();
    22792299            JSValueRegs propertyRegs = property.jsValueRegs();
    2280            
    2281             flushRegisters();
    2282             JSValueRegsFlushedCallResult result(this);
    2283             JSValueRegs resultRegs = result.regs();
    2284             callOperation(operationGetByValCell, resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), baseGPR, propertyRegs);
    2285             m_jit.exceptionCheck();
    2286            
     2300            JSValueRegs resultRegs(resultTag.gpr(), resultPayload.gpr());
     2301
     2302            CodeOrigin codeOrigin = node->origin.semantic;
     2303            CallSiteIndex callSite = m_jit.recordCallSiteAndGenerateExceptionHandlingOSRExitIfNeeded(codeOrigin, m_stream->size());
     2304            RegisterSet usedRegisters = this->usedRegisters();
     2305
     2306            JITCompiler::JumpList slowCases;
     2307            if (!m_state.forNode(m_graph.varArgChild(node, 0)).isType(SpecCell))
     2308                slowCases.append(m_jit.branchIfNotCell(baseRegs.tagGPR()));
     2309
     2310            JITGetByValGenerator gen(
     2311                m_jit.codeBlock(), codeOrigin, callSite, usedRegisters,
     2312                baseRegs, propertyRegs, resultRegs);
     2313
     2314            if (m_state.forNode(m_graph.varArgChild(node, 1)).isType(SpecString))
     2315                gen.stubInfo()->propertyIsString = true;
     2316            else if (m_state.forNode(m_graph.varArgChild(node, 1)).isType(SpecInt32Only))
     2317                gen.stubInfo()->propertyIsInt32 = true;
     2318            else if (m_state.forNode(m_graph.varArgChild(node, 1)).isType(SpecSymbol))
     2319                gen.stubInfo()->propertyIsSymbol = true;
     2320
     2321            gen.generateFastPath(m_jit);
     2322           
     2323            slowCases.append(gen.slowPathJump());
     2324
     2325            std::unique_ptr<SlowPathGenerator> slowPath = slowPathCall(
     2326                slowCases, this, operationGetByValOptimize,
     2327                resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(codeOrigin)), gen.stubInfo(), nullptr, baseRegs, propertyRegs);
     2328           
     2329            m_jit.addGetByVal(gen, slowPath.get());
     2330            addSlowPathGenerator(WTFMove(slowPath));
     2331
    22872332            jsValueResult(resultRegs, node);
    22882333            break;
  • trunk/Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp

    r252684 r252974  
    7979    m_stubInfo->patch.baseTagGPR = base.tagGPR();
    8080    m_stubInfo->patch.valueTagGPR = value.tagGPR();
    81     m_stubInfo->patch.thisTagGPR = InvalidGPRReg;
     81    m_stubInfo->patch.v.thisTagGPR = InvalidGPRReg;
    8282#endif
    8383}
     
    125125    m_stubInfo->patch.u.thisGPR = thisRegs.payloadGPR();
    126126#if USE(JSVALUE32_64)
    127     m_stubInfo->patch.thisTagGPR = thisRegs.tagGPR();
     127    m_stubInfo->patch.v.thisTagGPR = thisRegs.tagGPR();
    128128#endif
    129129}
     
    191191    m_stubInfo->patch.baseTagGPR = InvalidGPRReg;
    192192    m_stubInfo->patch.valueTagGPR = InvalidGPRReg;
    193     m_stubInfo->patch.thisTagGPR = InvalidGPRReg;
     193    m_stubInfo->patch.v.thisTagGPR = InvalidGPRReg;
    194194#endif
    195195
     
    230230    m_stubInfo->patch.u.propertyGPR = property.payloadGPR();
    231231    m_stubInfo->patch.valueGPR = result.payloadGPR();
     232#if USE(JSVALUE32_64)
     233    m_stubInfo->patch.baseTagGPR = base.tagGPR();
     234    m_stubInfo->patch.valueTagGPR = result.tagGPR();
     235    m_stubInfo->patch.v.propertyTagGPR = property.tagGPR();
     236#endif
    232237}
    233238
  • trunk/Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp

    r252690 r252974  
    139139void JIT::emit_op_get_by_val(const Instruction* currentInstruction)
    140140{
    141     // FIXME: Implement IC here:
    142     // https://bugs.webkit.org/show_bug.cgi?id=204082
    143141    auto bytecode = currentInstruction->as<OpGetByVal>();
    144142    auto& metadata = bytecode.metadata(m_codeBlock);
     
    150148    emitLoad2(base, regT1, regT0, property, regT3, regT2);
    151149
    152     emitJumpSlowCaseIfNotJSCell(base, regT1);
    153     emitArrayProfilingSiteWithCell(regT0, regT4, profile);
    154 
    155     JITGetByValGenerator gen(
    156         m_codeBlock, CodeOrigin(m_bytecodeIndex), CallSiteIndex(m_bytecodeIndex), RegisterSet::stubUnavailableRegisters(),
    157         JSValueRegs::payloadOnly(regT0), JSValueRegs(regT3, regT2), JSValueRegs(regT1, regT0));
    158     gen.generateFastPath(*this);
    159     addSlowCase(gen.slowPathJump());
    160     m_getByVals.append(gen);
    161 
    162     emitValueProfilingSite(bytecode.metadata(m_codeBlock));
    163     emitStore(dst, regT1, regT0);
     150    if (metadata.m_seenIdentifiers.count() > Options::getByValICMaxNumberOfIdentifiers()) {
     151        auto notCell = branchIfNotCell(regT1);
     152        emitArrayProfilingSiteWithCell(regT0, regT4, profile);
     153        notCell.link(this);
     154        callOperationWithProfile(bytecode.metadata(m_codeBlock), operationGetByVal, dst, TrustedImmPtr(m_codeBlock->globalObject()), JSValueRegs(regT1, regT0), JSValueRegs(regT3, regT2));
     155    } else {
     156        emitJumpSlowCaseIfNotJSCell(base, regT1);
     157        emitArrayProfilingSiteWithCell(regT0, regT4, profile);
     158
     159        JITGetByValGenerator gen(
     160            m_codeBlock, CodeOrigin(m_bytecodeIndex), CallSiteIndex(BytecodeIndex(bitwise_cast<uint32_t>(currentInstruction))), RegisterSet::stubUnavailableRegisters(),
     161            JSValueRegs::payloadOnly(regT0), JSValueRegs(regT3, regT2), JSValueRegs(regT1, regT0));
     162        if (isOperandConstantInt(property))
     163            gen.stubInfo()->propertyIsInt32 = true;
     164        gen.generateFastPath(*this);
     165        addSlowCase(gen.slowPathJump());
     166        m_getByVals.append(gen);
     167
     168        emitValueProfilingSite(bytecode.metadata(m_codeBlock));
     169        emitStore(dst, regT1, regT0);
     170    }
    164171}
    165172
    166173void JIT::emitSlow_op_get_by_val(const Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
    167174{
    168     auto bytecode = currentInstruction->as<OpGetByVal>();
    169     int dst = bytecode.m_dst.offset();
    170     auto& metadata = bytecode.metadata(m_codeBlock);
    171     ArrayProfile* profile = &metadata.m_arrayProfile;
    172 
    173     JITGetByValGenerator& gen = m_getByVals[m_getByValIndex];
    174     ++m_getByValIndex;
    175 
    176     linkAllSlowCases(iter);
    177 
    178     Label coldPathBegin = label();
    179     Call call = callOperationWithProfile(bytecode.metadata(m_codeBlock), operationGetByValGeneric, dst, TrustedImmPtr(m_codeBlock->globalObject()), gen.stubInfo(), profile, JSValueRegs(regT1, regT0), JSValueRegs(regT3, regT2));
    180     gen.reportSlowPathCall(coldPathBegin, call);
     175    if (hasAnySlowCases(iter)) {
     176        auto bytecode = currentInstruction->as<OpGetByVal>();
     177        int dst = bytecode.m_dst.offset();
     178        auto& metadata = bytecode.metadata(m_codeBlock);
     179        ArrayProfile* profile = &metadata.m_arrayProfile;
     180
     181        JITGetByValGenerator& gen = m_getByVals[m_getByValIndex];
     182        ++m_getByValIndex;
     183
     184        linkAllSlowCases(iter);
     185
     186        Label coldPathBegin = label();
     187        Call call = callOperationWithProfile(bytecode.metadata(m_codeBlock), operationGetByValOptimize, dst, TrustedImmPtr(m_codeBlock->globalObject()), gen.stubInfo(), profile, JSValueRegs(regT1, regT0), JSValueRegs(regT3, regT2));
     188        gen.reportSlowPathCall(coldPathBegin, call);
     189    }
    181190}
    182191
Note: See TracChangeset for help on using the changeset viewer.