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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 &table->max_size); | 317 &table->max_size); |
318 break; | 318 break; |
319 } | 319 } |
320 case kExternalMemory: { | 320 case kExternalMemory: { |
321 // ===== Imported memory ========================================= | 321 // ===== Imported memory ========================================= |
322 bool has_max = false; | 322 bool has_max = false; |
323 consume_resizable_limits("memory", "pages", kV8MaxWasmMemoryPages, | 323 consume_resizable_limits("memory", "pages", kV8MaxWasmMemoryPages, |
324 &module->min_mem_pages, &has_max, | 324 &module->min_mem_pages, &has_max, |
325 kSpecMaxWasmMemoryPages, | 325 kSpecMaxWasmMemoryPages, |
326 &module->max_mem_pages); | 326 &module->max_mem_pages); |
327 module->has_memory = true; | 327 if (module->has_memory) { |
| 328 error("At most one memory object is supported"); |
| 329 } else { |
| 330 module->has_memory = true; |
| 331 } |
328 break; | 332 break; |
329 } | 333 } |
330 case kExternalGlobal: { | 334 case kExternalGlobal: { |
331 // ===== Imported global ========================================= | 335 // ===== Imported global ========================================= |
332 import->index = static_cast<uint32_t>(module->globals.size()); | 336 import->index = static_cast<uint32_t>(module->globals.size()); |
333 module->globals.push_back( | 337 module->globals.push_back( |
334 {kWasmStmt, false, WasmInitExpr(), 0, true, false}); | 338 {kWasmStmt, false, WasmInitExpr(), 0, true, false}); |
335 WasmGlobal* global = &module->globals.back(); | 339 WasmGlobal* global = &module->globals.back(); |
336 global->type = consume_value_type(); | 340 global->type = consume_value_type(); |
337 global->mutability = consume_u8("mutability") != 0; | 341 global->mutability = consume_u8("mutability") != 0; |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 table.push_back(std::move(func_asm_offsets)); | 1231 table.push_back(std::move(func_asm_offsets)); |
1228 } | 1232 } |
1229 if (decoder.more()) decoder.error("unexpected additional bytes"); | 1233 if (decoder.more()) decoder.error("unexpected additional bytes"); |
1230 | 1234 |
1231 return decoder.toResult(std::move(table)); | 1235 return decoder.toResult(std::move(table)); |
1232 } | 1236 } |
1233 | 1237 |
1234 } // namespace wasm | 1238 } // namespace wasm |
1235 } // namespace internal | 1239 } // namespace internal |
1236 } // namespace v8 | 1240 } // namespace v8 |
OLD | NEW |