| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 break; | 450 break; |
| 451 } | 451 } |
| 452 case kExternalTable: { | 452 case kExternalTable: { |
| 453 WasmIndirectFunctionTable* table = nullptr; | 453 WasmIndirectFunctionTable* table = nullptr; |
| 454 exp->index = consume_table_index(module, &table); | 454 exp->index = consume_table_index(module, &table); |
| 455 if (table) table->exported = true; | 455 if (table) table->exported = true; |
| 456 break; | 456 break; |
| 457 } | 457 } |
| 458 case kExternalMemory: { | 458 case kExternalMemory: { |
| 459 uint32_t index = consume_u32v("memory index"); | 459 uint32_t index = consume_u32v("memory index"); |
| 460 if (index != 0) error("invalid memory index != 0"); | 460 // TODO(titzer): This should become more regular |
| 461 // once we support multiple memories. |
| 462 if (!module->has_memory || index != 0) { |
| 463 error("invalid memory index != 0"); |
| 464 } |
| 461 module->mem_export = true; | 465 module->mem_export = true; |
| 462 break; | 466 break; |
| 463 } | 467 } |
| 464 case kExternalGlobal: { | 468 case kExternalGlobal: { |
| 465 WasmGlobal* global = nullptr; | 469 WasmGlobal* global = nullptr; |
| 466 exp->index = consume_global_index(module, &global); | 470 exp->index = consume_global_index(module, &global); |
| 467 if (global) { | 471 if (global) { |
| 468 if (global->mutability) { | 472 if (global->mutability) { |
| 469 error("mutable globals cannot be exported"); | 473 error("mutable globals cannot be exported"); |
| 470 } | 474 } |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 table.push_back(std::move(func_asm_offsets)); | 1239 table.push_back(std::move(func_asm_offsets)); |
| 1236 } | 1240 } |
| 1237 if (decoder.more()) decoder.error("unexpected additional bytes"); | 1241 if (decoder.more()) decoder.error("unexpected additional bytes"); |
| 1238 | 1242 |
| 1239 return decoder.toResult(std::move(table)); | 1243 return decoder.toResult(std::move(table)); |
| 1240 } | 1244 } |
| 1241 | 1245 |
| 1242 } // namespace wasm | 1246 } // namespace wasm |
| 1243 } // namespace internal | 1247 } // namespace internal |
| 1244 } // namespace v8 | 1248 } // namespace v8 |
| OLD | NEW |