LCOV - code coverage report
Current view: top level - src/x64 - eh-frame-x64.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 12 13 92.3 %
Date: 2019-01-20 Functions: 5 5 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             : #include "src/eh-frame.h"
       6             : #include "src/zone/zone-containers.h"
       7             : 
       8             : namespace v8 {
       9             : namespace internal {
      10             : 
      11             : static const int kRaxDwarfCode = 0;
      12             : static const int kRbpDwarfCode = 6;
      13             : static const int kRspDwarfCode = 7;
      14             : static const int kRipDwarfCode = 16;
      15             : 
      16             : const int EhFrameConstants::kCodeAlignmentFactor = 1;
      17             : const int EhFrameConstants::kDataAlignmentFactor = -8;
      18             : 
      19          42 : void EhFrameWriter::WriteReturnAddressRegisterCode() {
      20          42 :   WriteULeb128(kRipDwarfCode);
      21          42 : }
      22             : 
      23          42 : void EhFrameWriter::WriteInitialStateInCie() {
      24          42 :   SetBaseAddressRegisterAndOffset(rsp, kSystemPointerSize);
      25             :   // x64 rip (r16) has no Register instance associated.
      26          42 :   RecordRegisterSavedToStack(kRipDwarfCode, -kSystemPointerSize);
      27          42 : }
      28             : 
      29             : // static
      30         140 : int EhFrameWriter::RegisterToDwarfCode(Register name) {
      31         140 :   switch (name.code()) {
      32             :     case kRegCode_rbp:
      33             :       return kRbpDwarfCode;
      34             :     case kRegCode_rsp:
      35          65 :       return kRspDwarfCode;
      36             :     case kRegCode_rax:
      37           6 :       return kRaxDwarfCode;
      38             :     default:
      39           0 :       UNIMPLEMENTED();
      40             :       return -1;
      41             :   }
      42             : }
      43             : 
      44             : #ifdef ENABLE_DISASSEMBLER
      45             : 
      46             : // static
      47             : const char* EhFrameDisassembler::DwarfRegisterCodeToString(int code) {
      48             :   switch (code) {
      49             :     case kRbpDwarfCode:
      50             :       return "rbp";
      51             :     case kRspDwarfCode:
      52             :       return "rsp";
      53             :     case kRipDwarfCode:
      54             :       return "rip";
      55             :     default:
      56             :       UNIMPLEMENTED();
      57             :       return nullptr;
      58             :   }
      59             : }
      60             : 
      61             : #endif
      62             : 
      63             : }  // namespace internal
      64      183867 : }  // namespace v8

Generated by: LCOV version 1.10