LCOV - code coverage report
Current view: top level - src/compiler/x64 - unwinding-info-writer-x64.h (source / functions) Hit Total Coverage
Test: app.info Lines: 13 14 92.9 %
Date: 2017-04-26 Functions: 2 2 100.0 %

          Line data    Source code
       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 "src/eh-frame.h"
       9             : 
      10             : namespace v8 {
      11             : namespace internal {
      12             : namespace compiler {
      13             : 
      14             : class InstructionBlock;
      15             : 
      16             : class UnwindingInfoWriter {
      17             :  public:
      18      912390 :   explicit UnwindingInfoWriter(Zone* zone)
      19             :       : zone_(zone),
      20             :         eh_frame_writer_(zone),
      21             :         tracking_fp_(false),
      22             :         block_will_exit_(false),
      23      912390 :         block_initial_states_(zone) {
      24      912390 :     if (enabled()) eh_frame_writer_.Initialize();
      25      912390 :   }
      26             : 
      27     3822203 :   void MaybeIncreaseBaseOffsetAt(int pc_offset, int base_delta) {
      28     3822203 :     if (enabled() && !tracking_fp_) {
      29           0 :       eh_frame_writer_.AdvanceLocation(pc_offset);
      30             :       eh_frame_writer_.IncreaseBaseAddressOffset(base_delta);
      31             :     }
      32     3822203 :   }
      33             : 
      34             :   void SetNumberOfInstructionBlocks(int number) {
      35      912392 :     if (enabled()) block_initial_states_.resize(number);
      36             :   }
      37             : 
      38             :   void BeginInstructionBlock(int pc_offset, const InstructionBlock* block);
      39             :   void EndInstructionBlock(const InstructionBlock* block);
      40             : 
      41             :   void MarkFrameConstructed(int pc_base);
      42             :   void MarkFrameDeconstructed(int pc_base);
      43             : 
      44     1236773 :   void MarkBlockWillExit() { block_will_exit_ = true; }
      45             : 
      46             :   void Finish(int code_size) {
      47      912392 :     if (enabled()) eh_frame_writer_.Finish(code_size);
      48             :   }
      49             : 
      50             :   EhFrameWriter* eh_frame_writer() {
      51      912391 :     return enabled() ? &eh_frame_writer_ : nullptr;
      52             :   }
      53             : 
      54             :  private:
      55    32010176 :   bool enabled() const { return FLAG_perf_prof_unwinding_info; }
      56             : 
      57             :   class BlockInitialState : public ZoneObject {
      58             :    public:
      59             :     BlockInitialState(Register reg, int offset, bool tracking_fp)
      60         251 :         : register_(reg), offset_(offset), tracking_fp_(tracking_fp) {}
      61             : 
      62             :     Register register_;
      63             :     int offset_;
      64             :     bool tracking_fp_;
      65             :   };
      66             : 
      67             :   Zone* zone_;
      68             :   EhFrameWriter eh_frame_writer_;
      69             :   bool tracking_fp_;
      70             :   bool block_will_exit_;
      71             : 
      72             :   ZoneVector<const BlockInitialState*> block_initial_states_;
      73             : };
      74             : 
      75             : }  // namespace compiler
      76             : }  // namespace internal
      77             : }  // namespace v8
      78             : 
      79             : #endif

Generated by: LCOV version 1.10