Commit 9cb567bb authored by Karl Schimpf's avatar Karl Schimpf Committed by Commit Bot

Fix UMA stat for collecting function decoding time.

This fixes collection of function decoding time (See comment #20 of
v8:6361). Updated other path for decoding to also update UMA stat.

Bug: v8:6361
Change-Id: I8e6cb398aebd7847e064d3b9a979586ded118513
Reviewed-on: https://chromium-review.googlesource.com/598458
Commit-Queue: Karl Schimpf <kschimpf@chromium.org>
Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47136}
parent f8b72674
......@@ -308,12 +308,18 @@ void ModuleCompiler::ValidateSequentially(ModuleBytesEnv* module_env,
for (uint32_t i = 0; i < module->functions.size(); ++i) {
const WasmFunction& func = module->functions[i];
if (func.imported) continue;
const byte* base = module_env->wire_bytes.start();
FunctionBody body{func.sig, func.code.offset(), base + func.code.offset(),
base + func.code.end_offset()};
DecodeResult result = VerifyWasmCode(isolate_->allocator(),
module_env->module_env.module, body);
DecodeResult result;
{
auto time_counter = module->is_wasm()
? counters()->wasm_decode_wasm_function_time()
: counters()->wasm_decode_asm_function_time();
TimedHistogramScope wasm_decode_function_time_scope(time_counter);
result = VerifyWasmCode(isolate_->allocator(),
module_env->module_env.module, body);
}
if (result.failed()) {
WasmName str = module_env->wire_bytes.GetName(&func);
thrower->CompileError("Compiling function #%d:%.*s failed: %s @+%u", i,
......
......@@ -1004,11 +1004,6 @@ class ModuleDecoder : public Decoder {
// Verifies the body (code) of a given function.
void VerifyFunctionBody(AccountingAllocator* allocator, uint32_t func_num,
ModuleBytesEnv* menv, WasmFunction* function) {
auto time_counter = IsWasm()
? GetCounters()->wasm_decode_wasm_function_time()
: GetCounters()->wasm_decode_asm_function_time();
TimedHistogramScope wasm_decode_function_time_scope(time_counter);
WasmFunctionName func_name(function,
menv->wire_bytes.GetNameOrNull(function));
if (FLAG_trace_wasm_decoder || FLAG_trace_wasm_decode_time) {
......@@ -1019,8 +1014,15 @@ class ModuleDecoder : public Decoder {
function->sig, function->code.offset(),
start_ + GetBufferRelativeOffset(function->code.offset()),
start_ + GetBufferRelativeOffset(function->code.end_offset())};
DecodeResult result = VerifyWasmCode(
allocator, menv == nullptr ? nullptr : menv->module_env.module, body);
DecodeResult result;
{
auto time_counter = IsWasm()
? GetCounters()->wasm_decode_wasm_function_time()
: GetCounters()->wasm_decode_asm_function_time();
TimedHistogramScope wasm_decode_function_time_scope(time_counter);
result = VerifyWasmCode(
allocator, menv == nullptr ? nullptr : menv->module_env.module, body);
}
if (result.failed()) {
// Wrap the error message from the function decoder.
std::ostringstream wrapped;
......
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