Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Side by Side Diff: src/x64/eh-frame-x64.cc

Issue 2023503002: Reland Implement .eh_frame writer and disassembler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@eh-frame-base
Patch Set: Rebase on master. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/v8.gyp ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 kRaxDwarfCode = 0;
11 static const int kRbpDwarfCode = 6;
12 static const int kRspDwarfCode = 7;
13 static const int kRipDwarfCode = 16;
14
15 const int EhFrameConstants::kCodeAlignmentFactor = 1;
16 const int EhFrameConstants::kDataAlignmentFactor = -8;
17
18 void EhFrameWriter::WriteReturnAddressRegisterCode() {
19 WriteULeb128(kRipDwarfCode);
20 }
21
22 void EhFrameWriter::WriteInitialStateInCie() {
23 SetBaseAddressRegisterAndOffset(rsp, kPointerSize);
24 // x64 rip (r16) has no Register instance associated.
25 RecordRegisterSavedToStack(kRipDwarfCode, -kPointerSize);
26 }
27
28 // static
29 int EhFrameWriter::RegisterToDwarfCode(Register name) {
30 switch (name.code()) {
31 case Register::kCode_rbp:
32 return kRbpDwarfCode;
33 case Register::kCode_rsp:
34 return kRspDwarfCode;
35 case Register::kCode_rax:
36 return kRaxDwarfCode;
37 default:
38 UNIMPLEMENTED();
39 return -1;
40 }
41 }
42
43 #ifdef ENABLE_DISASSEMBLER
44
45 // static
46 const char* EhFrameDisassembler::DwarfRegisterCodeToString(int code) {
47 switch (code) {
48 case kRbpDwarfCode:
49 return "rbp";
50 case kRspDwarfCode:
51 return "rsp";
52 case kRipDwarfCode:
53 return "rip";
54 default:
55 UNIMPLEMENTED();
56 return nullptr;
57 }
58 }
59
60 #endif
61
62 } // namespace internal
63 } // namespace v8
OLDNEW
« no previous file with comments | « src/v8.gyp ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698