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

[Liftoff] Fix KIntConst typo

Now that I saw the typo I cannot unsee it anymore, but somehow this
typo went unrecognized for nearly 12 months (since
https://crrev.com/c/904443).

R=ahaas@chromium.org

Bug: v8:8562
Change-Id: Iafaeb2313dcfa305007c3c87e8f0440d8b15980e
Reviewed-on: https://chromium-review.googlesource.com/c/1436021Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59125}
parent d9784e11
...@@ -1490,7 +1490,7 @@ void LiftoffStackSlots::Construct() { ...@@ -1490,7 +1490,7 @@ void LiftoffStackSlots::Construct() {
UNREACHABLE(); UNREACHABLE();
} }
break; break;
case LiftoffAssembler::VarState::KIntConst: { case LiftoffAssembler::VarState::kIntConst: {
DCHECK(src.type() == kWasmI32 || src.type() == kWasmI64); DCHECK(src.type() == kWasmI32 || src.type() == kWasmI64);
UseScratchRegisterScope temps(asm_); UseScratchRegisterScope temps(asm_);
Register scratch = temps.Acquire(); Register scratch = temps.Acquire();
......
...@@ -1025,7 +1025,7 @@ void LiftoffStackSlots::Construct() { ...@@ -1025,7 +1025,7 @@ void LiftoffStackSlots::Construct() {
asm_->Poke(liftoff::GetRegFromType(slot.src_.reg(), slot.src_.type()), asm_->Poke(liftoff::GetRegFromType(slot.src_.reg(), slot.src_.type()),
poke_offset); poke_offset);
break; break;
case LiftoffAssembler::VarState::KIntConst: case LiftoffAssembler::VarState::kIntConst:
DCHECK(slot.src_.type() == kWasmI32 || slot.src_.type() == kWasmI64); DCHECK(slot.src_.type() == kWasmI32 || slot.src_.type() == kWasmI64);
if (slot.src_.i32_const() == 0) { if (slot.src_.i32_const() == 0) {
Register zero_reg = slot.src_.type() == kWasmI32 ? wzr : xzr; Register zero_reg = slot.src_.type() == kWasmI32 ? wzr : xzr;
......
...@@ -1780,7 +1780,7 @@ void LiftoffStackSlots::Construct() { ...@@ -1780,7 +1780,7 @@ void LiftoffStackSlots::Construct() {
liftoff::push(asm_, src.reg(), src.type()); liftoff::push(asm_, src.reg(), src.type());
} }
break; break;
case LiftoffAssembler::VarState::KIntConst: case LiftoffAssembler::VarState::kIntConst:
// The high word is the sign extension of the low word. // The high word is the sign extension of the low word.
asm_->push(Immediate(slot.half_ == kLowWord ? src.i32_const() asm_->push(Immediate(slot.half_ == kLowWord ? src.i32_const()
: src.i32_const() >> 31)); : src.i32_const() >> 31));
......
...@@ -103,7 +103,7 @@ class StackTransferRecipe { ...@@ -103,7 +103,7 @@ class StackTransferRecipe {
case VarState::kRegister: case VarState::kRegister:
asm_->Spill(dst_index, src.reg(), src.type()); asm_->Spill(dst_index, src.reg(), src.type());
break; break;
case VarState::KIntConst: case VarState::kIntConst:
asm_->Spill(dst_index, src.constant()); asm_->Spill(dst_index, src.constant());
break; break;
} }
...@@ -111,7 +111,7 @@ class StackTransferRecipe { ...@@ -111,7 +111,7 @@ class StackTransferRecipe {
case VarState::kRegister: case VarState::kRegister:
LoadIntoRegister(dst.reg(), src, src_index); LoadIntoRegister(dst.reg(), src, src_index);
break; break;
case VarState::KIntConst: case VarState::kIntConst:
DCHECK_EQ(dst, src); DCHECK_EQ(dst, src);
break; break;
} }
...@@ -128,7 +128,7 @@ class StackTransferRecipe { ...@@ -128,7 +128,7 @@ class StackTransferRecipe {
DCHECK_EQ(dst.reg_class(), src.reg_class()); DCHECK_EQ(dst.reg_class(), src.reg_class());
if (dst != src.reg()) MoveRegister(dst, src.reg(), src.type()); if (dst != src.reg()) MoveRegister(dst, src.reg(), src.type());
break; break;
case VarState::KIntConst: case VarState::kIntConst:
LoadConstant(dst, src.constant()); LoadConstant(dst, src.constant());
break; break;
} }
...@@ -151,7 +151,7 @@ class StackTransferRecipe { ...@@ -151,7 +151,7 @@ class StackTransferRecipe {
if (dst != src_half) MoveRegister(dst, src_half, kWasmI32); if (dst != src_half) MoveRegister(dst, src_half, kWasmI32);
break; break;
} }
case VarState::KIntConst: case VarState::kIntConst:
int32_t value = src.i32_const(); int32_t value = src.i32_const();
// The high word is the sign extension of the low word. // The high word is the sign extension of the low word.
if (half == kHighWord) value = value >> 31; if (half == kHighWord) value = value >> 31;
...@@ -512,7 +512,7 @@ LiftoffRegister LiftoffAssembler::PopToRegister(LiftoffRegList pinned) { ...@@ -512,7 +512,7 @@ LiftoffRegister LiftoffAssembler::PopToRegister(LiftoffRegList pinned) {
case VarState::kRegister: case VarState::kRegister:
cache_state_.dec_used(slot.reg()); cache_state_.dec_used(slot.reg());
return slot.reg(); return slot.reg();
case VarState::KIntConst: { case VarState::kIntConst: {
RegClass rc = RegClass rc =
kNeedI64RegPair && slot.type() == kWasmI64 ? kGpRegPair : kGpReg; kNeedI64RegPair && slot.type() == kWasmI64 ? kGpRegPair : kGpReg;
LiftoffRegister reg = GetUnusedRegister(rc, pinned); LiftoffRegister reg = GetUnusedRegister(rc, pinned);
...@@ -566,7 +566,7 @@ void LiftoffAssembler::Spill(uint32_t index) { ...@@ -566,7 +566,7 @@ void LiftoffAssembler::Spill(uint32_t index) {
Spill(index, slot.reg(), slot.type()); Spill(index, slot.reg(), slot.type());
cache_state_.dec_used(slot.reg()); cache_state_.dec_used(slot.reg());
break; break;
case VarState::KIntConst: case VarState::kIntConst:
Spill(index, slot.constant()); Spill(index, slot.constant());
break; break;
} }
...@@ -853,7 +853,7 @@ std::ostream& operator<<(std::ostream& os, VarState slot) { ...@@ -853,7 +853,7 @@ std::ostream& operator<<(std::ostream& os, VarState slot) {
return os << "s"; return os << "s";
case VarState::kRegister: case VarState::kRegister:
return os << slot.reg(); return os << slot.reg();
case VarState::KIntConst: case VarState::kIntConst:
return os << "c" << slot.i32_const(); return os << "c" << slot.i32_const();
} }
UNREACHABLE(); UNREACHABLE();
......
...@@ -40,7 +40,7 @@ class LiftoffAssembler : public TurboAssembler { ...@@ -40,7 +40,7 @@ class LiftoffAssembler : public TurboAssembler {
class VarState { class VarState {
public: public:
enum Location : uint8_t { kStack, kRegister, KIntConst }; enum Location : uint8_t { kStack, kRegister, kIntConst };
explicit VarState(ValueType type) : loc_(kStack), type_(type) {} explicit VarState(ValueType type) : loc_(kStack), type_(type) {}
explicit VarState(ValueType type, LiftoffRegister r) explicit VarState(ValueType type, LiftoffRegister r)
...@@ -48,7 +48,7 @@ class LiftoffAssembler : public TurboAssembler { ...@@ -48,7 +48,7 @@ class LiftoffAssembler : public TurboAssembler {
DCHECK_EQ(r.reg_class(), reg_class_for(type)); DCHECK_EQ(r.reg_class(), reg_class_for(type));
} }
explicit VarState(ValueType type, int32_t i32_const) explicit VarState(ValueType type, int32_t i32_const)
: loc_(KIntConst), type_(type), i32_const_(i32_const) { : loc_(kIntConst), type_(type), i32_const_(i32_const) {
DCHECK(type_ == kWasmI32 || type_ == kWasmI64); DCHECK(type_ == kWasmI32 || type_ == kWasmI64);
} }
...@@ -60,7 +60,7 @@ class LiftoffAssembler : public TurboAssembler { ...@@ -60,7 +60,7 @@ class LiftoffAssembler : public TurboAssembler {
return true; return true;
case kRegister: case kRegister:
return reg_ == other.reg_; return reg_ == other.reg_;
case KIntConst: case kIntConst:
return i32_const_ == other.i32_const_; return i32_const_ == other.i32_const_;
} }
UNREACHABLE(); UNREACHABLE();
...@@ -70,19 +70,19 @@ class LiftoffAssembler : public TurboAssembler { ...@@ -70,19 +70,19 @@ class LiftoffAssembler : public TurboAssembler {
bool is_gp_reg() const { return loc_ == kRegister && reg_.is_gp(); } bool is_gp_reg() const { return loc_ == kRegister && reg_.is_gp(); }
bool is_fp_reg() const { return loc_ == kRegister && reg_.is_fp(); } bool is_fp_reg() const { return loc_ == kRegister && reg_.is_fp(); }
bool is_reg() const { return loc_ == kRegister; } bool is_reg() const { return loc_ == kRegister; }
bool is_const() const { return loc_ == KIntConst; } bool is_const() const { return loc_ == kIntConst; }
ValueType type() const { return type_; } ValueType type() const { return type_; }
Location loc() const { return loc_; } Location loc() const { return loc_; }
int32_t i32_const() const { int32_t i32_const() const {
DCHECK_EQ(loc_, KIntConst); DCHECK_EQ(loc_, kIntConst);
return i32_const_; return i32_const_;
} }
WasmValue constant() const { WasmValue constant() const {
DCHECK(type_ == kWasmI32 || type_ == kWasmI64); DCHECK(type_ == kWasmI32 || type_ == kWasmI64);
DCHECK_EQ(loc_, KIntConst); DCHECK_EQ(loc_, kIntConst);
return type_ == kWasmI32 ? WasmValue(i32_const_) return type_ == kWasmI32 ? WasmValue(i32_const_)
: WasmValue(int64_t{i32_const_}); : WasmValue(int64_t{i32_const_});
} }
...@@ -105,7 +105,7 @@ class LiftoffAssembler : public TurboAssembler { ...@@ -105,7 +105,7 @@ class LiftoffAssembler : public TurboAssembler {
union { union {
LiftoffRegister reg_; // used if loc_ == kRegister LiftoffRegister reg_; // used if loc_ == kRegister
int32_t i32_const_; // used if loc_ == KIntConst int32_t i32_const_; // used if loc_ == kIntConst
}; };
}; };
......
...@@ -32,7 +32,7 @@ namespace internal { ...@@ -32,7 +32,7 @@ namespace internal {
namespace wasm { namespace wasm {
constexpr auto kRegister = LiftoffAssembler::VarState::kRegister; constexpr auto kRegister = LiftoffAssembler::VarState::kRegister;
constexpr auto KIntConst = LiftoffAssembler::VarState::KIntConst; constexpr auto kIntConst = LiftoffAssembler::VarState::kIntConst;
constexpr auto kStack = LiftoffAssembler::VarState::kStack; constexpr auto kStack = LiftoffAssembler::VarState::kStack;
namespace { namespace {
...@@ -1134,7 +1134,7 @@ class LiftoffCompiler { ...@@ -1134,7 +1134,7 @@ class LiftoffCompiler {
case kRegister: case kRegister:
__ PushRegister(slot.type(), slot.reg()); __ PushRegister(slot.type(), slot.reg());
break; break;
case KIntConst: case kIntConst:
__ cache_state()->stack_state.emplace_back(imm.type, slot.i32_const()); __ cache_state()->stack_state.emplace_back(imm.type, slot.i32_const());
break; break;
case kStack: { case kStack: {
...@@ -1178,7 +1178,7 @@ class LiftoffCompiler { ...@@ -1178,7 +1178,7 @@ class LiftoffCompiler {
target_slot = source_slot; target_slot = source_slot;
if (is_tee) state.inc_used(target_slot.reg()); if (is_tee) state.inc_used(target_slot.reg());
break; break;
case KIntConst: case kIntConst:
if (target_slot.is_reg()) state.dec_used(target_slot.reg()); if (target_slot.is_reg()) state.dec_used(target_slot.reg());
target_slot = source_slot; target_slot = source_slot;
break; break;
......
...@@ -1473,7 +1473,7 @@ void LiftoffStackSlots::Construct() { ...@@ -1473,7 +1473,7 @@ void LiftoffStackSlots::Construct() {
liftoff::push(asm_, src.reg(), src.type()); liftoff::push(asm_, src.reg(), src.type());
} }
break; break;
case LiftoffAssembler::VarState::KIntConst: { case LiftoffAssembler::VarState::kIntConst: {
// The high word is the sign extension of the low word. // The high word is the sign extension of the low word.
asm_->li(kScratchReg, asm_->li(kScratchReg,
Operand(slot.half_ == kLowWord ? src.i32_const() Operand(slot.half_ == kLowWord ? src.i32_const()
......
...@@ -1308,7 +1308,7 @@ void LiftoffStackSlots::Construct() { ...@@ -1308,7 +1308,7 @@ void LiftoffStackSlots::Construct() {
case LiftoffAssembler::VarState::kRegister: case LiftoffAssembler::VarState::kRegister:
liftoff::push(asm_, src.reg(), src.type()); liftoff::push(asm_, src.reg(), src.type());
break; break;
case LiftoffAssembler::VarState::KIntConst: { case LiftoffAssembler::VarState::kIntConst: {
asm_->li(kScratchReg, Operand(src.i32_const())); asm_->li(kScratchReg, Operand(src.i32_const()));
asm_->push(kScratchReg); asm_->push(kScratchReg);
break; break;
......
...@@ -1567,7 +1567,7 @@ void LiftoffStackSlots::Construct() { ...@@ -1567,7 +1567,7 @@ void LiftoffStackSlots::Construct() {
case LiftoffAssembler::VarState::kRegister: case LiftoffAssembler::VarState::kRegister:
liftoff::push(asm_, src.reg(), src.type()); liftoff::push(asm_, src.reg(), src.type());
break; break;
case LiftoffAssembler::VarState::KIntConst: case LiftoffAssembler::VarState::kIntConst:
asm_->pushq(Immediate(src.i32_const())); asm_->pushq(Immediate(src.i32_const()));
break; break;
} }
......
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