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 2657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2668 module_name); | 2668 module_name); |
2669 } | 2669 } |
2670 return code; | 2670 return code; |
2671 } | 2671 } |
2672 | 2672 |
2673 | 2673 |
2674 // Helper function to compile a single function. | 2674 // Helper function to compile a single function. |
2675 Handle<Code> CompileWasmFunction(wasm::ErrorThrower& thrower, Isolate* isolate, | 2675 Handle<Code> CompileWasmFunction(wasm::ErrorThrower& thrower, Isolate* isolate, |
2676 wasm::ModuleEnv* module_env, | 2676 wasm::ModuleEnv* module_env, |
2677 const wasm::WasmFunction& function) { | 2677 const wasm::WasmFunction& function) { |
| 2678 HistogramTimerScope wasm_compile_function_time_scope( |
| 2679 isolate->counters()->wasm_compile_function_time()); |
2678 if (FLAG_trace_wasm_compiler) { | 2680 if (FLAG_trace_wasm_compiler) { |
2679 OFStream os(stdout); | 2681 OFStream os(stdout); |
2680 os << "Compiling WASM function " | 2682 os << "Compiling WASM function " |
2681 << wasm::WasmFunctionName(&function, module_env) << std::endl; | 2683 << wasm::WasmFunctionName(&function, module_env) << std::endl; |
2682 os << std::endl; | 2684 os << std::endl; |
2683 } | 2685 } |
2684 | 2686 |
2685 double decode_ms = 0; | 2687 double decode_ms = 0; |
2686 base::ElapsedTimer decode_timer; | 2688 base::ElapsedTimer decode_timer; |
2687 if (FLAG_trace_wasm_decode_time) { | 2689 if (FLAG_trace_wasm_decode_time) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2771 } | 2773 } |
2772 | 2774 |
2773 if (FLAG_trace_wasm_decode_time) { | 2775 if (FLAG_trace_wasm_decode_time) { |
2774 double compile_ms = compile_timer.Elapsed().InMillisecondsF(); | 2776 double compile_ms = compile_timer.Elapsed().InMillisecondsF(); |
2775 PrintF( | 2777 PrintF( |
2776 "wasm-compile ok: %d bytes, %0.3f ms decode, %d nodes, %0.3f ms " | 2778 "wasm-compile ok: %d bytes, %0.3f ms decode, %d nodes, %0.3f ms " |
2777 "compile\n", | 2779 "compile\n", |
2778 static_cast<int>(function.code_end_offset - function.code_start_offset), | 2780 static_cast<int>(function.code_end_offset - function.code_start_offset), |
2779 decode_ms, static_cast<int>(graph.NodeCount()), compile_ms); | 2781 decode_ms, static_cast<int>(graph.NodeCount()), compile_ms); |
2780 } | 2782 } |
| 2783 isolate->counters()->wasm_compile_function_peak_memory()->AddSample( |
| 2784 static_cast<int>(zone.allocation_size())); |
2781 return code; | 2785 return code; |
2782 } | 2786 } |
2783 | 2787 |
2784 | 2788 |
2785 } // namespace compiler | 2789 } // namespace compiler |
2786 } // namespace internal | 2790 } // namespace internal |
2787 } // namespace v8 | 2791 } // namespace v8 |
OLD | NEW |