Commit 786bb0eb authored by titzer's avatar titzer Committed by Commit bot

[wasm] Move output of --trace-wasm-decode-time to wasm-compiler and include compile time.

R=ahaas@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1779713007

Cr-Commit-Position: refs/heads/master@{#34721}
parent f06f49c8
......@@ -6,6 +6,7 @@
#include "src/isolate-inl.h"
#include "src/base/platform/elapsed-timer.h"
#include "src/base/platform/platform.h"
#include "src/compiler/access-builder.h"
......@@ -2404,13 +2405,19 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module,
Handle<Code> CompileWasmFunction(wasm::ErrorThrower& thrower, Isolate* isolate,
wasm::ModuleEnv* module_env,
const wasm::WasmFunction& function) {
if (FLAG_trace_wasm_compiler || FLAG_trace_wasm_decode_time) {
if (FLAG_trace_wasm_compiler) {
OFStream os(stdout);
os << "Compiling WASM function "
<< wasm::WasmFunctionName(&function, module_env) << std::endl;
os << std::endl;
}
double decode_ms = 0;
base::ElapsedTimer decode_timer;
if (FLAG_trace_wasm_decode_time) {
decode_timer.Start();
}
// Create a TF graph during decoding.
Zone zone;
Graph graph(&zone);
......@@ -2441,6 +2448,14 @@ Handle<Code> CompileWasmFunction(wasm::ErrorThrower& thrower, Isolate* isolate,
return Handle<Code>::null();
}
if (FLAG_trace_wasm_decode_time) {
decode_ms = decode_timer.Elapsed().InMillisecondsF();
}
base::ElapsedTimer compile_timer;
if (FLAG_trace_wasm_decode_time) {
compile_timer.Start();
}
// Run the compiler pipeline to generate machine code.
CallDescriptor* descriptor =
wasm::ModuleEnv::GetWasmCallDescriptor(&zone, function.sig);
......@@ -2479,6 +2494,13 @@ Handle<Code> CompileWasmFunction(wasm::ErrorThrower& thrower, Isolate* isolate,
function.name_offset, function.name_length));
}
if (FLAG_trace_wasm_decode_time) {
double compile_ms = compile_timer.Elapsed().InMillisecondsF();
PrintF(
"wasm-compile ok: %d bytes, %0.3f ms decode, %0.3f ms compile\n",
static_cast<int>(function.code_end_offset - function.code_start_offset),
decode_ms, compile_ms);
}
return code;
}
......
......@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/base/platform/elapsed-timer.h"
#include "src/signature.h"
#include "src/bit-vector.h"
......@@ -369,11 +368,6 @@ class SR_WasmDecoder : public WasmDecoder {
}
TreeResult Decode() {
base::ElapsedTimer decode_timer;
if (FLAG_trace_wasm_decode_time) {
decode_timer.Start();
}
if (end_ < pc_) {
error(pc_, "function body end < start");
return result_;
......@@ -405,12 +399,7 @@ class SR_WasmDecoder : public WasmDecoder {
FunctionBody body = {module_, sig_, base_, start_, end_};
PrintAst(body);
}
if (FLAG_trace_wasm_decode_time) {
double ms = decode_timer.Elapsed().InMillisecondsF();
PrintF("wasm-decode ok (%0.3f ms)\n\n", ms);
} else {
TRACE("wasm-decode ok\n\n");
}
TRACE("wasm-decode ok\n");
} else {
TRACE("wasm-error module+%-6d func+%d: %s\n\n", baserel(error_pc_),
startrel(error_pc_), error_msg_.get());
......
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