Commit 484e1952 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[Liftoff] Unify name of frame size constant

Some architectures used {kConstantStackSpace}, others used
{kInstanceOffset}. This CL unifies it to {kInstanceOffset} and uses that
constant consistently (in {GetInstanceOperand}).

R=zhin@chromium.org

Bug: v8:10019
Change-Id: Ia2b6908e289591e2dbc48e559e11407877b7c4ad
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2000146Reviewed-by: 's avatarZhi An Ng <zhin@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65780}
parent 2b2a7b43
......@@ -51,9 +51,7 @@ inline MemOperand GetHalfStackSlot(int offset, RegPairHalf half) {
return MemOperand(fp, -offset + half_offset);
}
inline MemOperand GetInstanceOperand() {
return MemOperand(fp, -kInstanceOffset);
}
inline MemOperand GetInstanceOperand() { return GetStackSlot(kInstanceOffset); }
inline MemOperand GetMemOp(LiftoffAssembler* assm,
UseScratchRegisterScope* temps, Register addr,
......
......@@ -43,9 +43,7 @@ constexpr int kInstanceOffset = 2 * kSystemPointerSize;
inline MemOperand GetStackSlot(int offset) { return MemOperand(fp, -offset); }
inline MemOperand GetInstanceOperand() {
return MemOperand(fp, -kInstanceOffset);
}
inline MemOperand GetInstanceOperand() { return GetStackSlot(kInstanceOffset); }
inline CPURegister GetRegFromType(const LiftoffRegister& reg, ValueType type) {
switch (type) {
......
......@@ -20,9 +20,8 @@ namespace wasm {
namespace liftoff {
// ebp-4 holds the stack marker, ebp-8 is the instance parameter, first stack
// slot is located at ebp-8-offset.
constexpr int kConstantStackSpace = 8;
// ebp-4 holds the stack marker, ebp-8 is the instance parameter.
constexpr int kInstanceOffset = 8;
inline Operand GetStackSlot(int offset) { return Operand(ebp, -offset); }
......@@ -33,7 +32,7 @@ inline MemOperand GetHalfStackSlot(int offset, RegPairHalf half) {
}
// TODO(clemensb): Make this a constexpr variable once Operand is constexpr.
inline Operand GetInstanceOperand() { return Operand(ebp, -8); }
inline Operand GetInstanceOperand() { return GetStackSlot(kInstanceOffset); }
static constexpr LiftoffRegList kByteRegs =
LiftoffRegList::FromBits<Register::ListOf(eax, ecx, edx)>();
......@@ -192,7 +191,7 @@ void LiftoffAssembler::AbortCompilation() {}
// static
constexpr int LiftoffAssembler::StaticStackFrameSize() {
return liftoff::kConstantStackSpace;
return liftoff::kInstanceOffset;
}
int LiftoffAssembler::SlotSizeForType(ValueType type) {
......
......@@ -43,9 +43,8 @@ constexpr int32_t kLowWordOffset = 0;
constexpr int32_t kHighWordOffset = 4;
#endif
// fp-4 holds the stack marker, fp-8 is the instance parameter, first stack
// slot is located at fp-8-offset.
constexpr int kConstantStackSpace = 8;
// fp-4 holds the stack marker, fp-8 is the instance parameter.
constexpr int kInstanceOffset = 8;
inline MemOperand GetStackSlot(int offset) { return MemOperand(fp, -offset); }
......@@ -55,7 +54,7 @@ inline MemOperand GetHalfStackSlot(int offset, RegPairHalf half) {
return MemOperand(fp, -offset + half_offset);
}
inline MemOperand GetInstanceOperand() { return MemOperand(fp, -8); }
inline MemOperand GetInstanceOperand() { return GetStackSlot(kInstanceOffset); }
inline void Load(LiftoffAssembler* assm, LiftoffRegister dst, Register base,
int32_t offset, ValueType type) {
......
......@@ -39,13 +39,12 @@ namespace liftoff {
// -----+--------------------+ <-- stack ptr (sp)
//
// fp-8 holds the stack marker, fp-16 is the instance parameter, first stack
// slot is located at fp-16-offset.
constexpr int kConstantStackSpace = 16;
// fp-8 holds the stack marker, fp-16 is the instance parameter.
constexpr int kInstanceOffset = 16;
inline MemOperand GetStackSlot(int offset) { return MemOperand(fp, -offset); }
inline MemOperand GetInstanceOperand() { return MemOperand(fp, -16); }
inline MemOperand GetInstanceOperand() { return GetStackSlot(kInstanceOffset); }
inline void Load(LiftoffAssembler* assm, LiftoffRegister dst, MemOperand src,
ValueType type) {
......@@ -253,7 +252,7 @@ void LiftoffAssembler::AbortCompilation() {}
// static
constexpr int LiftoffAssembler::StaticStackFrameSize() {
return liftoff::kConstantStackSpace;
return liftoff::kInstanceOffset;
}
int LiftoffAssembler::SlotSizeForType(ValueType type) {
......
......@@ -33,14 +33,13 @@ static_assert((kLiftoffAssemblerFpCacheRegs &
0,
"scratch registers must not be used as cache registers");
// rbp-8 holds the stack marker, rbp-16 is the instance parameter, first stack
// slot is located at rbp-16-offset.
constexpr int kConstantStackSpace = 16;
// rbp-8 holds the stack marker, rbp-16 is the instance parameter.
constexpr int kInstanceOffset = 16;
inline Operand GetStackSlot(int offset) { return Operand(rbp, -offset); }
// TODO(clemensb): Make this a constexpr variable once Operand is constexpr.
inline Operand GetInstanceOperand() { return Operand(rbp, -16); }
inline Operand GetInstanceOperand() { return GetStackSlot(kInstanceOffset); }
inline Operand GetMemOp(LiftoffAssembler* assm, Register addr, Register offset,
uint32_t offset_imm) {
......@@ -175,7 +174,7 @@ void LiftoffAssembler::AbortCompilation() {}
// static
constexpr int LiftoffAssembler::StaticStackFrameSize() {
return liftoff::kConstantStackSpace;
return liftoff::kInstanceOffset;
}
int LiftoffAssembler::SlotSizeForType(ValueType type) {
......
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