5 #ifndef V8_COMPILER_BACKEND_X64_UNWINDING_INFO_WRITER_X64_H_ 6 #define V8_COMPILER_BACKEND_X64_UNWINDING_INFO_WRITER_X64_H_ 8 #include "src/eh-frame.h" 14 class InstructionBlock;
16 class UnwindingInfoWriter {
18 explicit UnwindingInfoWriter(Zone* zone)
20 eh_frame_writer_(zone),
22 block_will_exit_(false),
23 block_initial_states_(zone) {
24 if (enabled()) eh_frame_writer_.Initialize();
27 void MaybeIncreaseBaseOffsetAt(
int pc_offset,
int base_delta) {
28 if (enabled() && !tracking_fp_) {
29 eh_frame_writer_.AdvanceLocation(pc_offset);
30 eh_frame_writer_.IncreaseBaseAddressOffset(base_delta);
34 void SetNumberOfInstructionBlocks(
int number) {
35 if (enabled()) block_initial_states_.resize(number);
38 void BeginInstructionBlock(
int pc_offset,
const InstructionBlock* block);
39 void EndInstructionBlock(
const InstructionBlock* block);
41 void MarkFrameConstructed(
int pc_base);
42 void MarkFrameDeconstructed(
int pc_base);
44 void MarkBlockWillExit() { block_will_exit_ =
true; }
46 void Finish(
int code_size) {
47 if (enabled()) eh_frame_writer_.Finish(code_size);
50 EhFrameWriter* eh_frame_writer() {
51 return enabled() ? &eh_frame_writer_ :
nullptr;
55 bool enabled()
const {
return FLAG_perf_prof_unwinding_info; }
57 class BlockInitialState :
public ZoneObject {
59 BlockInitialState(Register reg,
int offset,
bool tracking_fp)
60 : register_(reg), offset_(offset), tracking_fp_(tracking_fp) {}
68 EhFrameWriter eh_frame_writer_;
70 bool block_will_exit_;
72 ZoneVector<const BlockInitialState*> block_initial_states_;
79 #endif // V8_COMPILER_BACKEND_X64_UNWINDING_INFO_WRITER_X64_H_