Commit 51245896 authored by bradnelson's avatar bradnelson Committed by Commit bot

[wasm][asm.js] Print a deterministic success result by default.

Printing an asm.js success message and timings is useful,
but also non-deterministic. Making the message stable unless a flag is passed.
This will avoid making it a hassle in the future to create LayoutTests
that use asm.js and verify console output.

BUG=v8:4203
R=titzer@chromium.org

Review-Url: https://codereview.chromium.org/2574273002
Cr-Commit-Position: refs/heads/master@{#41700}
parent 058939ab
...@@ -210,9 +210,15 @@ MaybeHandle<FixedArray> AsmJs::CompileAsmViaWasm(ParseInfo* info) { ...@@ -210,9 +210,15 @@ MaybeHandle<FixedArray> AsmJs::CompileAsmViaWasm(ParseInfo* info) {
MessageLocation location(info->script(), info->literal()->position(), MessageLocation location(info->script(), info->literal()->position(),
info->literal()->position()); info->literal()->position());
char text[100]; char text[100];
int length = base::OS::SNPrintF(text, arraysize(text), int length;
"asm->wasm: %0.3f ms, compile: %0.3f ms", if (FLAG_trace_asm_time) {
asm_wasm_time, compile_time); length =
base::OS::SNPrintF(text, arraysize(text),
"success, asm->wasm: %0.3f ms, compile: %0.3f ms",
asm_wasm_time, compile_time);
} else {
length = base::OS::SNPrintF(text, arraysize(text), "success");
}
DCHECK_NE(-1, length); DCHECK_NE(-1, length);
USE(length); USE(length);
Handle<String> stext(info->isolate()->factory()->InternalizeUtf8String(text)); Handle<String> stext(info->isolate()->factory()->InternalizeUtf8String(text));
...@@ -307,9 +313,13 @@ MaybeHandle<Object> AsmJs::InstantiateAsmWasm(i::Isolate* isolate, ...@@ -307,9 +313,13 @@ MaybeHandle<Object> AsmJs::InstantiateAsmWasm(i::Isolate* isolate,
} }
MessageLocation location(script, position, position); MessageLocation location(script, position, position);
char text[50]; char text[50];
int length = int length;
base::OS::SNPrintF(text, arraysize(text), "%0.3f ms", if (FLAG_trace_asm_time) {
instantiate_timer.Elapsed().InMillisecondsF()); length = base::OS::SNPrintF(text, arraysize(text), "success, %0.3f ms",
instantiate_timer.Elapsed().InMillisecondsF());
} else {
length = base::OS::SNPrintF(text, arraysize(text), "success");
}
DCHECK_NE(-1, length); DCHECK_NE(-1, length);
USE(length); USE(length);
Handle<String> stext(isolate->factory()->InternalizeUtf8String(text)); Handle<String> stext(isolate->factory()->InternalizeUtf8String(text));
......
...@@ -506,6 +506,7 @@ DEFINE_BOOL(wasm_loop_assignment_analysis, true, ...@@ -506,6 +506,7 @@ DEFINE_BOOL(wasm_loop_assignment_analysis, true,
DEFINE_BOOL(validate_asm, false, "validate asm.js modules before compiling") DEFINE_BOOL(validate_asm, false, "validate asm.js modules before compiling")
DEFINE_IMPLICATION(ignition_staging, validate_asm) DEFINE_IMPLICATION(ignition_staging, validate_asm)
DEFINE_BOOL(trace_asm_time, false, "log asm.js timing info to the console")
DEFINE_BOOL(dump_wasm_module, false, "dump WASM module bytes") DEFINE_BOOL(dump_wasm_module, false, "dump WASM module bytes")
DEFINE_STRING(dump_wasm_module_path, NULL, "directory to dump wasm modules to") DEFINE_STRING(dump_wasm_module_path, NULL, "directory to dump wasm modules to")
......
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