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 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3144 RecordFunctionCompilation( | 3144 RecordFunctionCompilation( |
3145 CodeEventListener::FUNCTION_TAG, isolate, code, "js-to-wasm", index, | 3145 CodeEventListener::FUNCTION_TAG, isolate, code, "js-to-wasm", index, |
3146 wasm::WasmName("export"), | 3146 wasm::WasmName("export"), |
3147 module->module->GetName(func->name_offset, func->name_length)); | 3147 module->module->GetName(func->name_offset, func->name_length)); |
3148 } | 3148 } |
3149 return code; | 3149 return code; |
3150 } | 3150 } |
3151 | 3151 |
3152 Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, Handle<JSReceiver> target, | 3152 Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, Handle<JSReceiver> target, |
3153 wasm::FunctionSig* sig, uint32_t index, | 3153 wasm::FunctionSig* sig, uint32_t index, |
3154 Handle<String> module_name, | 3154 Handle<String> import_module, |
3155 MaybeHandle<String> import_name) { | 3155 MaybeHandle<String> import_function) { |
3156 //---------------------------------------------------------------------------- | 3156 //---------------------------------------------------------------------------- |
3157 // Create the Graph | 3157 // Create the Graph |
3158 //---------------------------------------------------------------------------- | 3158 //---------------------------------------------------------------------------- |
3159 Zone zone(isolate->allocator()); | 3159 Zone zone(isolate->allocator()); |
3160 Graph graph(&zone); | 3160 Graph graph(&zone); |
3161 CommonOperatorBuilder common(&zone); | 3161 CommonOperatorBuilder common(&zone); |
3162 MachineOperatorBuilder machine(&zone); | 3162 MachineOperatorBuilder machine(&zone); |
3163 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); | 3163 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); |
3164 | 3164 |
3165 Node* control = nullptr; | 3165 Node* control = nullptr; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3208 code->Disassemble(buffer.start(), os); | 3208 code->Disassemble(buffer.start(), os); |
3209 } | 3209 } |
3210 #endif | 3210 #endif |
3211 if (debugging) { | 3211 if (debugging) { |
3212 buffer.Dispose(); | 3212 buffer.Dispose(); |
3213 } | 3213 } |
3214 } | 3214 } |
3215 if (isolate->logger()->is_logging_code_events() || isolate->is_profiling()) { | 3215 if (isolate->logger()->is_logging_code_events() || isolate->is_profiling()) { |
3216 const char* function_name = nullptr; | 3216 const char* function_name = nullptr; |
3217 int function_name_size = 0; | 3217 int function_name_size = 0; |
3218 if (!import_name.is_null()) { | 3218 if (!import_function.is_null()) { |
3219 Handle<String> handle = import_name.ToHandleChecked(); | 3219 Handle<String> handle = import_function.ToHandleChecked(); |
3220 function_name = handle->ToCString().get(); | 3220 function_name = handle->ToCString().get(); |
3221 function_name_size = handle->length(); | 3221 function_name_size = handle->length(); |
3222 } | 3222 } |
3223 RecordFunctionCompilation( | 3223 RecordFunctionCompilation( |
3224 CodeEventListener::FUNCTION_TAG, isolate, code, "wasm-to-js", index, | 3224 CodeEventListener::FUNCTION_TAG, isolate, code, "wasm-to-js", index, |
3225 {module_name->ToCString().get(), module_name->length()}, | 3225 {import_module->ToCString().get(), import_module->length()}, |
3226 {function_name, function_name_size}); | 3226 {function_name, function_name_size}); |
3227 } | 3227 } |
3228 | 3228 |
3229 return code; | 3229 return code; |
3230 } | 3230 } |
3231 | 3231 |
3232 SourcePositionTable* WasmCompilationUnit::BuildGraphForWasmFunction( | 3232 SourcePositionTable* WasmCompilationUnit::BuildGraphForWasmFunction( |
3233 double* decode_ms) { | 3233 double* decode_ms) { |
3234 base::ElapsedTimer decode_timer; | 3234 base::ElapsedTimer decode_timer; |
3235 if (FLAG_trace_wasm_decode_time) { | 3235 if (FLAG_trace_wasm_decode_time) { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3402 function_->code_start_offset), | 3402 function_->code_start_offset), |
3403 compile_ms); | 3403 compile_ms); |
3404 } | 3404 } |
3405 | 3405 |
3406 return code; | 3406 return code; |
3407 } | 3407 } |
3408 | 3408 |
3409 } // namespace compiler | 3409 } // namespace compiler |
3410 } // namespace internal | 3410 } // namespace internal |
3411 } // namespace v8 | 3411 } // namespace v8 |
OLD | NEW |