OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/asmjs/asm-js.h" | 5 #include "src/asmjs/asm-js.h" |
6 | 6 |
7 #include "src/api-natives.h" | 7 #include "src/api-natives.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/asmjs/asm-typer.h" | 9 #include "src/asmjs/asm-typer.h" |
10 #include "src/asmjs/asm-wasm-builder.h" | 10 #include "src/asmjs/asm-wasm-builder.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 result->set(kWasmDataCompiledModule, *compiled.ToHandleChecked()); | 205 result->set(kWasmDataCompiledModule, *compiled.ToHandleChecked()); |
206 result->set(kWasmDataForeignGlobals, *foreign_globals); | 206 result->set(kWasmDataForeignGlobals, *foreign_globals); |
207 result->set(kWasmDataUsesArray, *uses_array); | 207 result->set(kWasmDataUsesArray, *uses_array); |
208 result->set(kWasmDataScript, *info->script()); | 208 result->set(kWasmDataScript, *info->script()); |
209 result->set(kWasmDataScriptPosition, | 209 result->set(kWasmDataScriptPosition, |
210 Smi::FromInt(info->literal()->position())); | 210 Smi::FromInt(info->literal()->position())); |
211 | 211 |
212 MessageLocation location(info->script(), info->literal()->position(), | 212 MessageLocation location(info->script(), info->literal()->position(), |
213 info->literal()->position()); | 213 info->literal()->position()); |
214 char text[100]; | 214 char text[100]; |
215 int length = base::OS::SNPrintF( | 215 int length; |
216 text, arraysize(text), "success, asm->wasm: %0.3f ms, compile: %0.3f ms", | 216 if (FLAG_predictable) { |
217 asm_wasm_time, compile_time); | 217 length = base::OS::SNPrintF(text, arraysize(text), "success"); |
| 218 } else { |
| 219 length = |
| 220 base::OS::SNPrintF(text, arraysize(text), |
| 221 "success, asm->wasm: %0.3f ms, compile: %0.3f ms", |
| 222 asm_wasm_time, compile_time); |
| 223 } |
218 DCHECK_NE(-1, length); | 224 DCHECK_NE(-1, length); |
219 USE(length); | 225 USE(length); |
220 Handle<String> stext(info->isolate()->factory()->InternalizeUtf8String(text)); | 226 Handle<String> stext(info->isolate()->factory()->InternalizeUtf8String(text)); |
221 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject( | 227 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject( |
222 info->isolate(), MessageTemplate::kAsmJsCompiled, &location, stext, | 228 info->isolate(), MessageTemplate::kAsmJsCompiled, &location, stext, |
223 Handle<JSArray>::null()); | 229 Handle<JSArray>::null()); |
224 message->set_error_level(v8::Isolate::kMessageInfo); | 230 message->set_error_level(v8::Isolate::kMessageInfo); |
225 if (!FLAG_suppress_asm_messages && FLAG_trace_asm_time) { | 231 if (!FLAG_suppress_asm_messages && FLAG_trace_asm_time) { |
226 MessageHandler::ReportMessage(info->isolate(), &location, message); | 232 MessageHandler::ReportMessage(info->isolate(), &location, message); |
227 } | 233 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 return single_function; | 320 return single_function; |
315 } | 321 } |
316 | 322 |
317 i::Handle<i::Script> script(i::Script::cast(wasm_data->get(kWasmDataScript))); | 323 i::Handle<i::Script> script(i::Script::cast(wasm_data->get(kWasmDataScript))); |
318 int32_t position = 0; | 324 int32_t position = 0; |
319 if (!wasm_data->get(kWasmDataScriptPosition)->ToInt32(&position)) { | 325 if (!wasm_data->get(kWasmDataScriptPosition)->ToInt32(&position)) { |
320 UNREACHABLE(); | 326 UNREACHABLE(); |
321 } | 327 } |
322 MessageLocation location(script, position, position); | 328 MessageLocation location(script, position, position); |
323 char text[50]; | 329 char text[50]; |
324 int length = | 330 int length; |
325 base::OS::SNPrintF(text, arraysize(text), "success, %0.3f ms", | 331 if (FLAG_predictable) { |
326 instantiate_timer.Elapsed().InMillisecondsF()); | 332 length = base::OS::SNPrintF(text, arraysize(text), "success"); |
| 333 } else { |
| 334 length = base::OS::SNPrintF(text, arraysize(text), "success, %0.3f ms", |
| 335 instantiate_timer.Elapsed().InMillisecondsF()); |
| 336 } |
327 DCHECK_NE(-1, length); | 337 DCHECK_NE(-1, length); |
328 USE(length); | 338 USE(length); |
329 Handle<String> stext(isolate->factory()->InternalizeUtf8String(text)); | 339 Handle<String> stext(isolate->factory()->InternalizeUtf8String(text)); |
330 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject( | 340 Handle<JSMessageObject> message = MessageHandler::MakeMessageObject( |
331 isolate, MessageTemplate::kAsmJsInstantiated, &location, stext, | 341 isolate, MessageTemplate::kAsmJsInstantiated, &location, stext, |
332 Handle<JSArray>::null()); | 342 Handle<JSArray>::null()); |
333 message->set_error_level(v8::Isolate::kMessageInfo); | 343 message->set_error_level(v8::Isolate::kMessageInfo); |
334 if (!FLAG_suppress_asm_messages && FLAG_trace_asm_time) { | 344 if (!FLAG_suppress_asm_messages && FLAG_trace_asm_time) { |
335 MessageHandler::ReportMessage(isolate, &location, message); | 345 MessageHandler::ReportMessage(isolate, &location, message); |
336 } | 346 } |
337 | 347 |
338 return module_object; | 348 return module_object; |
339 } | 349 } |
340 | 350 |
341 } // namespace internal | 351 } // namespace internal |
342 } // namespace v8 | 352 } // namespace v8 |
OLD | NEW |