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 #ifndef V8_COMPILER_X64_UNWINDING_INFO_WRITER_H_ |
| 6 #define V8_COMPILER_X64_UNWINDING_INFO_WRITER_H_ |
| 7 |
| 8 #include <unordered_map> |
| 9 #include "src/eh-frame.h" |
| 10 |
| 11 namespace v8 { |
| 12 namespace internal { |
| 13 namespace compiler { |
| 14 |
| 15 class InstructionBlock; |
| 16 |
| 17 class UnwindingInfoWriter { |
| 18 public: |
| 19 UnwindingInfoWriter() : tracking_fp_(false), block_will_exit_(false) {} |
| 20 |
| 21 void MaybeIncreaseFrameBaseOffsetAt(int pc_offset, int base_delta) { |
| 22 if (!tracking_fp_) { |
| 23 eh_frame_writer_.AdvanceLocation(pc_offset); |
| 24 eh_frame_writer_.IncreaseBaseAddressOffset(base_delta); |
| 25 } |
| 26 } |
| 27 |
| 28 void BeginInstructionBlock(int pc_offset, const InstructionBlock* block); |
| 29 void EndInstructionBlock(const InstructionBlock* block); |
| 30 |
| 31 void MarkFrameConstructed(int pc_base); |
| 32 void MarkFrameDeconstructed(int pc_base); |
| 33 |
| 34 void MarkBlockWillExit() { block_will_exit_ = true; } |
| 35 |
| 36 void Finish(int code_size) { eh_frame_writer_.Finish(code_size); } |
| 37 |
| 38 EhFrameWriter* eh_frame_writer() { return &eh_frame_writer_; } |
| 39 |
| 40 private: |
| 41 EhFrameWriter eh_frame_writer_; |
| 42 |
| 43 struct BlockInitialState { |
| 44 Register register_; |
| 45 int offset_; |
| 46 bool tracking_fp_; |
| 47 }; |
| 48 |
| 49 bool tracking_fp_; |
| 50 bool block_will_exit_; |
| 51 |
| 52 std::unordered_map<int, BlockInitialState> block_initial_states_; |
| 53 static_assert(kIntSize >= kInt32Size, "int too small to encode a RpoNumber"); |
| 54 }; |
| 55 |
| 56 } // namespace compiler |
| 57 } // namespace internal |
| 58 } // namespace v8 |
| 59 |
| 60 #endif |
OLD | NEW |