OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/wasm/module-decoder.h" | 5 #include "src/wasm/module-decoder.h" |
6 | 6 |
7 #include "src/base/functional.h" | 7 #include "src/base/functional.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/flags.h" | 9 #include "src/flags.h" |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 consume_resizable_limits("element count", "elements", | 315 consume_resizable_limits("element count", "elements", |
316 kV8MaxWasmTableSize, &table->min_size, | 316 kV8MaxWasmTableSize, &table->min_size, |
317 &table->has_max, kV8MaxWasmTableSize, | 317 &table->has_max, kV8MaxWasmTableSize, |
318 &table->max_size); | 318 &table->max_size); |
319 break; | 319 break; |
320 } | 320 } |
321 case kExternalMemory: { | 321 case kExternalMemory: { |
322 // ===== Imported memory ========================================= | 322 // ===== Imported memory ========================================= |
323 if (!AddMemory(module)) break; | 323 if (!AddMemory(module)) break; |
324 consume_resizable_limits( | 324 consume_resizable_limits( |
325 "memory", "pages", kV8MaxWasmMemoryPages, | 325 "memory", "pages", FLAG_wasm_max_mem_pages, |
326 &module->min_mem_pages, &module->has_max_mem, | 326 &module->min_mem_pages, &module->has_max_mem, |
327 kSpecMaxWasmMemoryPages, &module->max_mem_pages); | 327 kSpecMaxWasmMemoryPages, &module->max_mem_pages); |
328 break; | 328 break; |
329 } | 329 } |
330 case kExternalGlobal: { | 330 case kExternalGlobal: { |
331 // ===== Imported global ========================================= | 331 // ===== Imported global ========================================= |
332 import->index = static_cast<uint32_t>(module->globals.size()); | 332 import->index = static_cast<uint32_t>(module->globals.size()); |
333 module->globals.push_back( | 333 module->globals.push_back( |
334 {kWasmStmt, false, WasmInitExpr(), 0, true, false}); | 334 {kWasmStmt, false, WasmInitExpr(), 0, true, false}); |
335 WasmGlobal* global = &module->globals.back(); | 335 WasmGlobal* global = &module->globals.back(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 } | 387 } |
388 section_iter.advance(); | 388 section_iter.advance(); |
389 } | 389 } |
390 | 390 |
391 // ===== Memory section ================================================== | 391 // ===== Memory section ================================================== |
392 if (section_iter.section_code() == kMemorySectionCode) { | 392 if (section_iter.section_code() == kMemorySectionCode) { |
393 uint32_t memory_count = consume_count("memory count", kV8MaxWasmMemories); | 393 uint32_t memory_count = consume_count("memory count", kV8MaxWasmMemories); |
394 | 394 |
395 for (uint32_t i = 0; ok() && i < memory_count; i++) { | 395 for (uint32_t i = 0; ok() && i < memory_count; i++) { |
396 if (!AddMemory(module)) break; | 396 if (!AddMemory(module)) break; |
397 consume_resizable_limits("memory", "pages", kV8MaxWasmMemoryPages, | 397 consume_resizable_limits("memory", "pages", FLAG_wasm_max_mem_pages, |
398 &module->min_mem_pages, &module->has_max_mem, | 398 &module->min_mem_pages, &module->has_max_mem, |
399 kSpecMaxWasmMemoryPages, | 399 kSpecMaxWasmMemoryPages, |
400 &module->max_mem_pages); | 400 &module->max_mem_pages); |
401 } | 401 } |
402 section_iter.advance(); | 402 section_iter.advance(); |
403 } | 403 } |
404 | 404 |
405 // ===== Global section ================================================== | 405 // ===== Global section ================================================== |
406 if (section_iter.section_code() == kGlobalSectionCode) { | 406 if (section_iter.section_code() == kGlobalSectionCode) { |
407 uint32_t globals_count = | 407 uint32_t globals_count = |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1256 table.push_back(std::move(func_asm_offsets)); | 1256 table.push_back(std::move(func_asm_offsets)); |
1257 } | 1257 } |
1258 if (decoder.more()) decoder.error("unexpected additional bytes"); | 1258 if (decoder.more()) decoder.error("unexpected additional bytes"); |
1259 | 1259 |
1260 return decoder.toResult(std::move(table)); | 1260 return decoder.toResult(std::move(table)); |
1261 } | 1261 } |
1262 | 1262 |
1263 } // namespace wasm | 1263 } // namespace wasm |
1264 } // namespace internal | 1264 } // namespace internal |
1265 } // namespace v8 | 1265 } // namespace v8 |
OLD | NEW |