Commit 3072a082 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[cleanup] Remove obsolete {ExitFrame::code_slot} mechanism.

This slot has become obsolete now that all CEntry stubs are builtins
(which are part of the rootset) and no longer need to be kept alive
explicitly by a slot in the frame.

R=verwaest@chromium.org
BUG=v8:8834

Change-Id: I7b791cc509ef800bcf7aa5faab31ddf35370f944
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1520725Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60267}
parent 2270c0ea
......@@ -26,8 +26,7 @@ class EntryFrameConstants : public AllStatic {
class ExitFrameConstants : public TypedFrameConstants {
public:
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2);
DEFINE_TYPED_FRAME_SIZES(1);
// The caller fields are below the frame pointer on the stack.
static constexpr int kCallerFPOffset = 0 * kPointerSize;
......
......@@ -1308,14 +1308,12 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
DCHECK_EQ(0 * kPointerSize, ExitFrameConstants::kCallerFPOffset);
mov(scratch, Operand(StackFrame::TypeToMarker(frame_type)));
PushCommonFrame(scratch);
// Reserve room for saved entry sp and code object.
// Reserve room for saved entry sp.
sub(sp, fp, Operand(ExitFrameConstants::kFixedFrameSizeFromFp));
if (emit_debug_code()) {
mov(scratch, Operand::Zero());
str(scratch, MemOperand(fp, ExitFrameConstants::kSPOffset));
}
Move(scratch, CodeObject());
str(scratch, MemOperand(fp, ExitFrameConstants::kCodeOffset));
// Save the frame pointer and the context in top.
Move(scratch, ExternalReference::Create(IsolateAddressId::kCEntryFPAddress,
......
......@@ -44,10 +44,8 @@ class EntryFrameConstants : public AllStatic {
class ExitFrameConstants : public TypedFrameConstants {
public:
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static constexpr int kPaddingOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2);
DEFINE_TYPED_FRAME_SIZES(3);
static constexpr int kLastExitFrameField = kPaddingOffset;
DEFINE_TYPED_FRAME_SIZES(1);
static constexpr int kLastExitFrameField = kSPOffset;
static constexpr int kConstantPoolOffset = 0; // Not used
};
......
......@@ -2585,14 +2585,10 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, const Register& scratch,
Mov(fp, sp);
Mov(scratch, StackFrame::TypeToMarker(frame_type));
Push(scratch, xzr);
Mov(scratch, CodeObject());
Push(scratch, padreg);
// fp[8]: CallerPC (lr)
// fp -> fp[0]: CallerFP (old fp)
// fp[-8]: STUB marker
// fp[-16]: Space reserved for SPOffset.
// fp[-24]: CodeObject()
// sp -> fp[-32]: padding
// sp -> fp[-16]: Space reserved for SPOffset.
STATIC_ASSERT((2 * kSystemPointerSize) ==
ExitFrameConstants::kCallerSPOffset);
STATIC_ASSERT((1 * kSystemPointerSize) ==
......@@ -2600,9 +2596,6 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, const Register& scratch,
STATIC_ASSERT((0 * kSystemPointerSize) ==
ExitFrameConstants::kCallerFPOffset);
STATIC_ASSERT((-2 * kSystemPointerSize) == ExitFrameConstants::kSPOffset);
STATIC_ASSERT((-3 * kSystemPointerSize) == ExitFrameConstants::kCodeOffset);
STATIC_ASSERT((-4 * kSystemPointerSize) ==
ExitFrameConstants::kPaddingOffset);
// Save the frame pointer and context pointer in the top frame.
Mov(scratch,
......@@ -2612,7 +2605,7 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, const Register& scratch,
ExternalReference::Create(IsolateAddressId::kContextAddress, isolate()));
Str(cp, MemOperand(scratch));
STATIC_ASSERT((-4 * kSystemPointerSize) ==
STATIC_ASSERT((-2 * kSystemPointerSize) ==
ExitFrameConstants::kLastExitFrameField);
if (save_doubles) {
ExitFramePreserveFPRegs();
......@@ -2629,8 +2622,7 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, const Register& scratch,
// fp -> fp[0]: CallerFP (old fp)
// fp[-8]: STUB marker
// fp[-16]: Space reserved for SPOffset.
// fp[-24]: CodeObject()
// fp[-24 - fp_size]: Saved doubles (if save_doubles is true).
// fp[-16 - fp_size]: Saved doubles (if save_doubles is true).
// sp[8]: Extra space reserved for caller (if extra_space != 0).
// sp -> sp[0]: Space reserved for the return address.
......
......@@ -614,14 +614,7 @@ Code ConstructEntryFrame::unchecked_code() const {
return isolate()->heap()->builtin(Builtins::kJSConstructEntry);
}
Address& ExitFrame::code_slot() const {
const int offset = ExitFrameConstants::kCodeOffset;
return Memory<Address>(fp() + offset);
}
Code ExitFrame::unchecked_code() const {
return Code::unchecked_cast(Object(code_slot()));
}
Code ExitFrame::unchecked_code() const { UNREACHABLE(); }
void ExitFrame::ComputeCallerState(State* state) const {
// Set up the caller state.
......@@ -641,7 +634,6 @@ void ExitFrame::Iterate(RootVisitor* v) const {
// The arguments are traversed as part of the expression stack of
// the calling frame.
IteratePc(v, pc_address(), constant_pool_address(), LookupCode());
v->VisitRootPointer(Root::kTop, nullptr, FullObjectSlot(&code_slot()));
}
......
......@@ -384,8 +384,6 @@ class ExitFrame: public StackFrame {
Code unchecked_code() const override;
Address& code_slot() const;
// Garbage collection support.
void Iterate(RootVisitor* v) const override;
......
......@@ -35,8 +35,7 @@ class EntryFrameConstants : public AllStatic {
class ExitFrameConstants : public TypedFrameConstants {
public:
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2);
DEFINE_TYPED_FRAME_SIZES(1);
static constexpr int kCallerFPOffset = 0 * kSystemPointerSize;
static constexpr int kCallerPCOffset = +1 * kSystemPointerSize;
......
......@@ -810,13 +810,10 @@ void MacroAssembler::EnterExitFramePrologue(StackFrame::Type frame_type,
push(ebp);
mov(ebp, esp);
// Reserve room for entry stack pointer and push the code object.
// Reserve room for entry stack pointer.
push(Immediate(StackFrame::TypeToMarker(frame_type)));
DCHECK_EQ(-2 * kSystemPointerSize, ExitFrameConstants::kSPOffset);
push(Immediate(0)); // Saved entry sp, patched before call.
DCHECK_EQ(-3 * kSystemPointerSize, ExitFrameConstants::kCodeOffset);
Move(scratch, CodeObject());
push(scratch); // Accessed from ExitFrame::code_slot.
STATIC_ASSERT(edx == kRuntimeCallFunctionRegister);
STATIC_ASSERT(esi == kContextRegister);
......
......@@ -26,8 +26,7 @@ class EntryFrameConstants : public AllStatic {
class ExitFrameConstants : public TypedFrameConstants {
public:
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2);
DEFINE_TYPED_FRAME_SIZES(1);
// The caller fields are below the frame pointer on the stack.
static constexpr int kCallerFPOffset = +0 * kPointerSize;
......
......@@ -4816,11 +4816,10 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
// [fp + 0 (==kCallerFPOffset)] - saved old fp
// [fp - 1 StackFrame::EXIT Smi
// [fp - 2 (==kSPOffset)] - sp of the called function
// [fp - 3 (==kCodeOffset)] - CodeObject
// fp - (2 + stack_space + alignment) == sp == [fp - kSPOffset] - top of the
// new stack (will contain saved ra)
// Save registers and reserve room for saved entry sp and code object.
// Save registers and reserve room for saved entry sp.
addiu(sp, sp, -2 * kPointerSize - ExitFrameConstants::kFixedFrameSizeFromFp);
sw(ra, MemOperand(sp, 4 * kPointerSize));
sw(fp, MemOperand(sp, 3 * kPointerSize));
......@@ -4837,10 +4836,6 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
sw(zero_reg, MemOperand(fp, ExitFrameConstants::kSPOffset));
}
// Accessed from ExitFrame::code_slot.
li(t8, CodeObject(), CONSTANT_SIZE);
sw(t8, MemOperand(fp, ExitFrameConstants::kCodeOffset));
// Save the frame pointer and the context in top.
li(t8,
ExternalReference::Create(IsolateAddressId::kCEntryFPAddress, isolate()));
......
......@@ -22,8 +22,7 @@ class EntryFrameConstants : public AllStatic {
class ExitFrameConstants : public TypedFrameConstants {
public:
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2);
DEFINE_TYPED_FRAME_SIZES(1);
// The caller fields are below the frame pointer on the stack.
static constexpr int kCallerFPOffset = +0 * kPointerSize;
......
......@@ -5168,11 +5168,10 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
// [fp + 0 (==kCallerFPOffset)] - saved old fp
// [fp - 1 StackFrame::EXIT Smi
// [fp - 2 (==kSPOffset)] - sp of the called function
// [fp - 3 (==kCodeOffset)] - CodeObject
// fp - (2 + stack_space + alignment) == sp == [fp - kSPOffset] - top of the
// new stack (will contain saved ra)
// Save registers and reserve room for saved entry sp and code object.
// Save registers and reserve room for saved entry sp.
daddiu(sp, sp, -2 * kPointerSize - ExitFrameConstants::kFixedFrameSizeFromFp);
Sd(ra, MemOperand(sp, 4 * kPointerSize));
Sd(fp, MemOperand(sp, 3 * kPointerSize));
......@@ -5191,10 +5190,6 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
{
BlockTrampolinePoolScope block_trampoline_pool(this);
// Accessed from ExitFrame::code_slot.
li(t8, CodeObject(), CONSTANT_SIZE);
Sd(t8, MemOperand(fp, ExitFrameConstants::kCodeOffset));
// Save the frame pointer and the context in top.
li(t8, ExternalReference::Create(IsolateAddressId::kCEntryFPAddress,
isolate()));
......
......@@ -20,8 +20,7 @@ class EntryFrameConstants : public AllStatic {
class ExitFrameConstants : public TypedFrameConstants {
public:
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2);
DEFINE_TYPED_FRAME_SIZES(1);
// The caller fields are below the frame pointer on the stack.
static constexpr int kCallerFPOffset = 0 * kPointerSize;
......
......@@ -997,7 +997,6 @@ int TurboAssembler::LeaveFrame(StackFrame::Type type, int stack_adjustment) {
//
// SP -> previousSP
// LK reserved
// code
// sp_on_exit (for debug?)
// oldSP->prev SP
// LK
......@@ -1025,7 +1024,7 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
mov(ip, Operand(StackFrame::TypeToMarker(frame_type)));
PushCommonFrame(ip);
// Reserve room for saved entry sp and code object.
// Reserve room for saved entry sp.
subi(sp, fp, Operand(ExitFrameConstants::kFixedFrameSizeFromFp));
if (emit_debug_code()) {
......@@ -1036,8 +1035,6 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
StoreP(kConstantPoolRegister,
MemOperand(fp, ExitFrameConstants::kConstantPoolOffset));
}
Move(r8, CodeObject());
StoreP(r8, MemOperand(fp, ExitFrameConstants::kCodeOffset));
// Save the frame pointer and the context in top.
Move(r8, ExternalReference::Create(IsolateAddressId::kCEntryFPAddress,
......
......@@ -22,8 +22,7 @@ class EntryFrameConstants : public AllStatic {
class ExitFrameConstants : public TypedFrameConstants {
public:
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2);
DEFINE_TYPED_FRAME_SIZES(1);
// The caller fields are below the frame pointer on the stack.
static constexpr int kCallerFPOffset = 0 * kPointerSize;
......
......@@ -1049,7 +1049,6 @@ int TurboAssembler::LeaveFrame(StackFrame::Type type, int stack_adjustment) {
//
// SP -> previousSP
// LK reserved
// code
// sp_on_exit (for debug?)
// oldSP->prev SP
// LK
......@@ -1064,7 +1063,6 @@ int TurboAssembler::LeaveFrame(StackFrame::Type type, int stack_adjustment) {
// r14
// oldFP <- newFP
// SP
// Code
// Floats
// gaps
// Args
......@@ -1085,14 +1083,12 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space,
CleanseP(r14);
Load(r1, Operand(StackFrame::TypeToMarker(frame_type)));
PushCommonFrame(r1);
// Reserve room for saved entry sp and code object.
// Reserve room for saved entry sp.
lay(sp, MemOperand(fp, -ExitFrameConstants::kFixedFrameSizeFromFp));
if (emit_debug_code()) {
StoreP(MemOperand(fp, ExitFrameConstants::kSPOffset), Operand::Zero(), r1);
}
Move(r1, CodeObject());
StoreP(r1, MemOperand(fp, ExitFrameConstants::kCodeOffset));
// Save the frame pointer and the context in top.
Move(r1, ExternalReference::Create(IsolateAddressId::kCEntryFPAddress,
......
......@@ -44,8 +44,7 @@ class EntryFrameConstants : public AllStatic {
class ExitFrameConstants : public TypedFrameConstants {
public:
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2);
DEFINE_TYPED_FRAME_SIZES(1);
static constexpr int kCallerFPOffset = +0 * kSystemPointerSize;
static constexpr int kCallerPCOffset = kFPOnStackSize;
......
......@@ -2422,12 +2422,10 @@ void MacroAssembler::EnterExitFramePrologue(bool save_rax,
pushq(rbp);
movq(rbp, rsp);
// Reserve room for entry stack pointer and push the code object.
// Reserve room for entry stack pointer.
Push(Immediate(StackFrame::TypeToMarker(frame_type)));
DCHECK_EQ(-2 * kSystemPointerSize, ExitFrameConstants::kSPOffset);
Push(Immediate(0)); // Saved entry sp, patched before call.
Move(kScratchRegister, CodeObject(), RelocInfo::EMBEDDED_OBJECT);
Push(kScratchRegister); // Accessed from ExitFrame::code_slot.
// Save the frame pointer and the context in top.
if (save_rax) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment