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

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

Issue 1597163002: wasm: change the module memory size to be multiples of the page size, 64k. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 10 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 | src/wasm/wasm-module.h » ('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 6187bb61d471f09bb6918f6bf8e637cae907ef37..eada4c966daa10c74c4313f946dfa6d18ce16e09 100644
--- a/src/wasm/module-decoder.cc
+++ b/src/wasm/module-decoder.cc
@@ -45,8 +45,8 @@ class ModuleDecoder : public Decoder {
pc_ = start_;
module->module_start = start_;
module->module_end = limit_;
- module->min_mem_size_log2 = 0;
- module->max_mem_size_log2 = 0;
+ module->min_mem_pages = 0;
+ module->max_mem_pages = 0;
module->mem_export = false;
module->mem_external = false;
module->origin = origin_;
@@ -92,8 +92,9 @@ class ModuleDecoder : public Decoder {
limit_ = pc_;
break;
case kDeclMemory:
- module->min_mem_size_log2 = consume_u8("min memory");
- module->max_mem_size_log2 = consume_u8("max memory");
+ int length;
+ module->min_mem_pages = consume_u32v(&length, "min memory");
+ module->max_mem_pages = consume_u32v(&length, "max memory");
module->mem_export = consume_u8("export memory") != 0;
break;
case kDeclSignatures: {
@@ -464,7 +465,8 @@ class ModuleDecoder : public Decoder {
// Validate that the segment will fit into the (minimum) memory.
uint32_t memory_limit =
- 1 << (module ? module->min_mem_size_log2 : WasmModule::kMaxMemSize);
+ WasmModule::kPageSize * (module ? module->min_mem_pages
+ : WasmModule::kMaxMemPages);
if (!IsWithinLimit(memory_limit, segment->dest_addr,
segment->source_size)) {
error(pc_ - sizeof(uint32_t), "segment out of bounds of memory");
« no previous file with comments | « no previous file | src/wasm/wasm-module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698