Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: src/wasm/module-decoder.cc

Issue 1763433002: [wasm] Rework encoding of local declarations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/encoder.cc ('k') | src/wasm/wasm-macro-gen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/module-decoder.cc
diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc
index 01df66a2dc3b363babfeedcea0d090f69650ddb5..401fb1823973049a9f616662a79b9699e91c8530 100644
--- a/src/wasm/module-decoder.cc
+++ b/src/wasm/module-decoder.cc
@@ -338,14 +338,10 @@ class ModuleDecoder : public Decoder {
FunctionResult DecodeSingleFunction(ModuleEnv* module_env,
WasmFunction* function) {
pc_ = start_;
- function->sig = consume_sig(); // read signature
+ function->sig = consume_sig(); // read signature
function->name_offset = 0; // ---- name
- function->code_start_offset = off(pc_ + 8); // ---- code start
+ function->code_start_offset = off(pc_); // ---- code start
function->code_end_offset = off(limit_); // ---- code end
- function->local_i32_count = consume_u16(); // read u16
- function->local_i64_count = consume_u16(); // read u16
- function->local_f32_count = consume_u16(); // read u16
- function->local_f64_count = consume_u16(); // read u16
function->exported = false; // ---- exported
function->external = false; // ---- external
@@ -473,18 +469,10 @@ class ModuleDecoder : public Decoder {
<< std::endl;
os << std::endl;
}
- FunctionEnv fenv;
- fenv.module = menv;
- fenv.sig = function->sig;
- fenv.local_i32_count = function->local_i32_count;
- fenv.local_i64_count = function->local_i64_count;
- fenv.local_f32_count = function->local_f32_count;
- fenv.local_f64_count = function->local_f64_count;
- fenv.SumLocals();
-
- TreeResult result =
- VerifyWasmCode(&fenv, start_, start_ + function->code_start_offset,
- start_ + function->code_end_offset);
+ FunctionBody body = {menv, function->sig, start_,
+ start_ + function->code_start_offset,
+ start_ + function->code_end_offset};
+ TreeResult result = VerifyWasmCode(body);
if (result.failed()) {
// Wrap the error message from the function decoder.
std::ostringstream str;
« no previous file with comments | « src/wasm/encoder.cc ('k') | src/wasm/wasm-macro-gen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698