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/platform.h" | 9 #include "src/base/platform/platform.h" |
10 | 10 |
(...skipping 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2125 thrower.Failed(buffer.start(), result); | 2125 thrower.Failed(buffer.start(), result); |
2126 return Handle<Code>::null(); | 2126 return Handle<Code>::null(); |
2127 } | 2127 } |
2128 | 2128 |
2129 // Run the compiler pipeline to generate machine code. | 2129 // Run the compiler pipeline to generate machine code. |
2130 CallDescriptor* descriptor = const_cast<CallDescriptor*>( | 2130 CallDescriptor* descriptor = const_cast<CallDescriptor*>( |
2131 module_env->GetWasmCallDescriptor(&zone, function.sig)); | 2131 module_env->GetWasmCallDescriptor(&zone, function.sig)); |
2132 Code::Flags flags = Code::ComputeFlags(Code::WASM_FUNCTION); | 2132 Code::Flags flags = Code::ComputeFlags(Code::WASM_FUNCTION); |
2133 // add flags here if a meaningful name is helpful for debugging. | 2133 // add flags here if a meaningful name is helpful for debugging. |
2134 bool debugging = | 2134 bool debugging = |
| 2135 #if DEBUG |
| 2136 true; |
| 2137 #else |
2135 FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph; | 2138 FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph; |
| 2139 #endif |
2136 const char* func_name = "wasm"; | 2140 const char* func_name = "wasm"; |
2137 Vector<char> buffer; | 2141 Vector<char> buffer; |
2138 if (debugging) { | 2142 if (debugging) { |
2139 buffer = Vector<char>::New(128); | 2143 buffer = Vector<char>::New(128); |
2140 SNPrintF(buffer, "WASM_function_#%d:%s", function.func_index, | 2144 SNPrintF(buffer, "WASM_function_#%d:%s", function.func_index, |
2141 module_env->module->GetName(function.name_offset)); | 2145 module_env->module->GetName(function.name_offset)); |
2142 func_name = buffer.start(); | 2146 func_name = buffer.start(); |
2143 } | 2147 } |
2144 CompilationInfo info(func_name, isolate, &zone, flags); | 2148 CompilationInfo info(func_name, isolate, &zone, flags); |
2145 | 2149 |
2146 Handle<Code> code = | 2150 Handle<Code> code = |
2147 Pipeline::GenerateCodeForTesting(&info, descriptor, &graph); | 2151 Pipeline::GenerateCodeForTesting(&info, descriptor, &graph); |
2148 if (debugging) { | 2152 if (debugging) { |
2149 buffer.Dispose(); | 2153 buffer.Dispose(); |
2150 } | 2154 } |
2151 if (!code.is_null()) { | 2155 if (!code.is_null()) { |
2152 RecordFunctionCompilation( | 2156 RecordFunctionCompilation( |
2153 Logger::FUNCTION_TAG, &info, "WASM_function", function.func_index, | 2157 Logger::FUNCTION_TAG, &info, "WASM_function", function.func_index, |
2154 module_env->module->GetName(function.name_offset)); | 2158 module_env->module->GetName(function.name_offset)); |
2155 } | 2159 } |
2156 | 2160 |
2157 return code; | 2161 return code; |
2158 } | 2162 } |
2159 | 2163 |
2160 | 2164 |
2161 } // namespace compiler | 2165 } // namespace compiler |
2162 } // namespace internal | 2166 } // namespace internal |
2163 } // namespace v8 | 2167 } // namespace v8 |
OLD | NEW |