[wasm][gc] Add stress GC mode
Add a flag which causes wasm code gc to be triggered whenever any code is found to be potentially dead. This mode found several bugs already, and I plan to enable it in 'gc-stress' mode once all issues are fixed. R=mstarzinger@chromium.org Bug: v8:8217 Change-Id: If28d980ded98b77b9efe7446da74d857e3c5e1b7 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1585720 Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#61039}
This commit is contained in:
parent
dd6c953601
commit
2300b5256d
@ -694,6 +694,8 @@ DEFINE_NEG_IMPLICATION(wasm_interpret_all, wasm_lazy_compilation)
|
||||
DEFINE_NEG_IMPLICATION(wasm_interpret_all, wasm_tier_up)
|
||||
DEFINE_BOOL(wasm_code_gc, false, "enable garbage collection of wasm code")
|
||||
DEFINE_IMPLICATION(future, wasm_code_gc)
|
||||
DEFINE_BOOL(stress_wasm_code_gc, false,
|
||||
"stress test garbage collection of wasm code")
|
||||
|
||||
// Profiler flags.
|
||||
DEFINE_INT(frame_count, 1, "number of stack frames inspected by the profiler")
|
||||
|
@ -703,12 +703,17 @@ bool WasmEngine::AddPotentiallyDeadCode(WasmCode* code) {
|
||||
auto added = it->second->potentially_dead_code.insert(code);
|
||||
if (!added.second) return false; // An entry already existed.
|
||||
new_potentially_dead_code_size_ += code->instructions().size();
|
||||
// Trigger a GC if 1MiB plus 10% of committed code are potentially dead.
|
||||
size_t dead_code_limit = 1 * MB + code_manager_.committed_code_space() / 10;
|
||||
if (FLAG_wasm_code_gc && new_potentially_dead_code_size_ > dead_code_limit &&
|
||||
!current_gc_info_) {
|
||||
new_potentially_dead_code_size_ = 0;
|
||||
TriggerGC();
|
||||
if (FLAG_wasm_code_gc) {
|
||||
// Trigger a GC if 1MiB plus 10% of committed code are potentially dead.
|
||||
size_t dead_code_limit =
|
||||
FLAG_stress_wasm_code_gc
|
||||
? 0
|
||||
: 1 * MB + code_manager_.committed_code_space() / 10;
|
||||
bool need_gc = new_potentially_dead_code_size_ > dead_code_limit;
|
||||
if (need_gc && !current_gc_info_) {
|
||||
new_potentially_dead_code_size_ = 0;
|
||||
TriggerGC();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user