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