Commit 96161926 authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[liftoff] Use helpers to push values onto stack

This is in preparation for having unfixed slot sizes, where each push
operation will need to record the slot offset of the value.

Bug: v8:9909
Change-Id: I04734d4e67bbae70bdf4351f3afe9d0cc5f3f532
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1913500Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64941}
parent 6fa327e3
......@@ -258,6 +258,15 @@ class LiftoffAssembler : public TurboAssembler {
cache_state_.stack_state.emplace_back(type, reg);
}
void PushConstant(ValueType type, int32_t i32_const) {
DCHECK(type == kWasmI32 || type == kWasmI64);
cache_state_.stack_state.emplace_back(type, i32_const);
}
void PushStack(ValueType type) {
cache_state_.stack_state.emplace_back(type);
}
void SpillRegister(LiftoffRegister);
uint32_t GetNumUses(LiftoffRegister reg) {
......
......@@ -438,13 +438,13 @@ class LiftoffCompiler {
for (uint32_t param_idx = num_params; param_idx < __ num_locals();
++param_idx) {
ValueType type = decoder->GetLocalType(param_idx);
__ cache_state()->stack_state.emplace_back(type);
__ PushStack(type);
}
} else {
for (uint32_t param_idx = num_params; param_idx < __ num_locals();
++param_idx) {
ValueType type = decoder->GetLocalType(param_idx);
__ cache_state()->stack_state.emplace_back(type, int32_t{0});
__ PushConstant(type, int32_t{0});
}
}
......@@ -1218,7 +1218,7 @@ class LiftoffCompiler {
}
void I32Const(FullDecoder* decoder, Value* result, int32_t value) {
__ cache_state()->stack_state.emplace_back(kWasmI32, value);
__ PushConstant(kWasmI32, value);
}
void I64Const(FullDecoder* decoder, Value* result, int64_t value) {
......@@ -1228,7 +1228,7 @@ class LiftoffCompiler {
// a register immediately.
int32_t value_i32 = static_cast<int32_t>(value);
if (value_i32 == value) {
__ cache_state()->stack_state.emplace_back(kWasmI64, value_i32);
__ PushConstant(kWasmI64, value_i32);
} else {
LiftoffRegister reg = __ GetUnusedRegister(reg_class_for(kWasmI64));
__ LoadConstant(reg, WasmValue(value));
......@@ -1287,7 +1287,7 @@ class LiftoffCompiler {
__ PushRegister(slot.type(), slot.reg());
break;
case kIntConst:
__ cache_state()->stack_state.emplace_back(imm.type, slot.i32_const());
__ PushConstant(imm.type, slot.i32_const());
break;
case kStack: {
auto rc = reg_class_for(imm.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