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 3993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4004 OFStream os(stdout); | 4004 OFStream os(stdout); |
4005 PrintWasmText(module_env_->module_env.module, module_env_->wire_bytes, | 4005 PrintWasmText(module_env_->module_env.module, module_env_->wire_bytes, |
4006 function_->func_index, os, nullptr); | 4006 function_->func_index, os, nullptr); |
4007 } | 4007 } |
4008 if (FLAG_trace_wasm_decode_time) { | 4008 if (FLAG_trace_wasm_decode_time) { |
4009 *decode_ms = decode_timer.Elapsed().InMillisecondsF(); | 4009 *decode_ms = decode_timer.Elapsed().InMillisecondsF(); |
4010 } | 4010 } |
4011 return source_position_table; | 4011 return source_position_table; |
4012 } | 4012 } |
4013 | 4013 |
4014 char* WasmCompilationUnit::GetTaggedFunctionName( | |
4015 const wasm::WasmFunction* function) { | |
4016 snprintf(function_name_, sizeof(function_name_), "wasm#%d", | |
4017 function->func_index); | |
4018 return function_name_; | |
4019 } | |
4020 | |
4021 WasmCompilationUnit::WasmCompilationUnit(wasm::ErrorThrower* thrower, | 4014 WasmCompilationUnit::WasmCompilationUnit(wasm::ErrorThrower* thrower, |
4022 Isolate* isolate, | 4015 Isolate* isolate, |
4023 wasm::ModuleBytesEnv* module_env, | 4016 wasm::ModuleBytesEnv* module_env, |
4024 const wasm::WasmFunction* function, | 4017 const wasm::WasmFunction* function, |
4025 uint32_t index) | 4018 uint32_t index) |
4026 : thrower_(thrower), | 4019 : thrower_(thrower), |
4027 isolate_(isolate), | 4020 isolate_(isolate), |
4028 module_env_(module_env), | 4021 module_env_(module_env), |
4029 function_(&module_env->module_env.module->functions[index]), | 4022 function_(&module_env->module_env.module->functions[index]), |
4030 graph_zone_(new Zone(isolate->allocator(), ZONE_NAME)), | 4023 graph_zone_(new Zone(isolate->allocator(), ZONE_NAME)), |
4031 jsgraph_(new (graph_zone()) JSGraph( | 4024 jsgraph_(new (graph_zone()) JSGraph( |
4032 isolate, new (graph_zone()) Graph(graph_zone()), | 4025 isolate, new (graph_zone()) Graph(graph_zone()), |
4033 new (graph_zone()) CommonOperatorBuilder(graph_zone()), nullptr, | 4026 new (graph_zone()) CommonOperatorBuilder(graph_zone()), nullptr, |
4034 nullptr, new (graph_zone()) MachineOperatorBuilder( | 4027 nullptr, new (graph_zone()) MachineOperatorBuilder( |
4035 graph_zone(), MachineType::PointerRepresentation(), | 4028 graph_zone(), MachineType::PointerRepresentation(), |
4036 InstructionSelector::SupportedMachineOperatorFlags(), | 4029 InstructionSelector::SupportedMachineOperatorFlags(), |
4037 InstructionSelector::AlignmentRequirements()))), | 4030 InstructionSelector::AlignmentRequirements()))), |
4038 compilation_zone_(isolate->allocator(), ZONE_NAME), | 4031 compilation_zone_(isolate->allocator(), ZONE_NAME), |
4039 info_(function->name_length != 0 | 4032 info_(function->name_length != 0 |
4040 ? module_env->wire_bytes.GetNameOrNull(function) | 4033 ? module_env->wire_bytes.GetNameOrNull(function) |
4041 : CStrVector(GetTaggedFunctionName(function)), | 4034 : ArrayVector("wasm"), |
4042 isolate, &compilation_zone_, | 4035 isolate, &compilation_zone_, |
4043 Code::ComputeFlags(Code::WASM_FUNCTION)), | 4036 Code::ComputeFlags(Code::WASM_FUNCTION)), |
4044 job_(), | 4037 job_(), |
4045 index_(index), | 4038 index_(index), |
4046 ok_(true), | 4039 ok_(true), |
4047 protected_instructions_(&compilation_zone_) { | 4040 protected_instructions_(&compilation_zone_) { |
4048 // Create and cache this node in the main thread. | 4041 // Create and cache this node in the main thread. |
4049 jsgraph_->CEntryStubConstant(1); | 4042 jsgraph_->CEntryStubConstant(1); |
4050 } | 4043 } |
4051 | 4044 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4145 function_->code_start_offset), | 4138 function_->code_start_offset), |
4146 compile_ms); | 4139 compile_ms); |
4147 } | 4140 } |
4148 | 4141 |
4149 return code; | 4142 return code; |
4150 } | 4143 } |
4151 | 4144 |
4152 } // namespace compiler | 4145 } // namespace compiler |
4153 } // namespace internal | 4146 } // namespace internal |
4154 } // namespace v8 | 4147 } // namespace v8 |
OLD | NEW |