Commit 87713b37 authored by Karl Schimpf's avatar Karl Schimpf Committed by Commit Bot

Fix UMA stats for WASM functions

Fixes the collection of V8.WasmFuncctionSizeBytes.wasm for UMA stats.

Bug: v8:6852
Change-Id: Ib25d249dd2856ffb8a3205e54ba052c1bc9a09cf
Reviewed-on: https://chromium-review.googlesource.com/678448Reviewed-by: 's avatarMircea Trofin <mtrofin@chromium.org>
Commit-Queue: Karl Schimpf <kschimpf@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48125}
parent d607f1e7
......@@ -777,11 +777,7 @@ DecodeResult VerifyWasmCodeWithStats(AccountingAllocator* allocator,
const wasm::WasmModule* module,
FunctionBody& body, bool is_wasm,
Counters* counters) {
auto size_histogram = is_wasm ? counters->wasm_wasm_function_size_bytes()
: counters->wasm_asm_function_size_bytes();
// TODO(bradnelson): Improve histogram handling of ptrdiff_t.
CHECK_LE(0, body.end - body.start);
size_histogram->AddSample(static_cast<int>(body.end - body.start));
auto time_counter = is_wasm ? counters->wasm_decode_wasm_function_time()
: counters->wasm_decode_asm_function_time();
TimedHistogramScope wasm_decode_function_time_scope(time_counter);
......
......@@ -733,6 +733,10 @@ class ModuleDecoderImpl : public Decoder {
void DecodeFunctionBody(uint32_t index, uint32_t length, uint32_t offset,
bool verify_functions) {
auto size_histogram = module_->is_wasm()
? GetCounters()->wasm_wasm_function_size_bytes()
: GetCounters()->wasm_asm_function_size_bytes();
size_histogram->AddSample(length);
WasmFunction* function =
&module_->functions[index + module_->num_imported_functions];
function->code = {offset, length};
......@@ -1437,6 +1441,11 @@ FunctionResult DecodeWasmFunction(Isolate* isolate, Zone* zone,
size_t size = function_end - function_start;
if (function_start > function_end)
return FunctionResult::Error("start > end");
auto size_histogram = module->is_wasm()
? counters->wasm_wasm_function_size_bytes()
: counters->wasm_asm_function_size_bytes();
// TODO(bradnelson): Improve histogram handling of ptrdiff_t.
size_histogram->AddSample(static_cast<int>(size));
if (size > kV8MaxWasmFunctionSize)
return FunctionResult::Error("size > maximum function size: %zu", size);
ModuleDecoderImpl decoder(function_start, function_end, kWasmOrigin);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment