| 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 3004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3015 | 3015 |
| 3016 RecordFunctionCompilation( | 3016 RecordFunctionCompilation( |
| 3017 CodeEventListener::FUNCTION_TAG, &info, "js-to-wasm", index, | 3017 CodeEventListener::FUNCTION_TAG, &info, "js-to-wasm", index, |
| 3018 module->module->GetName(func->name_offset, func->name_length)); | 3018 module->module->GetName(func->name_offset, func->name_length)); |
| 3019 // Set the JSFunction's machine code. | 3019 // Set the JSFunction's machine code. |
| 3020 function->set_code(*code); | 3020 function->set_code(*code); |
| 3021 } | 3021 } |
| 3022 return function; | 3022 return function; |
| 3023 } | 3023 } |
| 3024 | 3024 |
| 3025 Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module, | 3025 Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, |
| 3026 Handle<JSFunction> function, | 3026 Handle<JSFunction> function, |
| 3027 wasm::FunctionSig* sig, | 3027 wasm::FunctionSig* sig, |
| 3028 wasm::WasmName module_name, | 3028 wasm::WasmName module_name, |
| 3029 wasm::WasmName function_name) { | 3029 wasm::WasmName function_name) { |
| 3030 //---------------------------------------------------------------------------- | 3030 //---------------------------------------------------------------------------- |
| 3031 // Create the Graph | 3031 // Create the Graph |
| 3032 //---------------------------------------------------------------------------- | 3032 //---------------------------------------------------------------------------- |
| 3033 Zone zone(isolate->allocator()); | 3033 Zone zone(isolate->allocator()); |
| 3034 Graph graph(&zone); | 3034 Graph graph(&zone); |
| 3035 CommonOperatorBuilder common(&zone); | 3035 CommonOperatorBuilder common(&zone); |
| 3036 MachineOperatorBuilder machine(&zone); | 3036 MachineOperatorBuilder machine(&zone); |
| 3037 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); | 3037 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); |
| 3038 | 3038 |
| 3039 Node* control = nullptr; | 3039 Node* control = nullptr; |
| 3040 Node* effect = nullptr; | 3040 Node* effect = nullptr; |
| 3041 | 3041 |
| 3042 WasmGraphBuilder builder(&zone, &jsgraph, sig); | 3042 WasmGraphBuilder builder(&zone, &jsgraph, sig); |
| 3043 builder.set_control_ptr(&control); | 3043 builder.set_control_ptr(&control); |
| 3044 builder.set_effect_ptr(&effect); | 3044 builder.set_effect_ptr(&effect); |
| 3045 builder.set_module(module); | |
| 3046 builder.BuildWasmToJSWrapper(function, sig); | 3045 builder.BuildWasmToJSWrapper(function, sig); |
| 3047 | 3046 |
| 3048 Handle<Code> code = Handle<Code>::null(); | 3047 Handle<Code> code = Handle<Code>::null(); |
| 3049 { | 3048 { |
| 3050 if (FLAG_trace_turbo_graph) { // Simple textual RPO. | 3049 if (FLAG_trace_turbo_graph) { // Simple textual RPO. |
| 3051 OFStream os(stdout); | 3050 OFStream os(stdout); |
| 3052 os << "-- Graph after change lowering -- " << std::endl; | 3051 os << "-- Graph after change lowering -- " << std::endl; |
| 3053 os << AsRPO(graph); | 3052 os << AsRPO(graph); |
| 3054 } | 3053 } |
| 3055 | 3054 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3265 function_->code_start_offset), | 3264 function_->code_start_offset), |
| 3266 compile_ms); | 3265 compile_ms); |
| 3267 } | 3266 } |
| 3268 | 3267 |
| 3269 return code; | 3268 return code; |
| 3270 } | 3269 } |
| 3271 | 3270 |
| 3272 } // namespace compiler | 3271 } // namespace compiler |
| 3273 } // namespace internal | 3272 } // namespace internal |
| 3274 } // namespace v8 | 3273 } // namespace v8 |
| OLD | NEW |