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 kX0DwarfCode = 0; | |
11 static const int kJsSpDwarfCode = 28; | |
12 static const int kFpDwarfCode = 29; | |
13 static const int kLrDwarfCode = 30; | |
14 static const int kCSpDwarfCode = 31; | |
15 | |
16 STATIC_CONST_MEMBER_DEFINITION const int | |
17 EhFrameConstants::kCodeAlignmentFactor = 4; | |
18 | |
19 STATIC_CONST_MEMBER_DEFINITION const int | |
20 EhFrameConstants::kDataAlignmentFactor = -8; | |
21 | |
22 void EhFrameWriter::WriteReturnAddressRegisterCode() { | |
23 WriteULeb128(kLrDwarfCode); | |
24 } | |
25 | |
26 void EhFrameWriter::WriteInitialStateInCie() { | |
27 SetBaseAddressRegisterAndOffset(x29, 0); | |
28 RecordRegisterNotModified(x30); | |
29 } | |
30 | |
31 // static | |
32 int EhFrameWriter::RegisterToDwarfCode(Register name) { | |
33 switch (name.code()) { | |
34 case Register::kCode_x28: | |
35 return kJsSpDwarfCode; | |
36 case Register::kCode_x29: | |
37 return kFpDwarfCode; | |
38 case Register::kCode_x30: | |
39 return kLrDwarfCode; | |
40 case Register::kCode_x31: | |
41 return kCSpDwarfCode; | |
42 case Register::kCode_x0: | |
43 return kX0DwarfCode; | |
44 default: | |
45 UNIMPLEMENTED(); | |
46 return -1; | |
47 } | |
48 } | |
49 | |
50 #ifdef ENABLE_DISASSEMBLER | |
51 | |
52 // static | |
53 const char* EhFrameDisassembler::DwarfRegisterCodeToString(int code) { | |
54 switch (code) { | |
55 case kFpDwarfCode: | |
56 return "fp"; | |
57 case kLrDwarfCode: | |
58 return "lr"; | |
59 case kJsSpDwarfCode: | |
60 return "jssp"; | |
61 case kCSpDwarfCode: | |
62 return "csp"; // This could be zr as well | |
63 default: | |
64 UNIMPLEMENTED(); | |
65 return nullptr; | |
66 } | |
67 } | |
68 | |
69 #endif | |
70 | |
71 } // namespace internal | |
72 } // namespace v8 | |
OLD | NEW |