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

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

Issue 2626313003: [wasm] Change the constant kV8MaxWasmMemoryPages to a command line flag. (Closed)
Patch Set: Rebase 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 | « src/wasm/wasm-limits.h ('k') | test/fuzzer/wasm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index c38ce3a4f5323189bd721021411985c084c66e7b..a36a9685011f9c957c806ab3a6d846f19f27b025 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -755,7 +755,7 @@ 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 > (FLAG_wasm_max_mem_pages * WasmModule::kPageSize)) {
// TODO(titzer): lift restriction on maximum memory allocated here.
return Handle<JSArrayBuffer>::null();
}
@@ -1834,7 +1834,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 > FLAG_wasm_max_mem_pages) {
thrower_->RangeError("Out of memory: wasm memory too large");
return Handle<JSArrayBuffer>::null();
}
@@ -2276,14 +2276,14 @@ uint32_t GetMaxInstanceMemoryPages(Isolate* isolate,
Handle<WasmMemoryObject> memory_object(instance->memory_object(), isolate);
if (memory_object->has_maximum_pages()) {
uint32_t maximum = static_cast<uint32_t>(memory_object->maximum_pages());
- if (maximum < kV8MaxWasmMemoryPages) return maximum;
+ if (maximum < FLAG_wasm_max_mem_pages) return maximum;
}
}
uint32_t compiled_max_pages = instance->compiled_module()->max_mem_pages();
isolate->counters()->wasm_max_mem_pages_count()->AddSample(
compiled_max_pages);
if (compiled_max_pages != 0) return compiled_max_pages;
- return kV8MaxWasmMemoryPages;
+ return FLAG_wasm_max_mem_pages;
}
Handle<JSArrayBuffer> GrowMemoryBuffer(Isolate* isolate,
@@ -2301,7 +2301,7 @@ 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) {
+ FLAG_wasm_max_mem_pages * WasmModule::kPageSize < new_size) {
return Handle<JSArrayBuffer>::null();
}
@@ -2368,9 +2368,9 @@ int32_t wasm::GrowWebAssemblyMemory(Isolate* isolate,
uint32_t max_pages;
if (memory_object->has_maximum_pages()) {
max_pages = static_cast<uint32_t>(memory_object->maximum_pages());
- if (kV8MaxWasmMemoryPages < max_pages) return -1;
+ if (FLAG_wasm_max_mem_pages < max_pages) return -1;
} else {
- max_pages = kV8MaxWasmMemoryPages;
+ max_pages = FLAG_wasm_max_mem_pages;
}
new_buffer = GrowMemoryBuffer(isolate, memory_buffer, pages, max_pages);
if (new_buffer.is_null()) return -1;
« no previous file with comments | « 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