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 4002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4013 } | 4013 } |
4014 | 4014 |
4015 if (FLAG_trace_wasm_decode_time) { | 4015 if (FLAG_trace_wasm_decode_time) { |
4016 double compile_ms = compile_timer.Elapsed().InMillisecondsF(); | 4016 double compile_ms = compile_timer.Elapsed().InMillisecondsF(); |
4017 PrintF("wasm-code-generation ok: %d bytes, %0.3f ms code generation\n", | 4017 PrintF("wasm-code-generation ok: %d bytes, %0.3f ms code generation\n", |
4018 static_cast<int>(function_->code_end_offset - | 4018 static_cast<int>(function_->code_end_offset - |
4019 function_->code_start_offset), | 4019 function_->code_start_offset), |
4020 compile_ms); | 4020 compile_ms); |
4021 } | 4021 } |
4022 | 4022 |
4023 Handle<FixedArray> protected_instructions = PackProtectedInstructions(); | |
4024 code->set_protected_instructions(*protected_instructions); | |
4025 | |
4026 return code; | 4023 return code; |
4027 } | 4024 } |
4028 | 4025 |
4029 Handle<FixedArray> WasmCompilationUnit::PackProtectedInstructions() const { | |
4030 const int num_instructions = static_cast<int>(protected_instructions_.size()); | |
4031 Handle<FixedArray> fn_protected = isolate_->factory()->NewFixedArray( | |
4032 num_instructions * Code::kTrapDataSize, TENURED); | |
4033 for (unsigned i = 0; i < protected_instructions_.size(); ++i) { | |
4034 const trap_handler::ProtectedInstructionData& instruction = | |
4035 protected_instructions_[i]; | |
4036 fn_protected->set(Code::kTrapDataSize * i + Code::kTrapCodeOffset, | |
4037 Smi::FromInt(instruction.instr_offset)); | |
4038 fn_protected->set(Code::kTrapDataSize * i + Code::kTrapLandingOffset, | |
4039 Smi::FromInt(instruction.landing_offset)); | |
4040 } | |
4041 return fn_protected; | |
4042 } | |
4043 | |
4044 } // namespace compiler | 4026 } // namespace compiler |
4045 } // namespace internal | 4027 } // namespace internal |
4046 } // namespace v8 | 4028 } // namespace v8 |
OLD | NEW |