[wasm] Replace FunctionSizeBytes histograms with HugeFunctionSizeBytes

We only care about huge functions (>100kB) as they can cause extended
compilation times and OOM situations. These are difficult to see in the
existing histogram as they only account for a tiny fraction of functions.
We therefore introduce a new counter that only covers those functions
and remove the other histogram.

Bug: chromium:1222273
Change-Id: I72fcec3fda5a358de6e29eb78d1fcf40059fb6c8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3008646
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Emanuel Ziegler <ecmziegler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75594}
This commit is contained in:
Emanuel Ziegler 2021-07-06 16:40:57 +02:00 committed by V8 LUCI CQ
parent 4544da7baf
commit 2acaa66ffa
3 changed files with 10 additions and 10 deletions

View File

@ -45,8 +45,10 @@ namespace internal {
HR(array_buffer_new_size_failures, V8.ArrayBufferNewSizeFailures, 0, 4096, \
13) \
HR(shared_array_allocations, V8.SharedArrayAllocationSizes, 0, 4096, 13) \
HR(wasm_asm_function_size_bytes, V8.WasmFunctionSizeBytes.asm, 1, GB, 51) \
HR(wasm_wasm_function_size_bytes, V8.WasmFunctionSizeBytes.wasm, 1, GB, 51) \
HR(wasm_asm_huge_function_size_bytes, V8.WasmHugeFunctionSizeBytes.asm, \
100 * KB, GB, 51) \
HR(wasm_wasm_huge_function_size_bytes, V8.WasmHugeFunctionSizeBytes.wasm, \
100 * KB, GB, 51) \
HR(wasm_asm_module_size_bytes, V8.WasmModuleSizeBytes.asm, 1, GB, 51) \
HR(wasm_wasm_module_size_bytes, V8.WasmModuleSizeBytes.wasm, 1, GB, 51) \
HR(wasm_asm_min_mem_pages_count, V8.WasmMinMemPagesCount.asm, 1, 2 << 16, \

View File

@ -77,10 +77,12 @@ WasmCompilationResult WasmCompilationUnit::ExecuteFunctionCompilation(
base::Optional<TimedHistogramScope> wasm_compile_function_time_scope;
if (counters) {
auto size_histogram = SELECT_WASM_COUNTER(counters, env->module->origin,
wasm, function_size_bytes);
size_histogram->AddSample(
static_cast<int>(func_body.end - func_body.start));
if ((func_body.end - func_body.start) >= 100 * KB) {
auto huge_size_histogram = SELECT_WASM_COUNTER(
counters, env->module->origin, wasm, huge_function_size_bytes);
huge_size_histogram->AddSample(
static_cast<int>(func_body.end - func_body.start));
}
auto timed_histogram = SELECT_WASM_COUNTER(counters, env->module->origin,
wasm_compile, function_time);
wasm_compile_function_time_scope.emplace(timed_histogram);

View File

@ -2173,10 +2173,6 @@ FunctionResult DecodeWasmFunctionForTesting(
const byte* function_end, Counters* counters) {
size_t size = function_end - function_start;
CHECK_LE(function_start, function_end);
auto size_histogram =
SELECT_WASM_COUNTER(counters, module->origin, wasm, function_size_bytes);
// TODO(bradnelson): Improve histogram handling of ptrdiff_t.
size_histogram->AddSample(static_cast<int>(size));
if (size > kV8MaxWasmFunctionSize) {
return FunctionResult{WasmError{0,
"size > maximum function size (%zu): %zu",