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 || | |
bradnelson
2016/02/17 02:54:21
Seems prone to getting separated, #if #else ?
Mircea Trofin
2016/02/17 03:08:33
Done.
| |
2137 #endif | |
2135 FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph; | 2138 FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph; |
2136 const char* func_name = "wasm"; | 2139 const char* func_name = "wasm"; |
2137 Vector<char> buffer; | 2140 Vector<char> buffer; |
2138 if (debugging) { | 2141 if (debugging) { |
2139 buffer = Vector<char>::New(128); | 2142 buffer = Vector<char>::New(128); |
2140 SNPrintF(buffer, "WASM_function_#%d:%s", function.func_index, | 2143 SNPrintF(buffer, "WASM_function_#%d:%s", function.func_index, |
2141 module_env->module->GetName(function.name_offset)); | 2144 module_env->module->GetName(function.name_offset)); |
2142 func_name = buffer.start(); | 2145 func_name = buffer.start(); |
2143 } | 2146 } |
2144 CompilationInfo info(func_name, isolate, &zone, flags); | 2147 CompilationInfo info(func_name, isolate, &zone, flags); |
2145 | 2148 |
2146 Handle<Code> code = | 2149 Handle<Code> code = |
2147 Pipeline::GenerateCodeForTesting(&info, descriptor, &graph); | 2150 Pipeline::GenerateCodeForTesting(&info, descriptor, &graph); |
2148 if (debugging) { | 2151 if (debugging) { |
2149 buffer.Dispose(); | 2152 buffer.Dispose(); |
2150 } | 2153 } |
2151 if (!code.is_null()) { | 2154 if (!code.is_null()) { |
2152 RecordFunctionCompilation( | 2155 RecordFunctionCompilation( |
2153 Logger::FUNCTION_TAG, &info, "WASM_function", function.func_index, | 2156 Logger::FUNCTION_TAG, &info, "WASM_function", function.func_index, |
2154 module_env->module->GetName(function.name_offset)); | 2157 module_env->module->GetName(function.name_offset)); |
2155 } | 2158 } |
2156 | 2159 |
2157 return code; | 2160 return code; |
2158 } | 2161 } |
2159 | 2162 |
2160 | 2163 |
2161 } // namespace compiler | 2164 } // namespace compiler |
2162 } // namespace internal | 2165 } // namespace internal |
2163 } // namespace v8 | 2166 } // namespace v8 |
OLD | NEW |