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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
10 | 10 |
(...skipping 3114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3125 RecordFunctionCompilation( | 3125 RecordFunctionCompilation( |
3126 CodeEventListener::FUNCTION_TAG, isolate, code, "js-to-wasm", index, | 3126 CodeEventListener::FUNCTION_TAG, isolate, code, "js-to-wasm", index, |
3127 wasm::WasmName("export"), | 3127 wasm::WasmName("export"), |
3128 module->module->GetName(func->name_offset, func->name_length)); | 3128 module->module->GetName(func->name_offset, func->name_length)); |
3129 } | 3129 } |
3130 return code; | 3130 return code; |
3131 } | 3131 } |
3132 | 3132 |
3133 Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, Handle<JSReceiver> target, | 3133 Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, Handle<JSReceiver> target, |
3134 wasm::FunctionSig* sig, uint32_t index, | 3134 wasm::FunctionSig* sig, uint32_t index, |
3135 Handle<String> import_module, | 3135 Handle<String> module_name, |
3136 MaybeHandle<String> import_function) { | 3136 MaybeHandle<String> import_name) { |
3137 //---------------------------------------------------------------------------- | 3137 //---------------------------------------------------------------------------- |
3138 // Create the Graph | 3138 // Create the Graph |
3139 //---------------------------------------------------------------------------- | 3139 //---------------------------------------------------------------------------- |
3140 Zone zone(isolate->allocator()); | 3140 Zone zone(isolate->allocator()); |
3141 Graph graph(&zone); | 3141 Graph graph(&zone); |
3142 CommonOperatorBuilder common(&zone); | 3142 CommonOperatorBuilder common(&zone); |
3143 MachineOperatorBuilder machine(&zone); | 3143 MachineOperatorBuilder machine(&zone); |
3144 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); | 3144 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); |
3145 | 3145 |
3146 Node* control = nullptr; | 3146 Node* control = nullptr; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3189 code->Disassemble(buffer.start(), os); | 3189 code->Disassemble(buffer.start(), os); |
3190 } | 3190 } |
3191 #endif | 3191 #endif |
3192 if (debugging) { | 3192 if (debugging) { |
3193 buffer.Dispose(); | 3193 buffer.Dispose(); |
3194 } | 3194 } |
3195 } | 3195 } |
3196 if (isolate->logger()->is_logging_code_events() || isolate->is_profiling()) { | 3196 if (isolate->logger()->is_logging_code_events() || isolate->is_profiling()) { |
3197 const char* function_name = nullptr; | 3197 const char* function_name = nullptr; |
3198 int function_name_size = 0; | 3198 int function_name_size = 0; |
3199 if (!import_function.is_null()) { | 3199 if (!import_name.is_null()) { |
3200 Handle<String> handle = import_function.ToHandleChecked(); | 3200 Handle<String> handle = import_name.ToHandleChecked(); |
3201 function_name = handle->ToCString().get(); | 3201 function_name = handle->ToCString().get(); |
3202 function_name_size = handle->length(); | 3202 function_name_size = handle->length(); |
3203 } | 3203 } |
3204 RecordFunctionCompilation( | 3204 RecordFunctionCompilation( |
3205 CodeEventListener::FUNCTION_TAG, isolate, code, "wasm-to-js", index, | 3205 CodeEventListener::FUNCTION_TAG, isolate, code, "wasm-to-js", index, |
3206 {import_module->ToCString().get(), import_module->length()}, | 3206 {module_name->ToCString().get(), module_name->length()}, |
3207 {function_name, function_name_size}); | 3207 {function_name, function_name_size}); |
3208 } | 3208 } |
3209 | 3209 |
3210 return code; | 3210 return code; |
3211 } | 3211 } |
3212 | 3212 |
3213 SourcePositionTable* WasmCompilationUnit::BuildGraphForWasmFunction( | 3213 SourcePositionTable* WasmCompilationUnit::BuildGraphForWasmFunction( |
3214 double* decode_ms) { | 3214 double* decode_ms) { |
3215 base::ElapsedTimer decode_timer; | 3215 base::ElapsedTimer decode_timer; |
3216 if (FLAG_trace_wasm_decode_time) { | 3216 if (FLAG_trace_wasm_decode_time) { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3383 function_->code_start_offset), | 3383 function_->code_start_offset), |
3384 compile_ms); | 3384 compile_ms); |
3385 } | 3385 } |
3386 | 3386 |
3387 return code; | 3387 return code; |
3388 } | 3388 } |
3389 | 3389 |
3390 } // namespace compiler | 3390 } // namespace compiler |
3391 } // namespace internal | 3391 } // namespace internal |
3392 } // namespace v8 | 3392 } // namespace v8 |
OLD | NEW |