Ignore:
Timestamp:
Dec 10, 2016, 5:14:37 PM (9 years ago)
Author:
[email protected]
Message:

Unreviewed, rolling out r209653, r209654, r209663, and
r209673.
https://bugs.webkit.org/show_bug.cgi?id=165739

speedometer crashes (Requested by pizlo on #webkit).

Reverted changesets:

"JSVALUE64: Pass arguments in platform argument registers when
making JavaScript calls"
https://bugs.webkit.org/show_bug.cgi?id=160355
http://trac.webkit.org/changeset/209653

"Unreviewed build fix for 32 bit builds."
http://trac.webkit.org/changeset/209654

"Unreviewed build fix for the CLOOP after r209653"
http://trac.webkit.org/changeset/209663

"REGRESSION(r209653) Crash in CallFrameShuffler::snapshot()"
https://bugs.webkit.org/show_bug.cgi?id=165728
http://trac.webkit.org/changeset/209673

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp

    r209653 r209678  
    8181}
    8282
    83 GPRReg SpeculativeJIT::fillJSValue(Edge edge, GPRReg gprToUse)
     83GPRReg SpeculativeJIT::fillJSValue(Edge edge)
    8484{
    8585    VirtualRegister virtualRegister = edge->virtualRegister();
     
    8888    switch (info.registerFormat()) {
    8989    case DataFormatNone: {
    90         GPRReg gpr = allocate(gprToUse);
     90        GPRReg gpr = allocate();
    9191
    9292        if (edge->hasConstant()) {
     
    121121        // If not, we'll zero extend in place, so mark on the info that this is now type DataFormatInt32, not DataFormatJSInt32.
    122122        if (m_gprs.isLocked(gpr)) {
    123             GPRReg result = allocate(gprToUse);
    124             m_jit.or64(GPRInfo::tagTypeNumberRegister, gpr, result);
    125             return result;
    126         }
    127         if (gprToUse != InvalidGPRReg && gpr != gprToUse) {
    128             GPRReg result = allocate(gprToUse);
     123            GPRReg result = allocate();
    129124            m_jit.or64(GPRInfo::tagTypeNumberRegister, gpr, result);
    130125            return result;
     
    144139    case DataFormatJSBoolean: {
    145140        GPRReg gpr = info.gpr();
    146         if (gprToUse != InvalidGPRReg && gpr != gprToUse) {
    147             GPRReg result = allocate(gprToUse);
    148             m_jit.move(gpr, result);
    149             return result;
    150         }
    151141        m_gprs.lock(gpr);
    152142        return gpr;
     
    643633{
    644634    CallLinkInfo::CallType callType;
    645     ArgumentsLocation argumentsLocation = StackArgs;
    646635    bool isVarargs = false;
    647636    bool isForwardVarargs = false;
     
    726715    GPRReg calleeGPR = InvalidGPRReg;
    727716    CallFrameShuffleData shuffleData;
    728     std::optional<JSValueOperand> tailCallee;
    729     std::optional<GPRTemporary> calleeGPRTemporary;
    730 
    731     incrementCounter(&m_jit, VM::DFGCaller);
    732 
     717   
    733718    ExecutableBase* executable = nullptr;
    734719    FunctionExecutable* functionExecutable = nullptr;
     
    749734        unsigned numUsedStackSlots = m_jit.graph().m_nextMachineLocal;
    750735       
    751         incrementCounter(&m_jit, VM::CallVarargs);
    752736        if (isForwardVarargs) {
    753737            flushRegisters();
     
    858842
    859843        if (isTail) {
    860             incrementCounter(&m_jit, VM::TailCall);
    861844            Edge calleeEdge = m_jit.graph().child(node, 0);
    862             // We can't get the a specific register for the callee, since that will just move
    863             // from any current register.  When we silent fill in the slow path we'll fill
    864             // the original register and won't have the callee in the right register.
    865             // Therefore we allocate a temp register for the callee and move ourselves.
    866             tailCallee.emplace(this, calleeEdge);
    867             GPRReg tailCalleeGPR = tailCallee->gpr();
    868             calleeGPR = argumentRegisterForCallee();
    869             if (tailCalleeGPR != calleeGPR)
    870                 calleeGPRTemporary = GPRTemporary(this, calleeGPR);
     845            JSValueOperand callee(this, calleeEdge);
     846            calleeGPR = callee.gpr();
    871847            if (!isDirect)
    872                 tailCallee->use();
    873 
    874             argumentsLocation = argumentsLocationFor(numAllocatedArgs);
    875             shuffleData.argumentsInRegisters = argumentsLocation != StackArgs;
     848                callee.use();
     849
    876850            shuffleData.tagTypeNumber = GPRInfo::tagTypeNumberRegister;
    877851            shuffleData.numLocals = m_jit.graph().frameRegisterCount();
    878             shuffleData.callee = ValueRecovery::inGPR(tailCalleeGPR, DataFormatJS);
     852            shuffleData.callee = ValueRecovery::inGPR(calleeGPR, DataFormatJS);
    879853            shuffleData.args.resize(numAllocatedArgs);
    880854
     
    891865
    892866            shuffleData.setupCalleeSaveRegisters(m_jit.codeBlock());
    893         } else if (node->op() == CallEval) {
    894             // CallEval is handled with the arguments in the stack
     867        } else {
    895868            m_jit.store32(MacroAssembler::TrustedImm32(numPassedArgs), JITCompiler::calleeFramePayloadSlot(CallFrameSlot::argumentCount));
    896869
     
    906879            for (unsigned i = numPassedArgs; i < numAllocatedArgs; ++i)
    907880                m_jit.storeTrustedValue(jsUndefined(), JITCompiler::calleeArgumentSlot(i));
    908 
    909             incrementCounter(&m_jit, VM::CallEval);
    910         } else {
    911             for (unsigned i = numPassedArgs; i-- > 0;) {
    912                 GPRReg platformArgGPR = argumentRegisterForFunctionArgument(i);
    913                 Edge argEdge = m_jit.graph().m_varArgChildren[node->firstChild() + 1 + i];
    914                 JSValueOperand arg(this, argEdge, platformArgGPR);
    915                 GPRReg argGPR = arg.gpr();
    916                 ASSERT(argGPR == platformArgGPR || platformArgGPR == InvalidGPRReg);
    917 
    918                 // Only free the non-argument registers at this point.
    919                 if (platformArgGPR == InvalidGPRReg) {
    920                     use(argEdge);
    921                     m_jit.store64(argGPR, JITCompiler::calleeArgumentSlot(i));
    922                 }
    923             }
    924 
    925             // Use the argument edges for arguments passed in registers.
    926             for (unsigned i = numPassedArgs; i-- > 0;) {
    927                 GPRReg argGPR = argumentRegisterForFunctionArgument(i);
    928                 if (argGPR != InvalidGPRReg) {
    929                     Edge argEdge = m_jit.graph().m_varArgChildren[node->firstChild() + 1 + i];
    930                     use(argEdge);
    931                 }
    932             }
    933 
    934             GPRTemporary argCount(this, argumentRegisterForArgumentCount());
    935             GPRReg argCountGPR = argCount.gpr();
    936             m_jit.move(TrustedImm32(numPassedArgs), argCountGPR);
    937             argumentsLocation = argumentsLocationFor(numAllocatedArgs);
    938 
    939             for (unsigned i = numPassedArgs; i < numAllocatedArgs; ++i) {
    940                 GPRReg platformArgGPR = argumentRegisterForFunctionArgument(i);
    941 
    942                 if (platformArgGPR == InvalidGPRReg)
    943                     m_jit.storeTrustedValue(jsUndefined(), JITCompiler::calleeArgumentSlot(i));
    944                 else {
    945                     GPRTemporary argumentTemp(this, platformArgGPR);
    946                     m_jit.move(TrustedImm64(JSValue::encode(jsUndefined())), argumentTemp.gpr());
    947                 }
    948             }
    949881        }
    950882    }
     
    952884    if (!isTail || isVarargs || isForwardVarargs) {
    953885        Edge calleeEdge = m_jit.graph().child(node, 0);
    954         JSValueOperand callee(this, calleeEdge, argumentRegisterForCallee());
     886        JSValueOperand callee(this, calleeEdge);
    955887        calleeGPR = callee.gpr();
    956888        callee.use();
    957         if (argumentsLocation == StackArgs)
    958             m_jit.store64(calleeGPR, JITCompiler::calleeFrameSlot(CallFrameSlot::callee));
     889        m_jit.store64(calleeGPR, JITCompiler::calleeFrameSlot(CallFrameSlot::callee));
    959890
    960891        flushRegisters();
     
    983914   
    984915    CallLinkInfo* callLinkInfo = m_jit.codeBlock()->addCallLinkInfo();
    985     callLinkInfo->setUpCall(callType, argumentsLocation, m_currentNode->origin.semantic, calleeGPR);
     916    callLinkInfo->setUpCall(callType, m_currentNode->origin.semantic, calleeGPR);
    986917
    987918    if (node->op() == CallEval) {
     
    1024955            RELEASE_ASSERT(node->op() == DirectTailCall);
    1025956           
    1026             if (calleeGPRTemporary != std::nullopt)
    1027                 m_jit.move(tailCallee->gpr(), calleeGPRTemporary->gpr());
    1028 
    1029957            JITCompiler::PatchableJump patchableJump = m_jit.patchableJump();
    1030958            JITCompiler::Label mainPath = m_jit.label();
    1031 
    1032             incrementCounter(&m_jit, VM::TailCall);
    1033             incrementCounter(&m_jit, VM::DirectCall);
    1034959           
    1035960            m_jit.emitStoreCallSiteIndex(callSite);
     
    1047972            silentFillAllRegisters(InvalidGPRReg);
    1048973            m_jit.exceptionCheck();
    1049             if (calleeGPRTemporary != std::nullopt)
    1050                 m_jit.move(tailCallee->gpr(), calleeGPRTemporary->gpr());
    1051974            m_jit.jump().linkTo(mainPath, &m_jit);
    1052975           
     
    1059982        JITCompiler::Label mainPath = m_jit.label();
    1060983       
    1061         incrementCounter(&m_jit, VM::DirectCall);
    1062 
    1063984        m_jit.emitStoreCallSiteIndex(callSite);
    1064985       
     
    1068989        JITCompiler::Label slowPath = m_jit.label();
    1069990        if (isX86())
    1070             m_jit.pop(GPRInfo::nonArgGPR0);
    1071 
    1072         m_jit.move(MacroAssembler::TrustedImmPtr(callLinkInfo), GPRInfo::nonArgGPR0); // Link info needs to be in nonArgGPR0
    1073         JITCompiler::Call slowCall = m_jit.nearCall();
    1074 
     991            m_jit.pop(JITCompiler::selectScratchGPR(calleeGPR));
     992
     993        callOperation(operationLinkDirectCall, callLinkInfo, calleeGPR);
    1075994        m_jit.exceptionCheck();
    1076995        m_jit.jump().linkTo(mainPath, &m_jit);
     
    1079998       
    1080999        setResultAndResetStack();
    1081 
    1082         m_jit.addJSDirectCall(call, slowCall, slowPath, callLinkInfo);
     1000       
     1001        m_jit.addJSDirectCall(call, slowPath, callLinkInfo);
    10831002        return;
    10841003    }
    1085 
    1086     if (isTail && calleeGPRTemporary != std::nullopt)
    1087         m_jit.move(tailCallee->gpr(), calleeGPRTemporary->gpr());
    1088 
     1004   
    10891005    m_jit.emitStoreCallSiteIndex(callSite);
    10901006   
     
    11101026    if (node->op() == TailCall) {
    11111027        CallFrameShuffler callFrameShuffler(m_jit, shuffleData);
    1112         if (argumentsLocation == StackArgs)
    1113             callFrameShuffler.setCalleeJSValueRegs(JSValueRegs(argumentRegisterForCallee()));
     1028        callFrameShuffler.setCalleeJSValueRegs(JSValueRegs(GPRInfo::regT0));
    11141029        callFrameShuffler.prepareForSlowPath();
    1115     } else if (isTail)
    1116         m_jit.emitRestoreCalleeSaves();
    1117 
    1118     m_jit.move(MacroAssembler::TrustedImmPtr(callLinkInfo), GPRInfo::nonArgGPR0); // Link info needs to be in nonArgGPR0
     1030    } else {
     1031        m_jit.move(calleeGPR, GPRInfo::regT0); // Callee needs to be in regT0
     1032
     1033        if (isTail)
     1034            m_jit.emitRestoreCalleeSaves(); // This needs to happen after we moved calleeGPR to regT0
     1035    }
     1036
     1037    m_jit.move(MacroAssembler::TrustedImmPtr(callLinkInfo), GPRInfo::regT2); // Link info needs to be in regT2
    11191038    JITCompiler::Call slowCall = m_jit.nearCall();
    11201039
    11211040    done.link(&m_jit);
    11221041
    1123     if (isTail) {
    1124         tailCallee = std::nullopt;
    1125         calleeGPRTemporary = std::nullopt;
     1042    if (isTail)
    11261043        m_jit.abortWithReason(JITDidReturnFromTailCall);
    1127     } else
     1044    else
    11281045        setResultAndResetStack();
    11291046
     
    42504167    }
    42514168
    4252     case GetArgumentRegister:
    4253         break;
    4254            
    42554169    case GetRestLength: {
    42564170        compileGetRestLength(node);
Note: See TracChangeset for help on using the changeset viewer.