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

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

Issue 2493823003: [wasm] Allocate a single script per wasm module (Closed)
Patch Set: Fix signed/unsigned issues Created 4 years, 1 month 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
Index: src/wasm/module-decoder.cc
diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc
index 272a60ddaa6383e3503c606352d9d77fb73b2faa..345caf2ec3533c0bfd2e4c17fd0c0423506b3862 100644
--- a/src/wasm/module-decoder.cc
+++ b/src/wasm/module-decoder.cc
@@ -1152,9 +1152,8 @@ FunctionResult DecodeWasmFunction(Isolate* isolate, Zone* zone,
return decoder.DecodeSingleFunction(module_env, function);
}
-FunctionOffsetsResult DecodeWasmFunctionOffsets(
- const byte* module_start, const byte* module_end,
- uint32_t num_imported_functions) {
+FunctionOffsetsResult DecodeWasmFunctionOffsets(const byte* module_start,
+ const byte* module_end) {
// Find and decode the code section.
Vector<const byte> code_section =
FindSection(module_start, module_end, kCodeSectionCode);
@@ -1168,12 +1167,9 @@ FunctionOffsetsResult DecodeWasmFunctionOffsets(
uint32_t functions_count = decoder.consume_u32v("functions count");
// Reserve space for the entries, taking care of invalid input.
if (functions_count < static_cast<unsigned>(code_section.length()) / 2) {
- table.reserve(num_imported_functions + functions_count);
+ table.reserve(functions_count);
}
- // Add null entries for the imported functions.
- table.resize(num_imported_functions);
-
int section_offset = static_cast<int>(code_section.start() - module_start);
DCHECK_LE(0, section_offset);
for (uint32_t i = 0; i < functions_count && decoder.ok(); ++i) {
@@ -1189,20 +1185,16 @@ FunctionOffsetsResult DecodeWasmFunctionOffsets(
}
AsmJsOffsetsResult DecodeAsmJsOffsets(const byte* tables_start,
- const byte* tables_end,
- uint32_t num_imported_functions) {
+ const byte* tables_end) {
AsmJsOffsets table;
Decoder decoder(tables_start, tables_end);
uint32_t functions_count = decoder.consume_u32v("functions count");
// Reserve space for the entries, taking care of invalid input.
if (functions_count < static_cast<unsigned>(tables_end - tables_start)) {
- table.reserve(num_imported_functions + functions_count);
+ table.reserve(functions_count);
}
- // Add null entries for the imported functions.
- table.resize(num_imported_functions);
-
for (uint32_t i = 0; i < functions_count && decoder.ok(); ++i) {
uint32_t size = decoder.consume_u32v("table size");
if (size == 0) {

Powered by Google App Engine
This is Rietveld 408576698