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 #include "src/eh-frame.h" | |
6 | |
7 namespace v8 { | |
8 namespace internal { | |
9 | |
10 static const int kR0DwarfCode = 0; | |
11 static const int kFpDwarfCode = 11; | |
12 static const int kSpDwarfCode = 13; | |
13 static const int kLrDwarfCode = 14; | |
14 | |
15 STATIC_CONST_MEMBER_DEFINITION const int | |
16 EhFrameConstants::kCodeAlignmentFactor = 4; | |
17 | |
18 STATIC_CONST_MEMBER_DEFINITION const int | |
19 EhFrameConstants::kDataAlignmentFactor = -4; | |
20 | |
21 void EhFrameWriter::WriteReturnAddressRegisterCode() { | |
22 WriteULeb128(kLrDwarfCode); | |
23 } | |
24 | |
25 void EhFrameWriter::WriteInitialStateInCie() { | |
26 SetBaseAddressRegisterAndOffset(fp, 0); | |
27 RecordRegisterNotModified(lr); | |
28 } | |
29 | |
30 // static | |
31 int EhFrameWriter::RegisterToDwarfCode(Register name) { | |
32 switch (name.code()) { | |
33 case Register::kCode_fp: | |
34 return kFpDwarfCode; | |
35 case Register::kCode_sp: | |
36 return kSpDwarfCode; | |
37 case Register::kCode_lr: | |
38 return kLrDwarfCode; | |
39 case Register::kCode_r0: | |
40 return kR0DwarfCode; | |
41 default: | |
42 UNIMPLEMENTED(); | |
43 return -1; | |
44 } | |
45 } | |
46 | |
47 #ifdef ENABLE_DISASSEMBLER | |
48 | |
49 // static | |
50 const char* EhFrameDisassembler::DwarfRegisterCodeToString(int code) { | |
51 switch (code) { | |
52 case kFpDwarfCode: | |
53 return "fp"; | |
54 case kSpDwarfCode: | |
55 return "sp"; | |
56 case kLrDwarfCode: | |
57 return "lr"; | |
58 default: | |
59 UNIMPLEMENTED(); | |
60 return nullptr; | |
61 } | |
62 } | |
63 | |
64 #endif | |
65 | |
66 } // namespace internal | |
67 } // namespace v8 | |
OLD | NEW |