Commit cbbcef80 authored by ritesht's avatar ritesht Committed by Commit bot

[wasm] Deleting unused parameter from function "consume_u32v"

Merge branch 'master' of https://chromium.googlesource.com/v7/v8 into unused_variables

Removed unused variables "length" from the signature "consume_u32v". The variable length (passed in as a parameter) is not read from the function, rather it set based on the pc_ offset. However, the value set is also not used in the main line of control flow during decoding. This seems to be some dead code.

BUG=

Review-Url: https://codereview.chromium.org/2093823003
Cr-Commit-Position: refs/heads/master@{#37233}
parent 9f2a18b7
...@@ -584,10 +584,9 @@ class SR_WasmDecoder : public WasmDecoder { ...@@ -584,10 +584,9 @@ class SR_WasmDecoder : public WasmDecoder {
} }
} }
// Decode local declarations, if any. // Decode local declarations, if any.
int length; uint32_t entries = consume_u32v("local decls count");
uint32_t entries = consume_u32v(&length, "local decls count");
while (entries-- > 0 && pc_ < limit_) { while (entries-- > 0 && pc_ < limit_) {
uint32_t count = consume_u32v(&length, "local count"); uint32_t count = consume_u32v("local count");
byte code = consume_u8("local type"); byte code = consume_u8("local type");
LocalType type; LocalType type;
switch (code) { switch (code) {
......
...@@ -204,10 +204,9 @@ class Decoder { ...@@ -204,10 +204,9 @@ class Decoder {
} }
// Reads a LEB128 variable-length 32-bit integer and advances {pc_}. // Reads a LEB128 variable-length 32-bit integer and advances {pc_}.
uint32_t consume_u32v(int* length, const char* name = nullptr) { uint32_t consume_u32v(const char* name = nullptr) {
TRACE(" +%d %-20s: ", static_cast<int>(pc_ - start_), TRACE(" +%d %-20s: ", static_cast<int>(pc_ - start_),
name ? name : "varint"); name ? name : "varint");
if (checkAvailable(1)) { if (checkAvailable(1)) {
const byte* pos = pc_; const byte* pos = pc_;
const byte* end = pc_ + 5; const byte* end = pc_ + 5;
...@@ -224,10 +223,10 @@ class Decoder { ...@@ -224,10 +223,10 @@ class Decoder {
shift += 7; shift += 7;
} }
*length = static_cast<int>(pc_ - pos); int length = static_cast<int>(pc_ - pos);
if (pc_ == end && (b & 0x80)) { if (pc_ == end && (b & 0x80)) {
error(pc_ - 1, "varint too large"); error(pc_ - 1, "varint too large");
} else if (*length == 0) { } else if (length == 0) {
error(pc_, "varint of length 0"); error(pc_, "varint of length 0");
} else { } else {
TRACE("= %u\n", result); TRACE("= %u\n", result);
......
This diff is collapsed.
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