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

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

Issue 2627763002: [wasm] JS APIs & memory (Closed)
Patch Set: Created 3 years, 11 months 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
« no previous file with comments | « no previous file | test/mjsunit/wasm/compiled-module-serialization.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | test/mjsunit/wasm/compiled-module-serialization.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698