Ignore:
Timestamp:
Dec 13, 2016, 11:38:13 AM (8 years ago)
Author:
[email protected]
Message:

Unreviewed, rolling out r209725.
https://bugs.webkit.org/show_bug.cgi?id=165811

"Broke ARMv7 builds" (Requested by msaboff on #webkit).

Reverted changeset:

"REGRESSION(r209653): speedometer crashes making virtual slow
path tailcalls"
https://bugs.webkit.org/show_bug.cgi?id=165748
http://trac.webkit.org/changeset/209725

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ftl/FTLLink.cpp

    r209725 r209764  
    128128    switch (graph.m_plan.mode) {
    129129    case FTLMode: {
    130         CCallHelpers::JumpList fillRegistersAndContinueMainPath;
    131         CCallHelpers::JumpList toMainPath;
    132 
    133         unsigned numParameters = static_cast<unsigned>(codeBlock->numParameters());
    134         unsigned maxRegisterArgumentCount = std::min(numParameters, NUMBER_OF_JS_FUNCTION_ARGUMENT_REGISTERS);
    135 
    136         GPRReg argCountReg = argumentRegisterForArgumentCount();
    137 
    138         CCallHelpers::Label registerArgumentsEntrypoints[NUMBER_OF_JS_FUNCTION_ARGUMENT_REGISTERS + 1];
    139 
    140         if (numParameters < NUMBER_OF_JS_FUNCTION_ARGUMENT_REGISTERS) {
    141             // Spill any extra register arguments passed to function onto the stack.
    142             for (unsigned argIndex = NUMBER_OF_JS_FUNCTION_ARGUMENT_REGISTERS - 1; argIndex >= numParameters; argIndex--) {
    143                 registerArgumentsEntrypoints[argIndex + 1] = jit.label();
    144                 jit.emitPutArgumentToCallFrameBeforePrologue(argumentRegisterForFunctionArgument(argIndex), argIndex);
    145             }
    146             incrementCounter(&jit, VM::RegArgsExtra);
    147             toMainPath.append(jit.jump());
    148         }
    149 
    150         CCallHelpers::JumpList continueToArityFixup;
    151 
    152         CCallHelpers::Label stackArgsCheckArityEntry = jit.label();
    153         incrementCounter(&jit, VM::StackArgsArity);
    154         jit.load32(frame.withOffset(sizeof(Register) * CallFrameSlot::argumentCount), GPRInfo::regT1);
    155         continueToArityFixup.append(jit.branch32(
    156             CCallHelpers::Below, GPRInfo::regT1,
    157             CCallHelpers::TrustedImm32(numParameters)));
    158 
    159 #if ENABLE(VM_COUNTERS)
    160         CCallHelpers::Jump continueToStackArityOk = jit.jump();
    161 #endif
    162 
    163         CCallHelpers::Label stackArgsArityOKEntry = jit.label();
    164 
    165         incrementCounter(&jit, VM::StackArgsArity);
    166 
    167 #if ENABLE(VM_COUNTERS)
    168         continueToStackArityOk.link(&jit);
    169 #endif
    170 
    171         // Load argument values into argument registers
    172 
    173         // FIXME: Would like to eliminate these to load, but we currently can't jump into
    174         // the B3 compiled code at an arbitrary point from the slow entry where the
    175         // registers are stored to the stack.
    176         jit.emitGetFromCallFrameHeaderBeforePrologue(CallFrameSlot::callee, argumentRegisterForCallee());
    177         jit.emitGetPayloadFromCallFrameHeaderBeforePrologue(CallFrameSlot::argumentCount, argumentRegisterForArgumentCount());
    178 
    179         for (unsigned argIndex = 0; argIndex < maxRegisterArgumentCount; argIndex++)
    180             jit.emitGetFromCallFrameArgumentBeforePrologue(argIndex, argumentRegisterForFunctionArgument(argIndex));
    181 
    182         toMainPath.append(jit.jump());
    183 
    184         CCallHelpers::Label registerArgsCheckArityEntry = jit.label();
    185         incrementCounter(&jit, VM::RegArgsArity);
    186 
    187         CCallHelpers::JumpList continueToRegisterArityFixup;
    188         CCallHelpers::Label checkForExtraRegisterArguments;
    189 
    190         if (numParameters < NUMBER_OF_JS_FUNCTION_ARGUMENT_REGISTERS) {
    191             toMainPath.append(jit.branch32(
    192                 CCallHelpers::Equal, argCountReg, CCallHelpers::TrustedImm32(numParameters)));
    193             continueToRegisterArityFixup.append(jit.branch32(
    194                 CCallHelpers::Below, argCountReg, CCallHelpers::TrustedImm32(numParameters)));
    195             //  Fall through to the "extra register arity" case.
    196 
    197             checkForExtraRegisterArguments = jit.label();
    198             // Spill any extra register arguments passed to function onto the stack.
    199             for (unsigned argIndex = numParameters; argIndex < NUMBER_OF_JS_FUNCTION_ARGUMENT_REGISTERS; argIndex++) {
    200                 toMainPath.append(jit.branch32(CCallHelpers::BelowOrEqual, argCountReg, CCallHelpers::TrustedImm32(argIndex)));
    201                 jit.emitPutArgumentToCallFrameBeforePrologue(argumentRegisterForFunctionArgument(argIndex), argIndex);
    202             }
    203 
    204             incrementCounter(&jit, VM::RegArgsExtra);
    205             toMainPath.append(jit.jump());
    206         } else
    207             toMainPath.append(jit.branch32(
    208                 CCallHelpers::AboveOrEqual, argCountReg, CCallHelpers::TrustedImm32(numParameters)));
    209 
    210 #if ENABLE(VM_COUNTERS)
    211         continueToRegisterArityFixup.append(jit.jump());
    212 #endif
    213 
    214         if (numParameters > 0) {
    215             //  There should always be a "this" parameter.
    216             CCallHelpers::Label registerArgumentsNeedArityFixup = jit.label();
    217 
    218             for (unsigned argIndex = 1; argIndex < numParameters && argIndex <= maxRegisterArgumentCount; argIndex++)
    219                 registerArgumentsEntrypoints[argIndex] = registerArgumentsNeedArityFixup;
    220         }
    221 
    222 #if ENABLE(VM_COUNTERS)
    223         incrementCounter(&jit, VM::RegArgsArity);
    224 #endif
    225 
    226         continueToRegisterArityFixup.link(&jit);
    227 
    228         jit.spillArgumentRegistersToFrameBeforePrologue(maxRegisterArgumentCount);
    229 
    230         continueToArityFixup.link(&jit);
    231 
    232         incrementCounter(&jit, VM::ArityFixupRequired);
    233 
     130        CCallHelpers::JumpList mainPathJumps;
     131   
     132        jit.load32(
     133            frame.withOffset(sizeof(Register) * CallFrameSlot::argumentCount),
     134            GPRInfo::regT1);
     135        mainPathJumps.append(jit.branch32(
     136            CCallHelpers::AboveOrEqual, GPRInfo::regT1,
     137            CCallHelpers::TrustedImm32(codeBlock->numParameters())));
    234138        jit.emitFunctionPrologue();
    235139        jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
     
    252156        jit.move(GPRInfo::returnValueGPR, GPRInfo::argumentGPR0);
    253157        jit.emitFunctionEpilogue();
    254         fillRegistersAndContinueMainPath.append(jit.branchTest32(CCallHelpers::Zero, GPRInfo::argumentGPR0));
     158        mainPathJumps.append(jit.branchTest32(CCallHelpers::Zero, GPRInfo::argumentGPR0));
    255159        jit.emitFunctionPrologue();
    256160        CCallHelpers::Call callArityFixup = jit.call();
    257161        jit.emitFunctionEpilogue();
    258 
    259         fillRegistersAndContinueMainPath.append(jit.jump());
    260 
    261         fillRegistersAndContinueMainPath.linkTo(stackArgsArityOKEntry, &jit);
    262 
    263 #if ENABLE(VM_COUNTERS)
    264         CCallHelpers::Label registerEntryNoArity = jit.label();
    265         incrementCounter(&jit, VM::RegArgsNoArity);
    266         toMainPath.append(jit.jump());
    267 #endif
     162        mainPathJumps.append(jit.jump());
    268163
    269164        linkBuffer = std::make_unique<LinkBuffer>(vm, jit, codeBlock, JITCompilationCanFail);
     
    275170        linkBuffer->link(callLookupExceptionHandlerFromCallerFrame, lookupExceptionHandlerFromCallerFrame);
    276171        linkBuffer->link(callArityFixup, FunctionPtr((vm.getCTIStub(arityFixupGenerator)).code().executableAddress()));
    277         linkBuffer->link(toMainPath, CodeLocationLabel(bitwise_cast<void*>(state.generatedFunction)));
    278 
    279         state.jitCode->setEntryFor(StackArgsMustCheckArity, linkBuffer->locationOf(stackArgsCheckArityEntry));
    280         state.jitCode->setEntryFor(StackArgsArityCheckNotRequired, linkBuffer->locationOf(stackArgsArityOKEntry));
    281 
    282 #if ENABLE(VM_COUNTERS)
    283         MacroAssemblerCodePtr mainEntry = linkBuffer->locationOf(registerEntryNoArity);
    284 #else
    285         MacroAssemblerCodePtr mainEntry = MacroAssemblerCodePtr(bitwise_cast<void*>(state.generatedFunction));
    286 #endif
    287         state.jitCode->setEntryFor(RegisterArgsArityCheckNotRequired, mainEntry);
    288 
    289         if (checkForExtraRegisterArguments.isSet())
    290             state.jitCode->setEntryFor(RegisterArgsPossibleExtraArgs, linkBuffer->locationOf(checkForExtraRegisterArguments));
    291         else
    292             state.jitCode->setEntryFor(RegisterArgsPossibleExtraArgs, mainEntry);
    293                                                                              
    294         state.jitCode->setEntryFor(RegisterArgsMustCheckArity, linkBuffer->locationOf(registerArgsCheckArityEntry));
    295 
    296         for (unsigned argCount = 1; argCount <= NUMBER_OF_JS_FUNCTION_ARGUMENT_REGISTERS; argCount++) {
    297             MacroAssemblerCodePtr entry;
    298             if (argCount == numParameters)
    299                 entry = mainEntry;
    300             else if (registerArgumentsEntrypoints[argCount].isSet())
    301                 entry = linkBuffer->locationOf(registerArgumentsEntrypoints[argCount]);
    302             else
    303                 entry = linkBuffer->locationOf(registerArgsCheckArityEntry);
    304             state.jitCode->setEntryFor(JITEntryPoints::registerEntryTypeForArgumentCount(argCount), entry);
    305         }
     172        linkBuffer->link(mainPathJumps, CodeLocationLabel(bitwise_cast<void*>(state.generatedFunction)));
     173
     174        state.jitCode->initializeAddressForCall(MacroAssemblerCodePtr(bitwise_cast<void*>(state.generatedFunction)));
    306175        break;
    307176    }
     
    313182        // call to the B3-generated code.
    314183        CCallHelpers::Label start = jit.label();
    315 
    316184        jit.emitFunctionEpilogue();
    317 
    318         // Load argument values into argument registers
    319 
    320         // FIXME: Would like to eliminate these to load, but we currently can't jump into
    321         // the B3 compiled code at an arbitrary point from the slow entry where the
    322         // registers are stored to the stack.
    323         jit.emitGetFromCallFrameHeaderBeforePrologue(CallFrameSlot::callee, argumentRegisterForCallee());
    324         jit.emitGetPayloadFromCallFrameHeaderBeforePrologue(CallFrameSlot::argumentCount, argumentRegisterForArgumentCount());
    325 
    326         for (unsigned argIndex = 0; argIndex < static_cast<unsigned>(codeBlock->numParameters()) && argIndex < NUMBER_OF_JS_FUNCTION_ARGUMENT_REGISTERS; argIndex++)
    327             jit.emitGetFromCallFrameArgumentBeforePrologue(argIndex, argumentRegisterForFunctionArgument(argIndex));
    328 
    329185        CCallHelpers::Jump mainPathJump = jit.jump();
    330186       
     
    336192        linkBuffer->link(mainPathJump, CodeLocationLabel(bitwise_cast<void*>(state.generatedFunction)));
    337193
    338         state.jitCode->setEntryFor(RegisterArgsArityCheckNotRequired, linkBuffer->locationOf(start));
     194        state.jitCode->initializeAddressForCall(linkBuffer->locationOf(start));
    339195        break;
    340196    }
Note: See TracChangeset for help on using the changeset viewer.