Changeset 220318 in webkit


Ignore:
Timestamp:
Aug 5, 2017 7:10:07 AM (7 years ago)
Author:
mark.lam@apple.com
Message:

Move DFG::OSRExitCompiler methods into DFG::OSRExit [step 3].
https://bugs.webkit.org/show_bug.cgi?id=175228
<rdar://problem/33735737>

Reviewed by Saam Barati.

Merge the 32-bit OSRExit::compileExit() method into the 64-bit version, and
delete OSRExit32_64.cpp.

  • CMakeLists.txt:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • dfg/DFGOSRExit.cpp:

(JSC::DFG::OSRExit::compileExit):

  • dfg/DFGOSRExit32_64.cpp: Removed.
  • jit/GPRInfo.h:

(JSC::JSValueSource::payloadGPR const):

Location:
trunk/Source/JavaScriptCore
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r220306 r220318  
    377377    dfg/DFGOSREntrypointCreationPhase.cpp
    378378    dfg/DFGOSRExit.cpp
    379     dfg/DFGOSRExit32_64.cpp
    380379    dfg/DFGOSRExitBase.cpp
    381380    dfg/DFGOSRExitCompilerCommon.cpp
  • trunk/Source/JavaScriptCore/ChangeLog

    r220311 r220318  
     12017-08-05  Mark Lam  <mark.lam@apple.com>
     2
     3        Move DFG::OSRExitCompiler methods into DFG::OSRExit [step 3].
     4        https://bugs.webkit.org/show_bug.cgi?id=175228
     5        <rdar://problem/33735737>
     6
     7        Reviewed by Saam Barati.
     8
     9        Merge the 32-bit OSRExit::compileExit() method into the 64-bit version, and
     10        delete OSRExit32_64.cpp.
     11
     12        * CMakeLists.txt:
     13        * JavaScriptCore.xcodeproj/project.pbxproj:
     14        * dfg/DFGOSRExit.cpp:
     15        (JSC::DFG::OSRExit::compileExit):
     16        * dfg/DFGOSRExit32_64.cpp: Removed.
     17        * jit/GPRInfo.h:
     18        (JSC::JSValueSource::payloadGPR const):
     19
    1202017-08-04  Youenn Fablet  <youenn@apple.com>
    221
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r220306 r220318  
    745745                0FBF158D19B7A53100695DD0 /* DFGBlockSetInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FBF158B19B7A53100695DD0 /* DFGBlockSetInlines.h */; };
    746746                0FC0976A1468A6F700CF2442 /* DFGOSRExit.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC097681468A6EF00CF2442 /* DFGOSRExit.h */; };
    747                 0FC09776146943B000CF2442 /* DFGOSRExit32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC09775146943AD00CF2442 /* DFGOSRExit32_64.cpp */; };
    748747                0FC09791146A6F7100CF2442 /* DFGOSRExit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC0978E146A6F6300CF2442 /* DFGOSRExit.cpp */; };
    749748                0FC097A1146B28CA00CF2442 /* DFGThunks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC0979F146B28C700CF2442 /* DFGThunks.cpp */; };
     
    33403339                0FBF158B19B7A53100695DD0 /* DFGBlockSetInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGBlockSetInlines.h; path = dfg/DFGBlockSetInlines.h; sourceTree = "<group>"; };
    33413340                0FC097681468A6EF00CF2442 /* DFGOSRExit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGOSRExit.h; path = dfg/DFGOSRExit.h; sourceTree = "<group>"; };
    3342                 0FC09775146943AD00CF2442 /* DFGOSRExit32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGOSRExit32_64.cpp; path = dfg/DFGOSRExit32_64.cpp; sourceTree = "<group>"; };
    33433341                0FC0977E1469EBC400CF2442 /* DFGCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGCommon.h; path = dfg/DFGCommon.h; sourceTree = "<group>"; };
    33443342                0FC0978E146A6F6300CF2442 /* DFGOSRExit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGOSRExit.cpp; path = dfg/DFGOSRExit.cpp; sourceTree = "<group>"; };
     
    74687466                                0FC0978E146A6F6300CF2442 /* DFGOSRExit.cpp */,
    74697467                                0FC097681468A6EF00CF2442 /* DFGOSRExit.h */,
    7470                                 0FC09775146943AD00CF2442 /* DFGOSRExit32_64.cpp */,
    74717468                                0F235BE717178E7300690C7F /* DFGOSRExitBase.cpp */,
    74727469                                0F235BE817178E7300690C7F /* DFGOSRExitBase.h */,
     
    1047510472                                0FC09791146A6F7100CF2442 /* DFGOSRExit.cpp in Sources */,
    1047610473                                0F235BEB17178E7300690C7F /* DFGOSRExitBase.cpp in Sources */,
    10477                                 0FC09776146943B000CF2442 /* DFGOSRExit32_64.cpp in Sources */,
    1047810474                                0F7025A91714B0FA00382C0E /* DFGOSRExitCompilerCommon.cpp in Sources */,
    1047910475                                0F392C891B46188400844728 /* DFGOSRExitFuzz.cpp in Sources */,
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExit.cpp

    r220306 r220318  
    224224}
    225225
    226 #if USE(JSVALUE64)
    227 
    228226void OSRExit::compileExit(CCallHelpers& jit, VM& vm, const OSRExit& exit, const Operands<ValueRecovery>& operands, SpeculationRecovery* recovery)
    229227{
     
    247245        case SpeculativeAdd:
    248246            jit.sub32(recovery->src(), recovery->dest());
     247#if USE(JSVALUE64)
    249248            jit.or64(GPRInfo::tagTypeNumberRegister, recovery->dest());
     249#endif
    250250            break;
    251251
    252252        case SpeculativeAddImmediate:
    253253            jit.sub32(AssemblyHelpers::Imm32(recovery->immediate()), recovery->dest());
     254#if USE(JSVALUE64)
    254255            jit.or64(GPRInfo::tagTypeNumberRegister, recovery->dest());
     256#endif
    255257            break;
    256258
    257259        case BooleanSpeculationCheck:
     260#if USE(JSVALUE64)
    258261            jit.xor64(AssemblyHelpers::TrustedImm32(static_cast<int32_t>(ValueFalse)), recovery->dest());
     262#endif
    259263            break;
    260264
     
    279283            CodeOrigin codeOrigin = exit.m_codeOriginForExitProfile;
    280284            if (ArrayProfile* arrayProfile = jit.baselineCodeBlockFor(codeOrigin)->getArrayProfile(codeOrigin.bytecodeIndex)) {
     285#if USE(JSVALUE64)
    281286                GPRReg usedRegister;
    282287                if (exit.m_jsValueSource.isAddress())
     
    284289                else
    285290                    usedRegister = exit.m_jsValueSource.gpr();
     291#else
     292                GPRReg usedRegister1;
     293                GPRReg usedRegister2;
     294                if (exit.m_jsValueSource.isAddress()) {
     295                    usedRegister1 = exit.m_jsValueSource.base();
     296                    usedRegister2 = InvalidGPRReg;
     297                } else {
     298                    usedRegister1 = exit.m_jsValueSource.payloadGPR();
     299                    if (exit.m_jsValueSource.hasKnownTag())
     300                        usedRegister2 = InvalidGPRReg;
     301                    else
     302                        usedRegister2 = exit.m_jsValueSource.tagGPR();
     303                }
     304#endif
    286305
    287306                GPRReg scratch1;
    288307                GPRReg scratch2;
     308#if USE(JSVALUE64)
    289309                scratch1 = AssemblyHelpers::selectScratchGPR(usedRegister);
    290310                scratch2 = AssemblyHelpers::selectScratchGPR(usedRegister, scratch1);
     311#else
     312                scratch1 = AssemblyHelpers::selectScratchGPR(usedRegister1, usedRegister2);
     313                scratch2 = AssemblyHelpers::selectScratchGPR(usedRegister1, usedRegister2, scratch1);
     314#endif
    291315
    292316                if (isARM64()) {
     
    303327                    jit.loadPtr(AssemblyHelpers::Address(exit.m_jsValueSource.asAddress()), value);
    304328                } else
    305                     value = exit.m_jsValueSource.gpr();
     329                    value = exit.m_jsValueSource.payloadGPR();
    306330
    307331                jit.load32(AssemblyHelpers::Address(value, JSCell::structureIDOffset()), scratch1);
    308332                jit.store32(scratch1, arrayProfile->addressOfLastSeenStructureID());
     333#if USE(JSVALUE64)
    309334                jit.load8(AssemblyHelpers::Address(value, JSCell::indexingTypeAndMiscOffset()), scratch1);
     335#else
     336                jit.load8(AssemblyHelpers::Address(scratch1, Structure::indexingTypeIncludingHistoryOffset()), scratch1);
     337#endif
    310338                jit.move(AssemblyHelpers::TrustedImm32(1), scratch2);
    311339                jit.lshift32(scratch1, scratch2);
     
    323351
    324352        if (MethodOfGettingAValueProfile profile = exit.m_valueProfile) {
     353#if USE(JSVALUE64)
    325354            if (exit.m_jsValueSource.isAddress()) {
    326355                // We can't be sure that we have a spare register. So use the tagTypeNumberRegister,
     
    331360            } else
    332361                profile.emitReportValue(jit, JSValueRegs(exit.m_jsValueSource.gpr()));
     362#else // not USE(JSVALUE64)
     363            if (exit.m_jsValueSource.isAddress()) {
     364                // Save a register so we can use it.
     365                GPRReg scratchPayload = AssemblyHelpers::selectScratchGPR(exit.m_jsValueSource.base());
     366                GPRReg scratchTag = AssemblyHelpers::selectScratchGPR(exit.m_jsValueSource.base(), scratchPayload);
     367                jit.pushToSave(scratchPayload);
     368                jit.pushToSave(scratchTag);
     369
     370                JSValueRegs scratch(scratchTag, scratchPayload);
     371               
     372                jit.loadValue(exit.m_jsValueSource.asAddress(), scratch);
     373                profile.emitReportValue(jit, scratch);
     374               
     375                jit.popToRestore(scratchTag);
     376                jit.popToRestore(scratchPayload);
     377            } else if (exit.m_jsValueSource.hasKnownTag()) {
     378                GPRReg scratchTag = AssemblyHelpers::selectScratchGPR(exit.m_jsValueSource.payloadGPR());
     379                jit.pushToSave(scratchTag);
     380                jit.move(AssemblyHelpers::TrustedImm32(exit.m_jsValueSource.tag()), scratchTag);
     381                JSValueRegs value(scratchTag, exit.m_jsValueSource.payloadGPR());
     382                profile.emitReportValue(jit, value);
     383                jit.popToRestore(scratchTag);
     384            } else
     385                profile.emitReportValue(jit, exit.m_jsValueSource.regs());
     386#endif // USE(JSVALUE64)
    333387        }
    334388    }
     
    379433
    380434        switch (recovery.technique()) {
     435        case UnboxedInt32InGPR:
     436        case UnboxedCellInGPR:
     437#if USE(JSVALUE64)
    381438        case InGPR:
    382         case UnboxedInt32InGPR:
    383439        case UnboxedInt52InGPR:
    384440        case UnboxedStrictInt52InGPR:
    385         case UnboxedCellInGPR:
    386441            jit.store64(recovery.gpr(), scratch + index);
    387442            break;
     443#else
     444        case UnboxedBooleanInGPR:
     445            jit.store32(
     446                recovery.gpr(),
     447                &bitwise_cast<EncodedValueDescriptor*>(scratch + index)->asBits.payload);
     448            break;
     449           
     450        case InPair:
     451            jit.store32(
     452                recovery.tagGPR(),
     453                &bitwise_cast<EncodedValueDescriptor*>(scratch + index)->asBits.tag);
     454            jit.store32(
     455                recovery.payloadGPR(),
     456                &bitwise_cast<EncodedValueDescriptor*>(scratch + index)->asBits.payload);
     457            break;
     458#endif
    388459
    389460        default:
     
    426497        case Int32DisplacedInJSStack:
    427498        case DoubleDisplacedInJSStack:
     499#if USE(JSVALUE64)
    428500        case Int52DisplacedInJSStack:
    429501        case StrictInt52DisplacedInJSStack:
     
    431503            jit.store64(GPRInfo::regT0, scratch + index);
    432504            break;
     505#else
     506            jit.load32(
     507                AssemblyHelpers::tagFor(recovery.virtualRegister()),
     508                GPRInfo::regT0);
     509            jit.load32(
     510                AssemblyHelpers::payloadFor(recovery.virtualRegister()),
     511                GPRInfo::regT1);
     512            jit.store32(
     513                GPRInfo::regT0,
     514                &bitwise_cast<EncodedValueDescriptor*>(scratch + index)->asBits.tag);
     515            jit.store32(
     516                GPRInfo::regT1,
     517                &bitwise_cast<EncodedValueDescriptor*>(scratch + index)->asBits.payload);
     518            break;
     519#endif
    433520
    434521        default:
     
    467554
    468555        switch (recovery.technique()) {
     556        case DisplacedInJSStack:
     557        case InFPR:
     558#if USE(JSVALUE64)
    469559        case InGPR:
    470560        case UnboxedCellInGPR:
    471         case DisplacedInJSStack:
    472561        case CellDisplacedInJSStack:
    473562        case BooleanDisplacedInJSStack:
    474         case InFPR:
    475563            jit.load64(scratch + index, GPRInfo::regT0);
    476564            jit.store64(GPRInfo::regT0, AssemblyHelpers::addressFor(operand));
    477565            break;
     566#else // not USE(JSVALUE64)
     567        case InPair:
     568            jit.load32(
     569                &bitwise_cast<EncodedValueDescriptor*>(scratch + index)->asBits.tag,
     570                GPRInfo::regT0);
     571            jit.load32(
     572                &bitwise_cast<EncodedValueDescriptor*>(scratch + index)->asBits.payload,
     573                GPRInfo::regT1);
     574            jit.store32(
     575                GPRInfo::regT0,
     576                AssemblyHelpers::tagFor(operand));
     577            jit.store32(
     578                GPRInfo::regT1,
     579                AssemblyHelpers::payloadFor(operand));
     580            break;
     581
     582        case UnboxedCellInGPR:
     583        case CellDisplacedInJSStack:
     584            jit.load32(
     585                &bitwise_cast<EncodedValueDescriptor*>(scratch + index)->asBits.payload,
     586                GPRInfo::regT0);
     587            jit.store32(
     588                AssemblyHelpers::TrustedImm32(JSValue::CellTag),
     589                AssemblyHelpers::tagFor(operand));
     590            jit.store32(
     591                GPRInfo::regT0,
     592                AssemblyHelpers::payloadFor(operand));
     593            break;
     594
     595        case UnboxedBooleanInGPR:
     596        case BooleanDisplacedInJSStack:
     597            jit.load32(
     598                &bitwise_cast<EncodedValueDescriptor*>(scratch + index)->asBits.payload,
     599                GPRInfo::regT0);
     600            jit.store32(
     601                AssemblyHelpers::TrustedImm32(JSValue::BooleanTag),
     602                AssemblyHelpers::tagFor(operand));
     603            jit.store32(
     604                GPRInfo::regT0,
     605                AssemblyHelpers::payloadFor(operand));
     606            break;
     607#endif // USE(JSVALUE64)
    478608
    479609        case UnboxedInt32InGPR:
    480610        case Int32DisplacedInJSStack:
     611#if USE(JSVALUE64)
    481612            jit.load64(scratch + index, GPRInfo::regT0);
    482613            jit.zeroExtend32ToPtr(GPRInfo::regT0, GPRInfo::regT0);
    483614            jit.or64(GPRInfo::tagTypeNumberRegister, GPRInfo::regT0);
    484615            jit.store64(GPRInfo::regT0, AssemblyHelpers::addressFor(operand));
    485             break;
    486 
     616#else
     617            jit.load32(
     618                &bitwise_cast<EncodedValueDescriptor*>(scratch + index)->asBits.payload,
     619                GPRInfo::regT0);
     620            jit.store32(
     621                AssemblyHelpers::TrustedImm32(JSValue::Int32Tag),
     622                AssemblyHelpers::tagFor(operand));
     623            jit.store32(
     624                GPRInfo::regT0,
     625                AssemblyHelpers::payloadFor(operand));
     626#endif
     627            break;
     628
     629#if USE(JSVALUE64)
    487630        case UnboxedInt52InGPR:
    488631        case Int52DisplacedInJSStack:
     
    500643            jit.store64(GPRInfo::regT0, AssemblyHelpers::addressFor(operand));
    501644            break;
     645#endif
    502646
    503647        case UnboxedDoubleInFPR:
     
    506650            jit.loadDouble(MacroAssembler::Address(GPRInfo::regT0), FPRInfo::fpRegT0);
    507651            jit.purifyNaN(FPRInfo::fpRegT0);
     652#if USE(JSVALUE64)
    508653            jit.boxDouble(FPRInfo::fpRegT0, GPRInfo::regT0);
    509654            jit.store64(GPRInfo::regT0, AssemblyHelpers::addressFor(operand));
     655#else
     656            jit.storeDouble(FPRInfo::fpRegT0, AssemblyHelpers::addressFor(operand));
     657#endif
    510658            break;
    511659
    512660        case Constant:
     661#if USE(JSVALUE64)
    513662            jit.store64(
    514663                AssemblyHelpers::TrustedImm64(JSValue::encode(recovery.constant())),
    515664                AssemblyHelpers::addressFor(operand));
     665#else
     666            jit.store32(
     667                AssemblyHelpers::TrustedImm32(recovery.constant().tag()),
     668                AssemblyHelpers::tagFor(operand));
     669            jit.store32(
     670                AssemblyHelpers::TrustedImm32(recovery.constant().payload()),
     671                AssemblyHelpers::payloadFor(operand));
     672#endif
    516673            break;
    517674
     
    580737    adjustAndJumpToTarget(vm, jit, exit);
    581738}
    582 #endif // USE(JSVALUE64)
    583739
    584740void JIT_OPERATION OSRExit::debugOperationPrintSpeculationFailure(ExecState* exec, void* debugInfoRaw, void* scratch)
  • trunk/Source/JavaScriptCore/jit/GPRInfo.h

    r219740 r220318  
    140140        return m_base;
    141141    }
    142    
     142
     143    GPRReg payloadGPR() const { return gpr(); }
     144
    143145    JSValueRegs regs() const
    144146    {
Note: See TracChangeset for help on using the changeset viewer.