| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 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 #ifndef V8_EH_FRAME_H_ | 5 #ifndef V8_EH_FRAME_H_ |
| 6 #define V8_EH_FRAME_H_ | 6 #define V8_EH_FRAME_H_ |
| 7 | 7 |
| 8 #include "src/base/compiler-specific.h" |
| 9 #include "src/globals.h" |
| 8 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
| 9 | 11 |
| 10 namespace v8 { | 12 namespace v8 { |
| 11 namespace internal { | 13 namespace internal { |
| 12 | 14 |
| 13 class EhFrameConstants final : public AllStatic { | 15 class V8_EXPORT_PRIVATE EhFrameConstants final |
| 16 : public NON_EXPORTED_BASE(AllStatic) { |
| 14 public: | 17 public: |
| 15 enum class DwarfOpcodes : byte { | 18 enum class DwarfOpcodes : byte { |
| 16 kNop = 0x00, | 19 kNop = 0x00, |
| 17 kAdvanceLoc1 = 0x02, | 20 kAdvanceLoc1 = 0x02, |
| 18 kAdvanceLoc2 = 0x03, | 21 kAdvanceLoc2 = 0x03, |
| 19 kAdvanceLoc4 = 0x04, | 22 kAdvanceLoc4 = 0x04, |
| 20 kSameValue = 0x08, | 23 kSameValue = 0x08, |
| 21 kDefCfa = 0x0c, | 24 kDefCfa = 0x0c, |
| 22 kDefCfaRegister = 0x0d, | 25 kDefCfaRegister = 0x0d, |
| 23 kDefCfaOffset = 0x0e, | 26 kDefCfaOffset = 0x0e, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 54 static const int kCodeAlignmentFactor; | 57 static const int kCodeAlignmentFactor; |
| 55 static const int kDataAlignmentFactor; | 58 static const int kDataAlignmentFactor; |
| 56 | 59 |
| 57 static const int kFdeVersionSize = 1; | 60 static const int kFdeVersionSize = 1; |
| 58 static const int kFdeEncodingSpecifiersSize = 3; | 61 static const int kFdeEncodingSpecifiersSize = 3; |
| 59 | 62 |
| 60 static const int kEhFrameHdrVersion = 1; | 63 static const int kEhFrameHdrVersion = 1; |
| 61 static const int kEhFrameHdrSize = 20; | 64 static const int kEhFrameHdrSize = 20; |
| 62 }; | 65 }; |
| 63 | 66 |
| 64 class EhFrameWriter { | 67 class V8_EXPORT_PRIVATE EhFrameWriter { |
| 65 public: | 68 public: |
| 66 explicit EhFrameWriter(Zone* zone); | 69 explicit EhFrameWriter(Zone* zone); |
| 67 | 70 |
| 68 // The empty frame is a hack to trigger fp-based unwinding in Linux perf | 71 // The empty frame is a hack to trigger fp-based unwinding in Linux perf |
| 69 // compiled with libunwind support when processing DWARF-based call graphs. | 72 // compiled with libunwind support when processing DWARF-based call graphs. |
| 70 // | 73 // |
| 71 // It is effectively a valid eh_frame_hdr with an empty look up table. | 74 // It is effectively a valid eh_frame_hdr with an empty look up table. |
| 72 // | 75 // |
| 73 static void WriteEmptyEhFrame(std::ostream& stream); // NOLINT | 76 static void WriteEmptyEhFrame(std::ostream& stream); // NOLINT |
| 74 | 77 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 int cie_size_; | 192 int cie_size_; |
| 190 int last_pc_offset_; | 193 int last_pc_offset_; |
| 191 InternalState writer_state_; | 194 InternalState writer_state_; |
| 192 Register base_register_; | 195 Register base_register_; |
| 193 int base_offset_; | 196 int base_offset_; |
| 194 ZoneVector<byte> eh_frame_buffer_; | 197 ZoneVector<byte> eh_frame_buffer_; |
| 195 | 198 |
| 196 DISALLOW_COPY_AND_ASSIGN(EhFrameWriter); | 199 DISALLOW_COPY_AND_ASSIGN(EhFrameWriter); |
| 197 }; | 200 }; |
| 198 | 201 |
| 199 class EhFrameIterator { | 202 class V8_EXPORT_PRIVATE EhFrameIterator { |
| 200 public: | 203 public: |
| 201 EhFrameIterator(const byte* start, const byte* end) | 204 EhFrameIterator(const byte* start, const byte* end) |
| 202 : start_(start), next_(start), end_(end) { | 205 : start_(start), next_(start), end_(end) { |
| 203 DCHECK_LE(start, end); | 206 DCHECK_LE(start, end); |
| 204 } | 207 } |
| 205 | 208 |
| 206 void SkipCie() { | 209 void SkipCie() { |
| 207 DCHECK_EQ(next_, start_); | 210 DCHECK_EQ(next_, start_); |
| 208 next_ += ReadUnalignedUInt32(next_) + kInt32Size; | 211 next_ += ReadUnalignedUInt32(next_) + kInt32Size; |
| 209 } | 212 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 291 |
| 289 DISALLOW_COPY_AND_ASSIGN(EhFrameDisassembler); | 292 DISALLOW_COPY_AND_ASSIGN(EhFrameDisassembler); |
| 290 }; | 293 }; |
| 291 | 294 |
| 292 #endif | 295 #endif |
| 293 | 296 |
| 294 } // namespace internal | 297 } // namespace internal |
| 295 } // namespace v8 | 298 } // namespace v8 |
| 296 | 299 |
| 297 #endif | 300 #endif |
| OLD | NEW |