OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "src/unwinding-info.h" | |
6 #include "src/objects-inl.h" | |
7 #include "src/objects.h" | |
8 | |
9 namespace v8 { | |
10 namespace internal { | |
11 | |
12 static const int DW_EH_PE_pcrel = 0x10; | |
13 static const int DW_EH_PE_datarel = 0x30; | |
14 static const int DW_EH_PE_udata4 = 0x03; | |
15 static const int DW_EH_PE_sdata4 = 0x0b; | |
16 | |
17 static const int kSizeOfCIE = 0; | |
18 | |
19 EhFrameHdr::EhFrameHdr(Code* code) { | |
rmcilroy
2016/06/21 13:47:44
Can we have a test (cctest or unittest) for this c
Stefano Sanfilippo
2016/06/23 15:23:44
Done. I wrote a cctest because we need to pass thr
| |
20 int code_size = code->is_crankshafted() ? code->safepoint_table_offset() | |
21 : code->instruction_size(); | |
22 version_ = 1; | |
23 eh_frame_ptr_encoding_ = DW_EH_PE_sdata4 | DW_EH_PE_pcrel; | |
24 lut_size_encoding_ = DW_EH_PE_udata4; | |
25 lut_entries_encoding_ = DW_EH_PE_sdata4 | DW_EH_PE_datarel; | |
26 | |
27 // .eh_frame pointer and LUT | |
28 if (code->has_unwinding_info()) { | |
29 DCHECK_GE(code->unwinding_info_size(), EhFrameHdr::kRecordSize); | |
30 int eh_frame_size = code->unwinding_info_size() - EhFrameHdr::kRecordSize; | |
31 | |
32 offset_to_eh_frame_ = -(eh_frame_size + 4); | |
33 lut_entries_number_ = 1; | |
34 offset_to_procedure_ = -(RoundUp(code_size, 8) + eh_frame_size); | |
35 offset_to_fde_ = -(eh_frame_size - static_cast<int>(kSizeOfCIE)); | |
36 } else { | |
37 // Create a dummy table | |
38 offset_to_eh_frame_ = 0; | |
39 lut_entries_number_ = 0; | |
40 offset_to_procedure_ = 0; | |
41 offset_to_fde_ = 0; | |
42 } | |
43 } | |
44 | |
45 void PatchProcedureBoundariesInEhFrame(Code* code) { | |
rmcilroy
2016/06/21 13:47:44
As mentioned above, please remove this from this C
Stefano Sanfilippo
2016/06/23 15:23:44
Removed. The issue was that in some circumstances
| |
46 int boundaries_base_offset = kSizeOfCIE + 8; | |
47 int32_t code_size = code->is_crankshafted() ? code->safepoint_table_offset() | |
48 : code->instruction_size(); | |
49 int32_t offset_to_text = -(RoundUp(code_size, 8) + boundaries_base_offset); | |
50 | |
51 MemMove(code->unwinding_info_start() + boundaries_base_offset, | |
52 &offset_to_text, sizeof(offset_to_text)); | |
53 MemMove(code->unwinding_info_start() + boundaries_base_offset + | |
54 sizeof(offset_to_text), | |
55 &code_size, sizeof(code_size)); | |
56 } | |
57 | |
58 } // namespace internal | |
59 } // namespace v8 | |
OLD | NEW |