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