| Index: src/wasm/module-decoder.cc
|
| diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc
|
| index 8f92c6e34cf28de44777fd1961df40c08d16f9fb..d7c7954de2e5d700121aad968d676e193d21d163 100644
|
| --- a/src/wasm/module-decoder.cc
|
| +++ b/src/wasm/module-decoder.cc
|
| @@ -324,11 +324,7 @@ class ModuleDecoder : public Decoder {
|
| &module->min_mem_pages, &has_max,
|
| kSpecMaxWasmMemoryPages,
|
| &module->max_mem_pages);
|
| - if (module->has_memory) {
|
| - error("At most one memory object is supported");
|
| - } else {
|
| - module->has_memory = true;
|
| - }
|
| + SetHasMemory(module);
|
| break;
|
| }
|
| case kExternalGlobal: {
|
| @@ -403,7 +399,7 @@ class ModuleDecoder : public Decoder {
|
| "memory", "pages", kV8MaxWasmMemoryPages, &module->min_mem_pages,
|
| &has_max, kSpecMaxWasmMemoryPages, &module->max_mem_pages);
|
| }
|
| - module->has_memory = true;
|
| + SetHasMemory(module);
|
| section_iter.advance();
|
| }
|
|
|
| @@ -684,6 +680,14 @@ class ModuleDecoder : public Decoder {
|
|
|
| uint32_t off(const byte* ptr) { return static_cast<uint32_t>(ptr - start_); }
|
|
|
| + void SetHasMemory(WasmModule* module) {
|
| + if (module->has_memory) {
|
| + error("At most one memory object is supported");
|
| + } else {
|
| + module->has_memory = true;
|
| + }
|
| + }
|
| +
|
| // Decodes a single global entry inside a module starting at {pc_}.
|
| void DecodeGlobalInModule(WasmModule* module, uint32_t index,
|
| WasmGlobal* global) {
|
|
|