Commit 15e54593 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Remove type from LocalIndexImmediate

The immediate itself is just the index, and the local type can easily be
looked up in every environment where the immediate is used. Hence remove
that field.

R=thibaudm@chromium.org

Bug: v8:10576
Change-Id: If3176fa4880a75bdc475ec61dea60e08001220f5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2266532
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68544}
parent 76e9ddb8
...@@ -1609,18 +1609,17 @@ class LiftoffCompiler { ...@@ -1609,18 +1609,17 @@ class LiftoffCompiler {
void LocalGet(FullDecoder* decoder, Value* result, void LocalGet(FullDecoder* decoder, Value* result,
const LocalIndexImmediate<validate>& imm) { const LocalIndexImmediate<validate>& imm) {
auto& slot = __ cache_state()->stack_state[imm.index]; auto& slot = __ cache_state()->stack_state[imm.index];
DCHECK_EQ(slot.type(), imm.type);
switch (slot.loc()) { switch (slot.loc()) {
case kRegister: case kRegister:
__ PushRegister(slot.type(), slot.reg()); __ PushRegister(slot.type(), slot.reg());
break; break;
case kIntConst: case kIntConst:
__ PushConstant(imm.type, slot.i32_const()); __ PushConstant(slot.type(), slot.i32_const());
break; break;
case kStack: { case kStack: {
auto rc = reg_class_for(imm.type); auto rc = reg_class_for(slot.type());
LiftoffRegister reg = __ GetUnusedRegister(rc, {}); LiftoffRegister reg = __ GetUnusedRegister(rc, {});
__ Fill(reg, slot.offset(), imm.type); __ Fill(reg, slot.offset(), slot.type());
__ PushRegister(slot.type(), reg); __ PushRegister(slot.type(), reg);
break; break;
} }
......
...@@ -260,7 +260,6 @@ ValueType read_value_type(Decoder* decoder, const byte* pc, ...@@ -260,7 +260,6 @@ ValueType read_value_type(Decoder* decoder, const byte* pc,
template <Decoder::ValidateFlag validate> template <Decoder::ValidateFlag validate>
struct LocalIndexImmediate { struct LocalIndexImmediate {
uint32_t index; uint32_t index;
ValueType type = kWasmStmt;
uint32_t length; uint32_t length;
inline LocalIndexImmediate(Decoder* decoder, const byte* pc) { inline LocalIndexImmediate(Decoder* decoder, const byte* pc) {
...@@ -1137,7 +1136,6 @@ class WasmDecoder : public Decoder { ...@@ -1137,7 +1136,6 @@ class WasmDecoder : public Decoder {
errorf(pc + 1, "invalid local index: %u", imm.index); errorf(pc + 1, "invalid local index: %u", imm.index);
return false; return false;
} }
imm.type = this->local_type(imm.index);
return true; return true;
} }
...@@ -2601,7 +2599,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -2601,7 +2599,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
case kExprLocalGet: { case kExprLocalGet: {
LocalIndexImmediate<validate> imm(this, this->pc_); LocalIndexImmediate<validate> imm(this, this->pc_);
if (!this->Validate(this->pc_, imm)) break; if (!this->Validate(this->pc_, imm)) break;
Value* value = Push(imm.type); Value* value = Push(this->local_type(imm.index));
CALL_INTERFACE_IF_REACHABLE(LocalGet, value, imm); CALL_INTERFACE_IF_REACHABLE(LocalGet, value, imm);
len = 1 + imm.length; len = 1 + imm.length;
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