| 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 2215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2226 OFStream os(stdout); | 2226 OFStream os(stdout); |
| 2227 os << "-- Graph after change lowering -- " << std::endl; | 2227 os << "-- Graph after change lowering -- " << std::endl; |
| 2228 os << AsRPO(graph); | 2228 os << AsRPO(graph); |
| 2229 } | 2229 } |
| 2230 | 2230 |
| 2231 // Schedule and compile to machine code. | 2231 // Schedule and compile to machine code. |
| 2232 int params = static_cast<int>( | 2232 int params = static_cast<int>( |
| 2233 module->GetFunctionSignature(index)->parameter_count()); | 2233 module->GetFunctionSignature(index)->parameter_count()); |
| 2234 CallDescriptor* incoming = Linkage::GetJSCallDescriptor( | 2234 CallDescriptor* incoming = Linkage::GetJSCallDescriptor( |
| 2235 &zone, false, params + 1, CallDescriptor::kNoFlags); | 2235 &zone, false, params + 1, CallDescriptor::kNoFlags); |
| 2236 // TODO(titzer): this is technically a WASM wrapper, not a wasm function. | 2236 Code::Flags flags = |
| 2237 Code::Flags flags = Code::ComputeFlags(Code::WASM_FUNCTION); | 2237 Code::ComputeWasmFlags(Code::WASM_FUNCTION, Code::JS_TO_WASM); |
| 2238 bool debugging = | 2238 bool debugging = |
| 2239 #if DEBUG | 2239 #if DEBUG |
| 2240 true; | 2240 true; |
| 2241 #else | 2241 #else |
| 2242 FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph; | 2242 FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph; |
| 2243 #endif | 2243 #endif |
| 2244 const char* func_name = "js-to-wasm"; | 2244 const char* func_name = "js-to-wasm"; |
| 2245 | 2245 |
| 2246 static unsigned id = 0; | 2246 static unsigned id = 0; |
| 2247 Vector<char> buffer; | 2247 Vector<char> buffer; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2306 | 2306 |
| 2307 if (FLAG_trace_turbo_graph) { // Simple textual RPO. | 2307 if (FLAG_trace_turbo_graph) { // Simple textual RPO. |
| 2308 OFStream os(stdout); | 2308 OFStream os(stdout); |
| 2309 os << "-- Graph after change lowering -- " << std::endl; | 2309 os << "-- Graph after change lowering -- " << std::endl; |
| 2310 os << AsRPO(graph); | 2310 os << AsRPO(graph); |
| 2311 } | 2311 } |
| 2312 | 2312 |
| 2313 // Schedule and compile to machine code. | 2313 // Schedule and compile to machine code. |
| 2314 CallDescriptor* incoming = | 2314 CallDescriptor* incoming = |
| 2315 wasm::ModuleEnv::GetWasmCallDescriptor(&zone, sig); | 2315 wasm::ModuleEnv::GetWasmCallDescriptor(&zone, sig); |
| 2316 // TODO(titzer): this is technically a WASM wrapper, not a wasm function. | 2316 Code::Flags flags = |
| 2317 Code::Flags flags = Code::ComputeFlags(Code::WASM_FUNCTION); | 2317 Code::ComputeWasmFlags(Code::WASM_FUNCTION, Code::WASM_TO_JS); |
| 2318 bool debugging = | 2318 bool debugging = |
| 2319 #if DEBUG | 2319 #if DEBUG |
| 2320 true; | 2320 true; |
| 2321 #else | 2321 #else |
| 2322 FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph; | 2322 FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph; |
| 2323 #endif | 2323 #endif |
| 2324 const char* func_name = "wasm-to-js"; | 2324 const char* func_name = "wasm-to-js"; |
| 2325 static unsigned id = 0; | 2325 static unsigned id = 0; |
| 2326 Vector<char> buffer; | 2326 Vector<char> buffer; |
| 2327 if (debugging) { | 2327 if (debugging) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2391 thrower.Failed(buffer.start(), result); | 2391 thrower.Failed(buffer.start(), result); |
| 2392 return Handle<Code>::null(); | 2392 return Handle<Code>::null(); |
| 2393 } | 2393 } |
| 2394 | 2394 |
| 2395 // Run the compiler pipeline to generate machine code. | 2395 // Run the compiler pipeline to generate machine code. |
| 2396 CallDescriptor* descriptor = | 2396 CallDescriptor* descriptor = |
| 2397 wasm::ModuleEnv::GetWasmCallDescriptor(&zone, function.sig); | 2397 wasm::ModuleEnv::GetWasmCallDescriptor(&zone, function.sig); |
| 2398 if (kPointerSize == 4) { | 2398 if (kPointerSize == 4) { |
| 2399 descriptor = module_env->GetI32WasmCallDescriptor(&zone, descriptor); | 2399 descriptor = module_env->GetI32WasmCallDescriptor(&zone, descriptor); |
| 2400 } | 2400 } |
| 2401 Code::Flags flags = Code::ComputeFlags(Code::WASM_FUNCTION); | 2401 Code::Flags flags = Code::ComputeWasmFlags(Code::WASM_FUNCTION); |
| 2402 // add flags here if a meaningful name is helpful for debugging. | 2402 // add flags here if a meaningful name is helpful for debugging. |
| 2403 bool debugging = | 2403 bool debugging = |
| 2404 #if DEBUG | 2404 #if DEBUG |
| 2405 true; | 2405 true; |
| 2406 #else | 2406 #else |
| 2407 FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph; | 2407 FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph; |
| 2408 #endif | 2408 #endif |
| 2409 const char* func_name = "wasm"; | 2409 const char* func_name = "wasm"; |
| 2410 Vector<char> buffer; | 2410 Vector<char> buffer; |
| 2411 if (debugging) { | 2411 if (debugging) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2427 module_env->module->GetName(function.name_offset)); | 2427 module_env->module->GetName(function.name_offset)); |
| 2428 } | 2428 } |
| 2429 | 2429 |
| 2430 return code; | 2430 return code; |
| 2431 } | 2431 } |
| 2432 | 2432 |
| 2433 | 2433 |
| 2434 } // namespace compiler | 2434 } // namespace compiler |
| 2435 } // namespace internal | 2435 } // namespace internal |
| 2436 } // namespace v8 | 2436 } // namespace v8 |
| OLD | NEW |