Commit 7623d0fa authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Fix some lost WasmDecoder template parameters.

R=clemensh@chromium.org

Change-Id: I6539bef4a0caa01bffaad85332c31681176c24d6
Reviewed-on: https://chromium-review.googlesource.com/1204110Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55607}
parent 0e78aceb
...@@ -783,7 +783,7 @@ class WasmDecoder : public Decoder { ...@@ -783,7 +783,7 @@ class WasmDecoder : public Decoder {
break; break;
case kExprSetLocal: // fallthru case kExprSetLocal: // fallthru
case kExprTeeLocal: { case kExprTeeLocal: {
LocalIndexImmediate<Decoder::kValidate> imm(decoder, pc); LocalIndexImmediate<validate> imm(decoder, pc);
if (assigned->length() > 0 && if (assigned->length() > 0 &&
imm.index < static_cast<uint32_t>(assigned->length())) { imm.index < static_cast<uint32_t>(assigned->length())) {
// Unverified code might have an out-of-bounds index. // Unverified code might have an out-of-bounds index.
...@@ -813,8 +813,7 @@ class WasmDecoder : public Decoder { ...@@ -813,8 +813,7 @@ class WasmDecoder : public Decoder {
return VALIDATE(decoder->ok()) ? assigned : nullptr; return VALIDATE(decoder->ok()) ? assigned : nullptr;
} }
inline bool Validate(const byte* pc, inline bool Validate(const byte* pc, LocalIndexImmediate<validate>& imm) {
LocalIndexImmediate<Decoder::kValidate>& imm) {
if (!VALIDATE(imm.index < total_locals())) { if (!VALIDATE(imm.index < total_locals())) {
errorf(pc + 1, "invalid local index: %u", imm.index); errorf(pc + 1, "invalid local index: %u", imm.index);
return false; return false;
...@@ -1041,7 +1040,7 @@ class WasmDecoder : public Decoder { ...@@ -1041,7 +1040,7 @@ class WasmDecoder : public Decoder {
case kExprSetLocal: case kExprSetLocal:
case kExprTeeLocal: case kExprTeeLocal:
case kExprGetLocal: { case kExprGetLocal: {
LocalIndexImmediate<Decoder::kValidate> imm(decoder, pc); LocalIndexImmediate<validate> imm(decoder, pc);
return 1 + imm.length; return 1 + imm.length;
} }
case kExprBrTable: { case kExprBrTable: {
...@@ -1473,7 +1472,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -1473,7 +1472,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
} }
case kExprThrow: { case kExprThrow: {
CHECK_PROTOTYPE_OPCODE(eh); CHECK_PROTOTYPE_OPCODE(eh);
ExceptionIndexImmediate<Decoder::kValidate> imm(this, this->pc_); ExceptionIndexImmediate<validate> imm(this, this->pc_);
len = 1 + imm.length; len = 1 + imm.length;
if (!this->Validate(this->pc_, imm)) break; if (!this->Validate(this->pc_, imm)) break;
PopArgs(imm.exception->ToFunctionSig()); PopArgs(imm.exception->ToFunctionSig());
...@@ -1497,7 +1496,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -1497,7 +1496,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
case kExprCatch: { case kExprCatch: {
// TODO(kschimpf): Fix to use type signature of exception. // TODO(kschimpf): Fix to use type signature of exception.
CHECK_PROTOTYPE_OPCODE(eh); CHECK_PROTOTYPE_OPCODE(eh);
ExceptionIndexImmediate<Decoder::kValidate> imm(this, this->pc_); ExceptionIndexImmediate<validate> imm(this, this->pc_);
len = 1 + imm.length; len = 1 + imm.length;
if (!this->Validate(this->pc_, imm)) break; if (!this->Validate(this->pc_, imm)) break;
...@@ -1749,7 +1748,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -1749,7 +1748,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
break; break;
} }
case kExprGetLocal: { case kExprGetLocal: {
LocalIndexImmediate<Decoder::kValidate> imm(this, this->pc_); LocalIndexImmediate<validate> imm(this, this->pc_);
if (!this->Validate(this->pc_, imm)) break; if (!this->Validate(this->pc_, imm)) break;
auto* value = Push(imm.type); auto* value = Push(imm.type);
CALL_INTERFACE_IF_REACHABLE(GetLocal, value, imm); CALL_INTERFACE_IF_REACHABLE(GetLocal, value, imm);
...@@ -1757,7 +1756,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -1757,7 +1756,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
break; break;
} }
case kExprSetLocal: { case kExprSetLocal: {
LocalIndexImmediate<Decoder::kValidate> imm(this, this->pc_); LocalIndexImmediate<validate> imm(this, this->pc_);
if (!this->Validate(this->pc_, imm)) break; if (!this->Validate(this->pc_, imm)) break;
auto value = Pop(0, local_type_vec_[imm.index]); auto value = Pop(0, local_type_vec_[imm.index]);
CALL_INTERFACE_IF_REACHABLE(SetLocal, value, imm); CALL_INTERFACE_IF_REACHABLE(SetLocal, value, imm);
...@@ -1765,7 +1764,7 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -1765,7 +1764,7 @@ class WasmFullDecoder : public WasmDecoder<validate> {
break; break;
} }
case kExprTeeLocal: { case kExprTeeLocal: {
LocalIndexImmediate<Decoder::kValidate> imm(this, this->pc_); LocalIndexImmediate<validate> imm(this, this->pc_);
if (!this->Validate(this->pc_, imm)) break; if (!this->Validate(this->pc_, imm)) break;
auto value = Pop(0, local_type_vec_[imm.index]); auto value = Pop(0, local_type_vec_[imm.index]);
auto* result = Push(value.type); auto* result = Push(value.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