[wasm] Rename a testing flag

Rename the '--wasm-max-code-space' flag to
'--wasm-max-committed-code-mb'. We will introduce a new flag to set the
maximum size of a wasm code space, so the old name would be misleadingly
close to the new flag.

R=jkummerow@chromium.org

Bug: v8:13436
Change-Id: I7a86300e4f25858add1a62f9989189035ea855ef
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4022709
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84242}
This commit is contained in:
Clemens Backes 2022-11-11 17:37:42 +01:00 committed by V8 LUCI CQ
parent beb0c0537d
commit abd024b5f3
5 changed files with 8 additions and 7 deletions

View File

@ -380,9 +380,9 @@ constexpr int kMaxDoubleStringLength = 24;
// Total wasm code space per engine (i.e. per process) is limited to make
// certain attacks that rely on heap spraying harder.
// Do not access directly, but via the {--wasm-max-committed-code-mb} flag.
// Just below 4GB, such that {kMaxWasmCodeMemory} fits in a 32-bit size_t.
constexpr size_t kMaxWasmCodeMB = 4095;
constexpr size_t kMaxWasmCodeMemory = kMaxWasmCodeMB * MB;
constexpr uint32_t kMaxCommittedWasmCodeMB = 4095;
#if V8_HOST_ARCH_64_BIT
constexpr int kSystemPointerSizeLog2 = 3;

View File

@ -1029,7 +1029,7 @@ DEFINE_UINT(wasm_max_mem_pages, kMaxUInt32,
"maximum number of 64KiB memory pages per wasm memory")
DEFINE_UINT(wasm_max_table_size, wasm::kV8MaxWasmTableSize,
"maximum table size of a wasm instance")
DEFINE_UINT(wasm_max_code_space, kMaxWasmCodeMB,
DEFINE_UINT(wasm_max_committed_code_mb, kMaxCommittedWasmCodeMB,
"maximum committed code space for wasm (in MB)")
DEFINE_BOOL(wasm_tier_up, true,
"enable tier up to the optimizing compiler (requires --liftoff to "

View File

@ -777,7 +777,8 @@ base::Vector<byte> WasmCodeAllocator::AllocateForCodeInRegion(
}
committed_code_space_.fetch_add(commit_end - commit_start);
// Committed code cannot grow bigger than maximum code space size.
DCHECK_LE(committed_code_space_.load(), v8_flags.wasm_max_code_space * MB);
DCHECK_LE(committed_code_space_.load(),
v8_flags.wasm_max_committed_code_mb * MB);
if (protect_code_memory_) {
DCHECK_LT(0, writers_count_);
InsertIntoWritableRegions({commit_start, commit_end - commit_start},
@ -1892,7 +1893,7 @@ NativeModule::~NativeModule() {
}
WasmCodeManager::WasmCodeManager()
: max_committed_code_space_(v8_flags.wasm_max_code_space * MB),
: max_committed_code_space_(v8_flags.wasm_max_committed_code_mb * MB),
critical_committed_code_space_(max_committed_code_space_ / 2) {}
WasmCodeManager::~WasmCodeManager() {

View File

@ -4,7 +4,7 @@
// Lower the maximum code space size to detect missed garbage collection
// earlier.
// Flags: --wasm-max-code-space=2
// Flags: --wasm-max-committed-code-mb=2
utils.load('test/inspector/wasm-inspector-test.js');

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --wasm-max-code-space=1
// Flags: --wasm-max-committed-code-mb=1
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');