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/ftl/FTLLowerDFGToB3.cpp

    r209653 r209678  
    197197        m_proc.addFastConstant(m_tagMask->key());
    198198       
    199         // Store out callee and argument count for possible OSR exit.
    200         m_out.store64(m_out.argumentRegister(argumentRegisterForCallee()), addressFor(CallFrameSlot::callee));
    201         m_out.store32(m_out.argumentRegisterInt32(argumentRegisterForArgumentCount()), payloadFor(CallFrameSlot::argumentCount));
    202 
    203199        m_out.storePtr(m_out.constIntPtr(codeBlock()), addressFor(CallFrameSlot::codeBlock));
    204200
     
    252248        availabilityMap().clear();
    253249        availabilityMap().m_locals = Operands<Availability>(codeBlock()->numParameters(), 0);
    254 
    255         Vector<Node*, 8> argumentNodes;
    256         Vector<LValue, 8> argumentValues;
    257 
    258         argumentNodes.resize(codeBlock()->numParameters());
    259         argumentValues.resize(codeBlock()->numParameters());
    260 
    261         m_highBlock = m_graph.block(0);
    262 
    263250        for (unsigned i = codeBlock()->numParameters(); i--;) {
    264             Node* node = m_graph.m_argumentsForChecking[i];
     251            availabilityMap().m_locals.argument(i) =
     252                Availability(FlushedAt(FlushedJSValue, virtualRegisterForArgument(i)));
     253        }
     254        m_node = nullptr;
     255        m_origin = NodeOrigin(CodeOrigin(0), CodeOrigin(0), true);
     256        for (unsigned i = codeBlock()->numParameters(); i--;) {
     257            Node* node = m_graph.m_arguments[i];
    265258            VirtualRegister operand = virtualRegisterForArgument(i);
    266259           
    267             LValue jsValue = nullptr;
    268 
     260            LValue jsValue = m_out.load64(addressFor(operand));
     261           
    269262            if (node) {
    270                 if (i < NUMBER_OF_JS_FUNCTION_ARGUMENT_REGISTERS) {
    271                     availabilityMap().m_locals.argument(i) = Availability(node);
    272                     jsValue = m_out.argumentRegister(GPRInfo::toArgumentRegister(node->argumentRegisterIndex()));
    273 
    274                     setJSValue(node, jsValue);
    275                 } else {
    276                     availabilityMap().m_locals.argument(i) =
    277                         Availability(FlushedAt(FlushedJSValue, operand));
    278                     jsValue = m_out.load64(addressFor(virtualRegisterForArgument(i)));
    279                 }
    280            
    281                 DFG_ASSERT(m_graph, node, node->hasArgumentRegisterIndex() || operand == node->stackAccessData()->machineLocal);
     263                DFG_ASSERT(m_graph, node, operand == node->stackAccessData()->machineLocal);
    282264               
    283265                // This is a hack, but it's an effective one. It allows us to do CSE on the
     
    287269                m_loadedArgumentValues.add(node, jsValue);
    288270            }
    289 
    290             argumentNodes[i] = node;
    291             argumentValues[i] = jsValue;
    292         }
    293 
    294         m_node = nullptr;
    295         m_origin = NodeOrigin(CodeOrigin(0), CodeOrigin(0), true);
    296         for (unsigned i = codeBlock()->numParameters(); i--;) {
    297             Node* node = argumentNodes[i];
    298            
    299             if (!node)
    300                 continue;
    301 
    302             LValue jsValue = argumentValues[i];
    303 
     271           
    304272            switch (m_graph.m_argumentFormats[i]) {
    305273            case FlushedInt32:
     
    845813        case GetArgumentCountIncludingThis:
    846814            compileGetArgumentCountIncludingThis();
    847             break;
    848         case GetArgumentRegister:
    849             compileGetArgumentRegister();
    850815            break;
    851816        case GetScope:
     
    54385403    }
    54395404   
    5440     void compileGetArgumentRegister()
    5441     {
    5442         // We might have already have a value for this node.
    5443         if (LValue value = m_loadedArgumentValues.get(m_node)) {
    5444             setJSValue(value);
    5445             return;
    5446         }
    5447         setJSValue(m_out.argumentRegister(GPRInfo::toArgumentRegister(m_node->argumentRegisterIndex())));
    5448     }
    5449    
    54505405    void compileGetScope()
    54515406    {
     
    58605815        Vector<ConstrainedValue> arguments;
    58615816
    5862         // Make sure that the callee goes into argumentRegisterForCallee() because that's where
    5863         // the slow path thunks expect the callee to be.
    5864         GPRReg calleeReg = argumentRegisterForCallee();
    5865         arguments.append(ConstrainedValue(jsCallee, ValueRep::reg(calleeReg)));
     5817        // Make sure that the callee goes into GPR0 because that's where the slow path thunks expect the
     5818        // callee to be.
     5819        arguments.append(ConstrainedValue(jsCallee, ValueRep::reg(GPRInfo::regT0)));
    58665820
    58675821        auto addArgument = [&] (LValue value, VirtualRegister reg, int offset) {
     
    58715825        };
    58725826
    5873         ArgumentsLocation argLocation = argumentsLocationFor(numArgs);
    5874         arguments.append(ConstrainedValue(jsCallee, ValueRep::reg(calleeReg)));
    5875         arguments.append(ConstrainedValue(m_out.constInt32(numArgs), ValueRep::reg(argumentRegisterForArgumentCount())));
    5876 
    5877         for (unsigned i = 0; i < numArgs; ++i) {
    5878             if (i < NUMBER_OF_JS_FUNCTION_ARGUMENT_REGISTERS)
    5879                 arguments.append(ConstrainedValue(lowJSValue(m_graph.varArgChild(node, 1 + i)), ValueRep::reg(argumentRegisterForFunctionArgument(i))));
    5880             else
    5881                 addArgument(lowJSValue(m_graph.varArgChild(node, 1 + i)), virtualRegisterForArgument(i), 0);
    5882         }
     5827        addArgument(jsCallee, VirtualRegister(CallFrameSlot::callee), 0);
     5828        addArgument(m_out.constInt32(numArgs), VirtualRegister(CallFrameSlot::argumentCount), PayloadOffset);
     5829        for (unsigned i = 0; i < numArgs; ++i)
     5830            addArgument(lowJSValue(m_graph.varArgChild(node, 1 + i)), virtualRegisterForArgument(i), 0);
    58835831
    58845832        PatchpointValue* patchpoint = m_out.patchpoint(Int64);
     
    59095857                CallLinkInfo* callLinkInfo = jit.codeBlock()->addCallLinkInfo();
    59105858
    5911                 incrementCounter(&jit, VM::FTLCaller);
    5912 
    59135859                CCallHelpers::DataLabelPtr targetToCheck;
    59145860                CCallHelpers::Jump slowPath = jit.branchPtrWithPatch(
    5915                     CCallHelpers::NotEqual, calleeReg, targetToCheck,
     5861                    CCallHelpers::NotEqual, GPRInfo::regT0, targetToCheck,
    59165862                    CCallHelpers::TrustedImmPtr(0));
    59175863
     
    59215867                slowPath.link(&jit);
    59225868
    5923                 jit.move(CCallHelpers::TrustedImmPtr(callLinkInfo), GPRInfo::nonArgGPR0);
     5869                jit.move(CCallHelpers::TrustedImmPtr(callLinkInfo), GPRInfo::regT2);
    59245870                CCallHelpers::Call slowCall = jit.nearCall();
    59255871                done.link(&jit);
     
    59275873                callLinkInfo->setUpCall(
    59285874                    node->op() == Construct ? CallLinkInfo::Construct : CallLinkInfo::Call,
    5929                     argLocation, node->origin.semantic, argumentRegisterForCallee());
     5875                    node->origin.semantic, GPRInfo::regT0);
    59305876
    59315877                jit.addPtr(
     
    59365882                    [=] (LinkBuffer& linkBuffer) {
    59375883                        MacroAssemblerCodePtr linkCall =
    5938                             linkBuffer.vm().getJITCallThunkEntryStub(linkCallThunkGenerator).entryFor(callLinkInfo->argumentsLocation());
     5884                            linkBuffer.vm().getCTIStub(linkCallThunkGenerator).code();
    59395885                        linkBuffer.link(slowCall, FunctionPtr(linkCall.executableAddress()));
    59405886
     
    59805926        Vector<ConstrainedValue> arguments;
    59815927       
    5982         // Make sure that the callee goes into argumentRegisterForCallee() because that's where
    5983         // the slow path thunks expect the callee to be.
    5984         GPRReg calleeReg = argumentRegisterForCallee();
    5985         arguments.append(ConstrainedValue(jsCallee, ValueRep::reg(calleeReg)));
     5928        arguments.append(ConstrainedValue(jsCallee, ValueRep::SomeRegister));
    59865929        if (!isTail) {
    59875930            auto addArgument = [&] (LValue value, VirtualRegister reg, int offset) {
     
    59905933                arguments.append(ConstrainedValue(value, ValueRep::stackArgument(offsetFromSP)));
    59915934            };
    5992 
    5993             arguments.append(ConstrainedValue(jsCallee, ValueRep::reg(calleeReg)));
    5994 #if ENABLE(CALLER_SPILLS_CALLEE)
     5935           
    59955936            addArgument(jsCallee, VirtualRegister(CallFrameSlot::callee), 0);
    5996 #endif
    5997             arguments.append(ConstrainedValue(m_out.constInt32(numPassedArgs), ValueRep::reg(argumentRegisterForArgumentCount())));
    5998 #if ENABLE(CALLER_SPILLS_ARGCOUNT)
    59995937            addArgument(m_out.constInt32(numPassedArgs), VirtualRegister(CallFrameSlot::argumentCount), PayloadOffset);
    6000 #endif
    6001            
    6002             for (unsigned i = 0; i < numPassedArgs; ++i) {
    6003                 if (i < NUMBER_OF_JS_FUNCTION_ARGUMENT_REGISTERS)
    6004                     arguments.append(ConstrainedValue(lowJSValue(m_graph.varArgChild(node, 1 + i)), ValueRep::reg(argumentRegisterForFunctionArgument(i))));
    6005                 else
    6006                     addArgument(lowJSValue(m_graph.varArgChild(node, 1 + i)), virtualRegisterForArgument(i), 0);
    6007             }
    6008             for (unsigned i = numPassedArgs; i < numAllocatedArgs; ++i) {
    6009                 if (i < NUMBER_OF_JS_FUNCTION_ARGUMENT_REGISTERS)
    6010                     arguments.append(ConstrainedValue(m_out.constInt64(JSValue::encode(jsUndefined())), ValueRep::reg(argumentRegisterForFunctionArgument(i))));
    6011                 else
    6012                     addArgument(m_out.constInt64(JSValue::encode(jsUndefined())), virtualRegisterForArgument(i), 0);
    6013             }
     5938            for (unsigned i = 0; i < numPassedArgs; ++i)
     5939                addArgument(lowJSValue(m_graph.varArgChild(node, 1 + i)), virtualRegisterForArgument(i), 0);
     5940            for (unsigned i = numPassedArgs; i < numAllocatedArgs; ++i)
     5941                addArgument(m_out.constInt64(JSValue::encode(jsUndefined())), virtualRegisterForArgument(i), 0);
    60145942        } else {
    60155943            for (unsigned i = 0; i < numPassedArgs; ++i)
     
    60535981                   
    60545982                    RegisterSet toSave = params.unavailableRegisters();
    6055                     shuffleData.argumentsInRegisters = true;
    60565983                    shuffleData.callee = ValueRecovery::inGPR(calleeGPR, DataFormatCell);
    60575984                    toSave.set(calleeGPR);
     
    60725999                    CCallHelpers::PatchableJump patchableJump = jit.patchableJump();
    60736000                    CCallHelpers::Label mainPath = jit.label();
    6074 
    6075                     incrementCounter(&jit, VM::FTLCaller);
    6076                     incrementCounter(&jit, VM::TailCall);
    6077                     incrementCounter(&jit, VM::DirectCall);
    6078 
     6001                   
    60796002                    jit.store32(
    60806003                        CCallHelpers::TrustedImm32(callSiteIndex.bits()),
     
    60976020                   
    60986021                    callLinkInfo->setUpCall(
    6099                         CallLinkInfo::DirectTailCall, argumentsLocationFor(numPassedArgs), node->origin.semantic, InvalidGPRReg);
     6022                        CallLinkInfo::DirectTailCall, node->origin.semantic, InvalidGPRReg);
    61006023                    callLinkInfo->setExecutableDuringCompilation(executable);
    61016024                    if (numAllocatedArgs > numPassedArgs)
     
    61206043                CCallHelpers::Label mainPath = jit.label();
    61216044
    6122                 incrementCounter(&jit, VM::FTLCaller);
    6123                 incrementCounter(&jit, VM::DirectCall);
    6124 
    61256045                jit.store32(
    61266046                    CCallHelpers::TrustedImm32(callSiteIndex.bits()),
     
    61346054                callLinkInfo->setUpCall(
    61356055                    isConstruct ? CallLinkInfo::DirectConstruct : CallLinkInfo::DirectCall,
    6136                     argumentsLocationFor(numPassedArgs), node->origin.semantic, InvalidGPRReg);
     6056                    node->origin.semantic, InvalidGPRReg);
    61376057                callLinkInfo->setExecutableDuringCompilation(executable);
    61386058                if (numAllocatedArgs > numPassedArgs)
     
    61456065                        CCallHelpers::Label slowPath = jit.label();
    61466066                        if (isX86())
    6147                             jit.pop(GPRInfo::nonArgGPR0);
    6148 
    6149                         jit.move(CCallHelpers::TrustedImmPtr(callLinkInfo), GPRInfo::nonArgGPR0); // Link info needs to be in nonArgGPR0
    6150                         CCallHelpers::Call slowCall = jit.nearCall();
    6151                         exceptions->append(jit.emitExceptionCheck(AssemblyHelpers::NormalExceptionCheck, AssemblyHelpers::FarJumpWidth));
     6067                            jit.pop(CCallHelpers::selectScratchGPR(calleeGPR));
     6068                       
     6069                        callOperation(
     6070                            *state, params.unavailableRegisters(), jit,
     6071                            node->origin.semantic, exceptions.get(), operationLinkDirectCall,
     6072                            InvalidGPRReg, CCallHelpers::TrustedImmPtr(callLinkInfo),
     6073                            calleeGPR).call();
    61526074                        jit.jump().linkTo(mainPath, &jit);
    61536075                       
     
    61586080                               
    61596081                                linkBuffer.link(call, slowPathLocation);
    6160                                 MacroAssemblerCodePtr linkCall =
    6161                                     linkBuffer.vm().getJITCallThunkEntryStub(linkDirectCallThunkGenerator).entryFor(callLinkInfo->argumentsLocation());
    6162                                 linkBuffer.link(slowCall, FunctionPtr(linkCall.executableAddress()));
    61636082                               
    61646083                                callLinkInfo->setCallLocations(
     
    61926111        Vector<ConstrainedValue> arguments;
    61936112
    6194         GPRReg calleeReg = argumentRegisterForCallee();
    6195         arguments.append(ConstrainedValue(jsCallee, ValueRep::reg(calleeReg)));
     6113        arguments.append(ConstrainedValue(jsCallee, ValueRep::reg(GPRInfo::regT0)));
    61966114
    61976115        for (unsigned i = 0; i < numArgs; ++i) {
     
    62276145                CallSiteIndex callSiteIndex = state->jitCode->common.addUniqueCallSiteIndex(codeOrigin);
    62286146
    6229                 incrementCounter(&jit, VM::FTLCaller);
    6230                 incrementCounter(&jit, VM::TailCall);
    6231 
    62326147                CallFrameShuffleData shuffleData;
    6233                 shuffleData.argumentsInRegisters = true;
    62346148                shuffleData.numLocals = state->jitCode->common.frameRegisterCount;
    6235                 shuffleData.callee = ValueRecovery::inGPR(calleeReg, DataFormatJS);
     6149                shuffleData.callee = ValueRecovery::inGPR(GPRInfo::regT0, DataFormatJS);
    62366150
    62376151                for (unsigned i = 0; i < numArgs; ++i)
     
    62446158                CCallHelpers::DataLabelPtr targetToCheck;
    62456159                CCallHelpers::Jump slowPath = jit.branchPtrWithPatch(
    6246                     CCallHelpers::NotEqual, calleeReg, targetToCheck,
     6160                    CCallHelpers::NotEqual, GPRInfo::regT0, targetToCheck,
    62476161                    CCallHelpers::TrustedImmPtr(0));
    62486162
     
    62626176
    62636177                CallFrameShuffler slowPathShuffler(jit, shuffleData);
     6178                slowPathShuffler.setCalleeJSValueRegs(JSValueRegs(GPRInfo::regT0));
    62646179                slowPathShuffler.prepareForSlowPath();
    62656180
    6266                 jit.move(CCallHelpers::TrustedImmPtr(callLinkInfo), GPRInfo::nonArgGPR0);
     6181                jit.move(CCallHelpers::TrustedImmPtr(callLinkInfo), GPRInfo::regT2);
    62676182                CCallHelpers::Call slowCall = jit.nearCall();
    62686183
    62696184                jit.abortWithReason(JITDidReturnFromTailCall);
    62706185
    6271                 callLinkInfo->setUpCall(CallLinkInfo::TailCall, argumentsLocationFor(numArgs), codeOrigin, calleeReg);
     6186                callLinkInfo->setUpCall(CallLinkInfo::TailCall, codeOrigin, GPRInfo::regT0);
    62726187
    62736188                jit.addLinkTask(
    62746189                    [=] (LinkBuffer& linkBuffer) {
    62756190                        MacroAssemblerCodePtr linkCall =
    6276                             linkBuffer.vm().getJITCallThunkEntryStub(linkCallThunkGenerator).entryFor(callLinkInfo->argumentsLocation());
     6191                            linkBuffer.vm().getCTIStub(linkCallThunkGenerator).code();
    62776192                        linkBuffer.link(slowCall, FunctionPtr(linkCall.executableAddress()));
    62786193
     
    63646279
    63656280                CallLinkInfo* callLinkInfo = jit.codeBlock()->addCallLinkInfo();
    6366                 ArgumentsLocation argumentsLocation = StackArgs;
    63676281
    63686282                RegisterSet usedRegisters = RegisterSet::allRegisters();
     
    65146428                    jit.emitRestoreCalleeSaves();
    65156429                ASSERT(!usedRegisters.get(GPRInfo::regT2));
    6516                 jit.move(CCallHelpers::TrustedImmPtr(callLinkInfo), GPRInfo::nonArgGPR0);
     6430                jit.move(CCallHelpers::TrustedImmPtr(callLinkInfo), GPRInfo::regT2);
    65176431                CCallHelpers::Call slowCall = jit.nearCall();
    65186432               
     
    65226436                    done.link(&jit);
    65236437               
    6524                 callLinkInfo->setUpCall(callType, argumentsLocation, node->origin.semantic, GPRInfo::regT0);
     6438                callLinkInfo->setUpCall(callType, node->origin.semantic, GPRInfo::regT0);
    65256439
    65266440                jit.addPtr(
     
    65316445                    [=] (LinkBuffer& linkBuffer) {
    65326446                        MacroAssemblerCodePtr linkCall =
    6533                             linkBuffer.vm().getJITCallThunkEntryStub(linkCallThunkGenerator).entryFor(StackArgs);
     6447                            linkBuffer.vm().getCTIStub(linkCallThunkGenerator).code();
    65346448                        linkBuffer.link(slowCall, FunctionPtr(linkCall.executableAddress()));
    65356449                       
     
    66326546                exceptionHandle->scheduleExitCreationForUnwind(params, callSiteIndex);
    66336547
    6634                 incrementCounter(&jit, VM::FTLCaller);
    6635                 incrementCounter(&jit, VM::CallVarargs);
    6636                
    66376548                jit.store32(
    66386549                    CCallHelpers::TrustedImm32(callSiteIndex.bits()),
     
    66406551
    66416552                CallLinkInfo* callLinkInfo = jit.codeBlock()->addCallLinkInfo();
    6642                 ArgumentsLocation argumentsLocation = StackArgs;
    66436553                CallVarargsData* data = node->callVarargsData();
    66446554
     
    68016711                if (isTailCall)
    68026712                    jit.emitRestoreCalleeSaves();
    6803                 jit.move(CCallHelpers::TrustedImmPtr(callLinkInfo), GPRInfo::nonArgGPR0);
     6713                jit.move(CCallHelpers::TrustedImmPtr(callLinkInfo), GPRInfo::regT2);
    68046714                CCallHelpers::Call slowCall = jit.nearCall();
    68056715               
     
    68096719                    done.link(&jit);
    68106720               
    6811                 callLinkInfo->setUpCall(callType, argumentsLocation, node->origin.semantic, GPRInfo::regT0);
     6721                callLinkInfo->setUpCall(callType, node->origin.semantic, GPRInfo::regT0);
    68126722               
    68136723                jit.addPtr(
     
    68186728                    [=] (LinkBuffer& linkBuffer) {
    68196729                        MacroAssemblerCodePtr linkCall =
    6820                             linkBuffer.vm().getJITCallThunkEntryStub(linkCallThunkGenerator).entryFor(StackArgs);
     6730                            linkBuffer.vm().getCTIStub(linkCallThunkGenerator).code();
    68216731                        linkBuffer.link(slowCall, FunctionPtr(linkCall.executableAddress()));
    68226732                       
     
    68876797               
    68886798                exceptionHandle->scheduleExitCreationForUnwind(params, callSiteIndex);
    6889 
    6890                 incrementCounter(&jit, VM::FTLCaller);
    6891                 incrementCounter(&jit, VM::CallEval);
    6892 
     6799               
    68936800                jit.store32(
    68946801                    CCallHelpers::TrustedImm32(callSiteIndex.bits()),
     
    68966803               
    68976804                CallLinkInfo* callLinkInfo = jit.codeBlock()->addCallLinkInfo();
    6898                 callLinkInfo->setUpCall(CallLinkInfo::Call, StackArgs, node->origin.semantic, GPRInfo::regT0);
     6805                callLinkInfo->setUpCall(CallLinkInfo::Call, node->origin.semantic, GPRInfo::regT0);
    68996806               
    69006807                jit.addPtr(CCallHelpers::TrustedImm32(-static_cast<ptrdiff_t>(sizeof(CallerFrameAndPC))), CCallHelpers::stackPointerRegister, GPRInfo::regT1);
Note: See TracChangeset for help on using the changeset viewer.