Commit d5fbf0ed authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[Liftoff] Fix stack space reservation

LiftoffAssembler::ReserveStackSpace expected number of bytes, not
number of stack slots. Also, make this clear in the naming of the
parameter, and remove a dead field.

R=titzer@chromium.org

Bug: v8:6600
Change-Id: Ic4c7167cfa26a169b2936acdde865863141f441d
Reviewed-on: https://chromium-review.googlesource.com/823967Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50072}
parent 5aaeb2fd
...@@ -11,7 +11,7 @@ namespace v8 { ...@@ -11,7 +11,7 @@ namespace v8 {
namespace internal { namespace internal {
namespace wasm { namespace wasm {
void LiftoffAssembler::ReserveStackSpace(uint32_t space) { USE(stack_space_); } void LiftoffAssembler::ReserveStackSpace(uint32_t bytes) {}
void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value) {} void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value) {}
......
...@@ -11,7 +11,7 @@ namespace v8 { ...@@ -11,7 +11,7 @@ namespace v8 {
namespace internal { namespace internal {
namespace wasm { namespace wasm {
void LiftoffAssembler::ReserveStackSpace(uint32_t space) { USE(stack_space_); } void LiftoffAssembler::ReserveStackSpace(uint32_t bytes) {}
void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value) {} void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value) {}
......
...@@ -31,9 +31,8 @@ inline Operand GetContextOperand() { return Operand(ebp, -16); } ...@@ -31,9 +31,8 @@ inline Operand GetContextOperand() { return Operand(ebp, -16); }
static constexpr DoubleRegister kScratchDoubleReg = xmm7; static constexpr DoubleRegister kScratchDoubleReg = xmm7;
void LiftoffAssembler::ReserveStackSpace(uint32_t space) { void LiftoffAssembler::ReserveStackSpace(uint32_t bytes) {
stack_space_ = space; sub(esp, Immediate(bytes));
sub(esp, Immediate(space));
} }
void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value) { void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value) {
......
...@@ -243,7 +243,7 @@ class LiftoffAssembler : public TurboAssembler { ...@@ -243,7 +243,7 @@ class LiftoffAssembler : public TurboAssembler {
// Platform-specific part. // // Platform-specific part. //
//////////////////////////////////// ////////////////////////////////////
inline void ReserveStackSpace(uint32_t); inline void ReserveStackSpace(uint32_t bytes);
inline void LoadConstant(LiftoffRegister, WasmValue); inline void LoadConstant(LiftoffRegister, WasmValue);
inline void LoadFromContext(Register dst, uint32_t offset, int size); inline void LoadFromContext(Register dst, uint32_t offset, int size);
...@@ -313,7 +313,6 @@ class LiftoffAssembler : public TurboAssembler { ...@@ -313,7 +313,6 @@ class LiftoffAssembler : public TurboAssembler {
private: private:
uint32_t num_locals_ = 0; uint32_t num_locals_ = 0;
uint32_t stack_space_ = 0;
static constexpr uint32_t kInlineLocalTypes = 8; static constexpr uint32_t kInlineLocalTypes = 8;
union { union {
ValueType local_types_[kInlineLocalTypes]; ValueType local_types_[kInlineLocalTypes];
......
...@@ -165,7 +165,7 @@ class LiftoffCompiler { ...@@ -165,7 +165,7 @@ class LiftoffCompiler {
} }
__ EnterFrame(StackFrame::WASM_COMPILED); __ EnterFrame(StackFrame::WASM_COMPILED);
__ set_has_frame(true); __ set_has_frame(true);
__ ReserveStackSpace(__ GetTotalFrameSlotCount()); __ ReserveStackSpace(kPointerSize * __ GetTotalFrameSlotCount());
// Parameter 0 is the wasm context. // Parameter 0 is the wasm context.
uint32_t num_params = uint32_t num_params =
static_cast<uint32_t>(call_desc_->ParameterCount()) - 1; static_cast<uint32_t>(call_desc_->ParameterCount()) - 1;
......
...@@ -11,7 +11,7 @@ namespace v8 { ...@@ -11,7 +11,7 @@ namespace v8 {
namespace internal { namespace internal {
namespace wasm { namespace wasm {
void LiftoffAssembler::ReserveStackSpace(uint32_t space) { USE(stack_space_); } void LiftoffAssembler::ReserveStackSpace(uint32_t bytes) {}
void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value) {} void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value) {}
......
...@@ -11,7 +11,7 @@ namespace v8 { ...@@ -11,7 +11,7 @@ namespace v8 {
namespace internal { namespace internal {
namespace wasm { namespace wasm {
void LiftoffAssembler::ReserveStackSpace(uint32_t space) { USE(stack_space_); } void LiftoffAssembler::ReserveStackSpace(uint32_t bytes) {}
void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value) {} void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value) {}
......
...@@ -11,7 +11,7 @@ namespace v8 { ...@@ -11,7 +11,7 @@ namespace v8 {
namespace internal { namespace internal {
namespace wasm { namespace wasm {
void LiftoffAssembler::ReserveStackSpace(uint32_t space) { USE(stack_space_); } void LiftoffAssembler::ReserveStackSpace(uint32_t bytes) {}
void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value) {} void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value) {}
......
...@@ -11,7 +11,7 @@ namespace v8 { ...@@ -11,7 +11,7 @@ namespace v8 {
namespace internal { namespace internal {
namespace wasm { namespace wasm {
void LiftoffAssembler::ReserveStackSpace(uint32_t space) { USE(stack_space_); } void LiftoffAssembler::ReserveStackSpace(uint32_t bytes) {}
void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value) {} void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value) {}
......
...@@ -29,9 +29,8 @@ inline Operand GetContextOperand() { return Operand(rbp, -16); } ...@@ -29,9 +29,8 @@ inline Operand GetContextOperand() { return Operand(rbp, -16); }
} // namespace liftoff } // namespace liftoff
void LiftoffAssembler::ReserveStackSpace(uint32_t space) { void LiftoffAssembler::ReserveStackSpace(uint32_t bytes) {
stack_space_ = space; subp(rsp, Immediate(bytes));
subp(rsp, Immediate(space));
} }
void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value) { void LiftoffAssembler::LoadConstant(LiftoffRegister reg, WasmValue value) {
......
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