1 // Copyright 2013 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/arm64/assembler-arm64.h"
6 #include "src/arm64/constants-arm64.h"
7 
8 #ifndef V8_ARM64_FRAMES_ARM64_H_
9 #define V8_ARM64_FRAMES_ARM64_H_
10 
11 namespace v8 {
12 namespace internal {
13 
14 const int kNumRegs = kNumberOfRegisters;
15 // Registers x0-x17 are caller-saved.
16 const int kNumJSCallerSaved = 18;
17 const RegList kJSCallerSaved = 0x3ffff;
18 
19 // Number of registers for which space is reserved in safepoints. Must be a
20 // multiple of eight.
21 // TODO(all): Refine this number.
22 const int kNumSafepointRegisters = 32;
23 
24 // Define the list of registers actually saved at safepoints.
25 // Note that the number of saved registers may be smaller than the reserved
26 // space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
27 #define kSafepointSavedRegisters CPURegList::GetSafepointSavedRegisters().list()
28 #define kNumSafepointSavedRegisters \
29   CPURegList::GetSafepointSavedRegisters().Count();
30 
31 class EntryFrameConstants : public AllStatic {
32  public:
33   static const int kCallerFPOffset =
34       -(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize);
35 };
36 
37 
38 class ExitFrameConstants : public AllStatic {
39  public:
40   static const int kFrameSize            =  2 * kPointerSize;
41 
42   static const int kCallerSPDisplacement =  2 * kPointerSize;
43   static const int kCallerPCOffset       =  1 * kPointerSize;
44   static const int kCallerFPOffset       =  0 * kPointerSize;   // <- fp
45   static const int kSPOffset             = -1 * kPointerSize;
46   static const int kCodeOffset           = -2 * kPointerSize;
47   static const int kLastExitFrameField   = kCodeOffset;
48 
49   static const int kConstantPoolOffset   = 0;  // Not used
50 };
51 
52 
53 class JavaScriptFrameConstants : public AllStatic {
54  public:
55   // FP-relative.
56   static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
57 
58   // There are two words on the stack (saved fp and saved lr) between fp and
59   // the arguments.
60   static const int kLastParameterOffset = 2 * kPointerSize;
61 
62   static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset;
63 };
64 
65 
66 }  // namespace internal
67 }  // namespace v8
68 
69 #endif  // V8_ARM64_FRAMES_ARM64_H_
70