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 2948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2959 if (debugging) { | 2959 if (debugging) { |
2960 buffer = Vector<char>::New(128); | 2960 buffer = Vector<char>::New(128); |
2961 int chars = SNPrintF(buffer, "WASM_function_#%d", function.func_index); | 2961 int chars = SNPrintF(buffer, "WASM_function_#%d", function.func_index); |
2962 func_name = Vector<const char>::cast(buffer.SubVector(0, chars)); | 2962 func_name = Vector<const char>::cast(buffer.SubVector(0, chars)); |
2963 } else { | 2963 } else { |
2964 func_name = ArrayVector("wasm"); | 2964 func_name = ArrayVector("wasm"); |
2965 } | 2965 } |
2966 } | 2966 } |
2967 CompilationInfo info(func_name, isolate, &zone, flags); | 2967 CompilationInfo info(func_name, isolate, &zone, flags); |
2968 | 2968 |
2969 Handle<Code> code = Pipeline::GenerateWASMCode(&info, descriptor, &graph, | 2969 Handle<Code> code = Pipeline::GenerateWASMCode( |
2970 &source_position_table); | 2970 &info, descriptor, &graph, &source_position_table, |
| 2971 module_env->instance->js_object, function.func_index); |
2971 | 2972 |
2972 buffer.Dispose(); | 2973 buffer.Dispose(); |
2973 | 2974 |
2974 if (!code.is_null()) { | 2975 if (!code.is_null()) { |
2975 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, "WASM_function", | 2976 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, "WASM_function", |
2976 function.func_index, | 2977 function.func_index, |
2977 module_env->module->GetName( | 2978 module_env->module->GetName( |
2978 function.name_offset, function.name_length)); | 2979 function.name_offset, function.name_length)); |
2979 } | 2980 } |
2980 | 2981 |
2981 if (FLAG_trace_wasm_decode_time) { | 2982 if (FLAG_trace_wasm_decode_time) { |
2982 double compile_ms = compile_timer.Elapsed().InMillisecondsF(); | 2983 double compile_ms = compile_timer.Elapsed().InMillisecondsF(); |
2983 PrintF( | 2984 PrintF( |
2984 "wasm-compile ok: %d bytes, %0.3f ms decode, %d nodes, %0.3f ms " | 2985 "wasm-compile ok: %d bytes, %0.3f ms decode, %d nodes, %0.3f ms " |
2985 "compile\n", | 2986 "compile\n", |
2986 static_cast<int>(function.code_end_offset - function.code_start_offset), | 2987 static_cast<int>(function.code_end_offset - function.code_start_offset), |
2987 decode_ms, static_cast<int>(graph.NodeCount()), compile_ms); | 2988 decode_ms, static_cast<int>(graph.NodeCount()), compile_ms); |
2988 } | 2989 } |
2989 // TODO(bradnelson): Improve histogram handling of size_t. | 2990 // TODO(bradnelson): Improve histogram handling of size_t. |
2990 isolate->counters()->wasm_compile_function_peak_memory_bytes()->AddSample( | 2991 isolate->counters()->wasm_compile_function_peak_memory_bytes()->AddSample( |
2991 static_cast<int>(zone.allocation_size())); | 2992 static_cast<int>(zone.allocation_size())); |
2992 return code; | 2993 return code; |
2993 } | 2994 } |
2994 | 2995 |
2995 | 2996 |
2996 } // namespace compiler | 2997 } // namespace compiler |
2997 } // namespace internal | 2998 } // namespace internal |
2998 } // namespace v8 | 2999 } // namespace v8 |
OLD | NEW |