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/compiler/wasm-compiler.h" | 5 #include "src/compiler/wasm-compiler.h" |
6 | 6 |
7 #include "src/isolate-inl.h" | 7 #include "src/isolate-inl.h" |
8 | 8 |
9 #include "src/base/platform/elapsed-timer.h" | 9 #include "src/base/platform/elapsed-timer.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 2443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2454 Vector<char> buffer; | 2454 Vector<char> buffer; |
2455 if (debugging) { | 2455 if (debugging) { |
2456 buffer = Vector<char>::New(128); | 2456 buffer = Vector<char>::New(128); |
2457 SNPrintF(buffer, "js-to-wasm#%d", id); | 2457 SNPrintF(buffer, "js-to-wasm#%d", id); |
2458 func_name = buffer.start(); | 2458 func_name = buffer.start(); |
2459 } | 2459 } |
2460 | 2460 |
2461 CompilationInfo info(func_name, isolate, &zone, flags); | 2461 CompilationInfo info(func_name, isolate, &zone, flags); |
2462 Handle<Code> code = | 2462 Handle<Code> code = |
2463 Pipeline::GenerateCodeForTesting(&info, incoming, &graph, nullptr); | 2463 Pipeline::GenerateCodeForTesting(&info, incoming, &graph, nullptr); |
| 2464 #ifdef ENABLE_DISASSEMBLER |
| 2465 if (FLAG_print_opt_code && !code.is_null()) { |
| 2466 OFStream os(stdout); |
| 2467 code->Disassemble(buffer.start(), os); |
| 2468 } |
| 2469 #endif |
2464 if (debugging) { | 2470 if (debugging) { |
2465 buffer.Dispose(); | 2471 buffer.Dispose(); |
2466 } | 2472 } |
2467 | 2473 |
2468 RecordFunctionCompilation( | 2474 RecordFunctionCompilation( |
2469 Logger::FUNCTION_TAG, &info, "js-to-wasm", index, | 2475 Logger::FUNCTION_TAG, &info, "js-to-wasm", index, |
2470 module->module->GetName(func->name_offset, func->name_length)); | 2476 module->module->GetName(func->name_offset, func->name_length)); |
2471 // Set the JSFunction's machine code. | 2477 // Set the JSFunction's machine code. |
2472 function->set_code(*code); | 2478 function->set_code(*code); |
2473 } | 2479 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2534 static unsigned id = 0; | 2540 static unsigned id = 0; |
2535 Vector<char> buffer; | 2541 Vector<char> buffer; |
2536 if (debugging) { | 2542 if (debugging) { |
2537 buffer = Vector<char>::New(128); | 2543 buffer = Vector<char>::New(128); |
2538 SNPrintF(buffer, "wasm-to-js#%d", id); | 2544 SNPrintF(buffer, "wasm-to-js#%d", id); |
2539 func_name = buffer.start(); | 2545 func_name = buffer.start(); |
2540 } | 2546 } |
2541 | 2547 |
2542 CompilationInfo info(func_name, isolate, &zone, flags); | 2548 CompilationInfo info(func_name, isolate, &zone, flags); |
2543 code = Pipeline::GenerateCodeForTesting(&info, incoming, &graph, nullptr); | 2549 code = Pipeline::GenerateCodeForTesting(&info, incoming, &graph, nullptr); |
| 2550 #ifdef ENABLE_DISASSEMBLER |
| 2551 if (FLAG_print_opt_code && !code.is_null()) { |
| 2552 OFStream os(stdout); |
| 2553 code->Disassemble(buffer.start(), os); |
| 2554 } |
| 2555 #endif |
2544 if (debugging) { | 2556 if (debugging) { |
2545 buffer.Dispose(); | 2557 buffer.Dispose(); |
2546 } | 2558 } |
2547 | 2559 |
2548 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, "wasm-to-js", 0, | 2560 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, "wasm-to-js", 0, |
2549 module_name); | 2561 module_name); |
2550 } | 2562 } |
2551 return code; | 2563 return code; |
2552 } | 2564 } |
2553 | 2565 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2658 static_cast<int>(function.code_end_offset - function.code_start_offset), | 2670 static_cast<int>(function.code_end_offset - function.code_start_offset), |
2659 decode_ms, static_cast<int>(graph.NodeCount()), compile_ms); | 2671 decode_ms, static_cast<int>(graph.NodeCount()), compile_ms); |
2660 } | 2672 } |
2661 return code; | 2673 return code; |
2662 } | 2674 } |
2663 | 2675 |
2664 | 2676 |
2665 } // namespace compiler | 2677 } // namespace compiler |
2666 } // namespace internal | 2678 } // namespace internal |
2667 } // namespace v8 | 2679 } // namespace v8 |
OLD | NEW |