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 3075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3086 *script_str, 0, 0)); | 3086 *script_str, 0, 0)); |
3087 } | 3087 } |
3088 | 3088 |
3089 Handle<Code> CompileJSToWasmWrapper(Isolate* isolate, wasm::ModuleEnv* module, | 3089 Handle<Code> CompileJSToWasmWrapper(Isolate* isolate, wasm::ModuleEnv* module, |
3090 Handle<Code> wasm_code, uint32_t index) { | 3090 Handle<Code> wasm_code, uint32_t index) { |
3091 const wasm::WasmFunction* func = &module->module->functions[index]; | 3091 const wasm::WasmFunction* func = &module->module->functions[index]; |
3092 | 3092 |
3093 //---------------------------------------------------------------------------- | 3093 //---------------------------------------------------------------------------- |
3094 // Create the Graph | 3094 // Create the Graph |
3095 //---------------------------------------------------------------------------- | 3095 //---------------------------------------------------------------------------- |
3096 Zone zone(isolate->allocator()); | 3096 Zone zone(isolate->allocator(), ZONE_NAME); |
3097 Graph graph(&zone); | 3097 Graph graph(&zone); |
3098 CommonOperatorBuilder common(&zone); | 3098 CommonOperatorBuilder common(&zone); |
3099 MachineOperatorBuilder machine(&zone); | 3099 MachineOperatorBuilder machine(&zone); |
3100 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); | 3100 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); |
3101 | 3101 |
3102 Node* control = nullptr; | 3102 Node* control = nullptr; |
3103 Node* effect = nullptr; | 3103 Node* effect = nullptr; |
3104 | 3104 |
3105 WasmGraphBuilder builder(&zone, &jsgraph, func->sig); | 3105 WasmGraphBuilder builder(&zone, &jsgraph, func->sig); |
3106 builder.set_control_ptr(&control); | 3106 builder.set_control_ptr(&control); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3160 return code; | 3160 return code; |
3161 } | 3161 } |
3162 | 3162 |
3163 Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, Handle<JSReceiver> target, | 3163 Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, Handle<JSReceiver> target, |
3164 wasm::FunctionSig* sig, uint32_t index, | 3164 wasm::FunctionSig* sig, uint32_t index, |
3165 Handle<String> module_name, | 3165 Handle<String> module_name, |
3166 MaybeHandle<String> import_name) { | 3166 MaybeHandle<String> import_name) { |
3167 //---------------------------------------------------------------------------- | 3167 //---------------------------------------------------------------------------- |
3168 // Create the Graph | 3168 // Create the Graph |
3169 //---------------------------------------------------------------------------- | 3169 //---------------------------------------------------------------------------- |
3170 Zone zone(isolate->allocator()); | 3170 Zone zone(isolate->allocator(), ZONE_NAME); |
3171 Graph graph(&zone); | 3171 Graph graph(&zone); |
3172 CommonOperatorBuilder common(&zone); | 3172 CommonOperatorBuilder common(&zone); |
3173 MachineOperatorBuilder machine(&zone); | 3173 MachineOperatorBuilder machine(&zone); |
3174 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); | 3174 JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine); |
3175 | 3175 |
3176 Node* control = nullptr; | 3176 Node* control = nullptr; |
3177 Node* effect = nullptr; | 3177 Node* effect = nullptr; |
3178 | 3178 |
3179 WasmGraphBuilder builder(&zone, &jsgraph, sig); | 3179 WasmGraphBuilder builder(&zone, &jsgraph, sig); |
3180 builder.set_control_ptr(&control); | 3180 builder.set_control_ptr(&control); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3289 | 3289 |
3290 WasmCompilationUnit::WasmCompilationUnit(wasm::ErrorThrower* thrower, | 3290 WasmCompilationUnit::WasmCompilationUnit(wasm::ErrorThrower* thrower, |
3291 Isolate* isolate, | 3291 Isolate* isolate, |
3292 wasm::ModuleEnv* module_env, | 3292 wasm::ModuleEnv* module_env, |
3293 const wasm::WasmFunction* function, | 3293 const wasm::WasmFunction* function, |
3294 uint32_t index) | 3294 uint32_t index) |
3295 : thrower_(thrower), | 3295 : thrower_(thrower), |
3296 isolate_(isolate), | 3296 isolate_(isolate), |
3297 module_env_(module_env), | 3297 module_env_(module_env), |
3298 function_(function), | 3298 function_(function), |
3299 graph_zone_(new Zone(isolate->allocator())), | 3299 graph_zone_(new Zone(isolate->allocator(), ZONE_NAME)), |
3300 jsgraph_(new (graph_zone()) JSGraph( | 3300 jsgraph_(new (graph_zone()) JSGraph( |
3301 isolate, new (graph_zone()) Graph(graph_zone()), | 3301 isolate, new (graph_zone()) Graph(graph_zone()), |
3302 new (graph_zone()) CommonOperatorBuilder(graph_zone()), nullptr, | 3302 new (graph_zone()) CommonOperatorBuilder(graph_zone()), nullptr, |
3303 nullptr, new (graph_zone()) MachineOperatorBuilder( | 3303 nullptr, new (graph_zone()) MachineOperatorBuilder( |
3304 graph_zone(), MachineType::PointerRepresentation(), | 3304 graph_zone(), MachineType::PointerRepresentation(), |
3305 InstructionSelector::SupportedMachineOperatorFlags(), | 3305 InstructionSelector::SupportedMachineOperatorFlags(), |
3306 InstructionSelector::AlignmentRequirements()))), | 3306 InstructionSelector::AlignmentRequirements()))), |
3307 compilation_zone_(isolate->allocator()), | 3307 compilation_zone_(isolate->allocator(), ZONE_NAME), |
3308 info_(function->name_length != 0 | 3308 info_(function->name_length != 0 |
3309 ? module_env->module->GetNameOrNull(function->name_offset, | 3309 ? module_env->module->GetNameOrNull(function->name_offset, |
3310 function->name_length) | 3310 function->name_length) |
3311 : ArrayVector("wasm"), | 3311 : ArrayVector("wasm"), |
3312 isolate, &compilation_zone_, | 3312 isolate, &compilation_zone_, |
3313 Code::ComputeFlags(Code::WASM_FUNCTION)), | 3313 Code::ComputeFlags(Code::WASM_FUNCTION)), |
3314 job_(), | 3314 job_(), |
3315 index_(index), | 3315 index_(index), |
3316 ok_(true) { | 3316 ok_(true) { |
3317 // Create and cache this node in the main thread. | 3317 // Create and cache this node in the main thread. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3413 function_->code_start_offset), | 3413 function_->code_start_offset), |
3414 compile_ms); | 3414 compile_ms); |
3415 } | 3415 } |
3416 | 3416 |
3417 return code; | 3417 return code; |
3418 } | 3418 } |
3419 | 3419 |
3420 } // namespace compiler | 3420 } // namespace compiler |
3421 } // namespace internal | 3421 } // namespace internal |
3422 } // namespace v8 | 3422 } // namespace v8 |
OLD | NEW |