4040#include " MaxFrameExtentForSlowPathCall.h"
4141#include " OperandsInlines.h"
4242#include " JSCInlines.h"
43- #include " RegisterPreservationWrapperGenerator.h"
4443
4544namespace JSC { namespace FTL {
4645
@@ -379,9 +378,6 @@ static void compileStub(
379378 // old frame, and finally we save the various callee-save registers into where the
380379 // restoration thunk would restore them from.
381380
382- ptrdiff_t offset = registerPreservationOffset ();
383- RegisterSet toSave = registersToPreserve ();
384-
385381 // Before we start messing with the frame, we need to set aside any registers that the
386382 // FTL code was preserving.
387383 for (unsigned i = codeBlock->calleeSaveRegisters ()->size (); i--;) {
@@ -397,26 +393,16 @@ static void compileStub(
397393 // Let's say that the FTL function had failed its arity check. In that case, the stack will
398394 // contain some extra stuff.
399395 //
400- // First we compute the padded stack space:
396+ // We compute the padded stack space:
401397 //
402398 // paddedStackSpace = roundUp(codeBlock->numParameters - regT2 + 1)
403399 //
404- // The stack will have regT2 + CallFrameHeaderSize stuff, but above it there will be
405- // paddedStackSpace gunk used by the arity check fail restoration thunk. When that happens
406- // we want to make the stack look like this, from higher addresses down:
400+ // The stack will have regT2 + CallFrameHeaderSize stuff.
401+ // We want to make the stack look like this, from higher addresses down:
407402 //
408- // - register preservation return PC
409- // - preserved registers
410- // - arity check fail return PC
411403 // - argument padding
412404 // - actual arguments
413405 // - call frame header
414- //
415- // So that the actual call frame header appears to return to the arity check fail return
416- // PC, and that then returns to the register preservation thunk. The arity check thunk that
417- // we return to will have the padding size encoded into it. It will then know to return
418- // into the register preservation thunk, which uses the argument count to figure out where
419- // registers are preserved.
420406
421407 // This code assumes that we're dealing with FunctionCode.
422408 RELEASE_ASSERT (codeBlock->codeType () == FunctionCode);
@@ -436,7 +422,6 @@ static void compileStub(
436422
437423 // First set up SP so that our data doesn't get clobbered by signals.
438424 unsigned conservativeStackDelta =
439- registerPreservationOffset () +
440425 (exit.m_values .numberOfLocals () + baselineCodeBlock->calleeSaveSpaceAsVirtualRegisters ()) * sizeof (Register) +
441426 maxFrameExtentForSlowPathCall;
442427 conservativeStackDelta = WTF::roundUpToMultipleOf (
@@ -445,25 +430,12 @@ static void compileStub(
445430 MacroAssembler::TrustedImm32 (-conservativeStackDelta),
446431 MacroAssembler::framePointerRegister, MacroAssembler::stackPointerRegister);
447432 jit.checkStackPointerAlignment ();
448-
449- jit.subPtr (
450- MacroAssembler::TrustedImm32 (registerPreservationOffset ()),
451- MacroAssembler::framePointerRegister);
452-
453- // Copy the old frame data into its new location.
454- jit.add32 (MacroAssembler::TrustedImm32 (JSStack::CallFrameHeaderSize), GPRInfo::regT2);
455- jit.move (MacroAssembler::framePointerRegister, GPRInfo::regT1);
456- MacroAssembler::Label loop = jit.label ();
457- jit.sub32 (MacroAssembler::TrustedImm32 (1 ), GPRInfo::regT2);
458- jit.load64 (MacroAssembler::Address (GPRInfo::regT1, offset), GPRInfo::regT0);
459- jit.store64 (GPRInfo::regT0, GPRInfo::regT1);
460- jit.addPtr (MacroAssembler::TrustedImm32 (sizeof (Register)), GPRInfo::regT1);
461- jit.branchTest32 (MacroAssembler::NonZero, GPRInfo::regT2).linkTo (loop, &jit);
462433
434+ RegisterSet allFTLCalleeSaves = RegisterSet::ftlCalleeSaveRegisters ();
463435 RegisterAtOffsetList* baselineCalleeSaves = baselineCodeBlock->calleeSaveRegisters ();
464436
465437 for (Reg reg = Reg::first (); reg <= Reg::last (); reg = reg.next ()) {
466- if (!toSave .get (reg) || !reg.isGPR ())
438+ if (!allFTLCalleeSaves .get (reg) || !reg.isGPR ())
467439 continue ;
468440 unsigned unwindIndex = codeBlock->calleeSaveRegisters ()->indexOf (reg);
469441 RegisterAtOffset* baselineRegisterOffset = baselineCalleeSaves->find (reg);
0 commit comments