Index: src/compiler/code-generator.h |
diff --git a/src/compiler/code-generator.h b/src/compiler/code-generator.h |
index 1083e66e023b0d350d50ba2798a8358a15cb167c..d9fa7e5ebbbc4305231f7b17668d14dacdab10d1 100644 |
--- a/src/compiler/code-generator.h |
+++ b/src/compiler/code-generator.h |
@@ -102,6 +102,11 @@ class CodeGenerator final : public GapResolver::Assembler { |
void AssembleSourcePosition(Instruction* instr); |
void AssembleGaps(Instruction* instr); |
+ // Returns true if a instruction is a tail call that needs to adjust the stack |
+ // pointer before execution. The stack slot index to the empty slot above the |
+ // adjusted stack pointer is returned in |slot|. |
+ bool GetSlotAboveSPBeforeTailCall(Instruction* instr, int* slot); |
+ |
// =========================================================================== |
// ============= Architecture-specific code generation methods. ============== |
// =========================================================================== |
@@ -124,18 +129,49 @@ class CodeGenerator final : public GapResolver::Assembler { |
// to tear down a stack frame. |
void AssembleReturn(); |
- // Generates code to deconstruct a the caller's frame, including arguments. |
- void AssembleDeconstructActivationRecord(int stack_param_delta); |
- |
void AssembleDeconstructFrame(); |
// Generates code to manipulate the stack in preparation for a tail call. |
- void AssemblePrepareTailCall(int stack_param_delta); |
+ void AssemblePrepareTailCall(); |
// Generates code to pop current frame if it is an arguments adaptor frame. |
void AssemblePopArgumentsAdaptorFrame(Register args_reg, Register scratch1, |
Register scratch2, Register scratch3); |
+ enum PushTypeFlag { |
+ kImmediatePush = 0x1, |
+ kScalarPush = 0x2, |
+ kFloat32Push = 0x4, |
+ kFloat64Push = 0x8, |
+ kFloatPush = kFloat32Push | kFloat64Push |
+ }; |
+ |
+ typedef base::Flags<PushTypeFlag> PushTypeFlags; |
+ |
+ static bool IsValidPush(InstructionOperand source, PushTypeFlags push_type); |
+ |
+ // Generate a list moves from an instruction that are candidates to be turned |
+ // into push instructions on platforms that support them. In general, the list |
+ // of push candidates are moves to a set of contiguous destination |
+ // InstructionOperand locations on the stack that don't clobber values that |
+ // are needed for resolve the gap or use values generated by the gap, |
+ // i.e. moves that can be hoisted together before the actual gap and assembled |
+ // together. |
+ static void GetPushCompatibleMoves(Instruction* instr, |
+ PushTypeFlags push_type, |
+ ZoneVector<MoveOperands*>* pushes); |
+ |
+ // Called before a tail call |instr|'s gap moves are assembled and allows |
+ // gap-specific pre-processing, e.g. adjustment of the sp for tail calls that |
+ // need it before gap moves or conversion of certain gap moves into pushes. |
+ void AssembleTailCallBeforeGap(Instruction* instr, |
+ int first_unused_stack_slot); |
+ // Called after a tail call |instr|'s gap moves are assembled and allows |
+ // gap-specific post-processing, e.g. adjustment of the sp for tail calls that |
+ // need it after gap moves. |
+ void AssembleTailCallAfterGap(Instruction* instr, |
+ int first_unused_stack_slot); |
+ |
// =========================================================================== |
// ============== Architecture-specific gap resolver methods. ================ |
// =========================================================================== |
@@ -188,12 +224,6 @@ class CodeGenerator final : public GapResolver::Assembler { |
DeoptimizationExit* AddDeoptimizationExit(Instruction* instr, |
size_t frame_state_offset); |
- // Converts the delta in the number of stack parameter passed from a tail |
- // caller to the callee into the distance (in pointers) the SP must be |
- // adjusted, taking frame elision and other relevant factors into |
- // consideration. |
- int TailCallFrameStackSlotDelta(int stack_param_delta); |
- |
// =========================================================================== |
struct DeoptimizationState : ZoneObject { |