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

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

Issue 2626313003: [wasm] Change the constant kV8MaxWasmMemoryPages to a command line flag. (Closed)
Patch Set: typo 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
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index e5173eba092125e14e79ec818d335a9c114c0dde..8f54a1dc8fc1c5f9d619746fd2f9cbd9cf6c0a0e 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -745,7 +745,8 @@ Handle<Script> CreateWasmScript(Isolate* isolate,
Handle<JSArrayBuffer> wasm::NewArrayBuffer(Isolate* isolate, size_t size,
bool enable_guard_regions) {
- if (size > (kV8MaxWasmMemoryPages * WasmModule::kPageSize)) {
+ if (size > (static_cast<uint32_t>(FLAG_wasm_max_mem_pages) *
+ WasmModule::kPageSize)) {
// TODO(titzer): lift restriction on maximum memory allocated here.
return Handle<JSArrayBuffer>::null();
}
@@ -1767,7 +1768,7 @@ class WasmInstanceBuilder {
// Allocate memory for a module instance as a new JSArrayBuffer.
Handle<JSArrayBuffer> AllocateMemory(uint32_t min_mem_pages) {
- if (min_mem_pages > kV8MaxWasmMemoryPages) {
+ if (min_mem_pages > static_cast<uint32_t>(FLAG_wasm_max_mem_pages)) {
thrower_->RangeError("Out of memory: wasm memory too large");
return Handle<JSArrayBuffer>::null();
}
@@ -2198,7 +2199,7 @@ uint32_t GetMaxInstanceMemorySize(Isolate* isolate,
isolate->counters()->wasm_max_mem_pages_count()->AddSample(
compiled_max_pages);
if (compiled_max_pages != 0) return compiled_max_pages;
- return kV8MaxWasmMemoryPages;
+ return static_cast<uint32_t>(FLAG_wasm_max_mem_pages);
}
Handle<JSArrayBuffer> GrowMemoryBuffer(Isolate* isolate,
@@ -2216,7 +2217,8 @@ Handle<JSArrayBuffer> GrowMemoryBuffer(Isolate* isolate,
std::numeric_limits<uint32_t>::max());
uint32_t new_size = old_size + pages * WasmModule::kPageSize;
if (new_size <= old_size || max_pages * WasmModule::kPageSize < new_size ||
- kV8MaxWasmMemoryPages * WasmModule::kPageSize < new_size) {
+ static_cast<uint32_t>(FLAG_wasm_max_mem_pages) * WasmModule::kPageSize <
+ new_size) {
return Handle<JSArrayBuffer>::null();
}
« src/flag-definitions.h ('K') | « src/wasm/wasm-limits.h ('k') | test/fuzzer/wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698