V8 Project
frames-arm.h
Go to the documentation of this file.
1 // Copyright 2012 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 #ifndef V8_ARM_FRAMES_ARM_H_
6 #define V8_ARM_FRAMES_ARM_H_
7 
8 namespace v8 {
9 namespace internal {
10 
11 
12 // The ARM ABI does not specify the usage of register r9, which may be reserved
13 // as the static base or thread register on some platforms, in which case we
14 // leave it alone. Adjust the value of kR9Available accordingly:
15 const int kR9Available = 1; // 1 if available to us, 0 if reserved
16 
17 
18 // Register list in load/store instructions
19 // Note that the bit values must match those used in actual instruction encoding
20 const int kNumRegs = 16;
21 
22 
23 // Caller-saved/arguments registers
25  1 << 0 | // r0 a1
26  1 << 1 | // r1 a2
27  1 << 2 | // r2 a3
28  1 << 3; // r3 a4
29 
30 const int kNumJSCallerSaved = 4;
31 
32 // Return the code of the n-th caller-saved register available to JavaScript
33 // e.g. JSCallerSavedReg(0) returns r0.code() == 0
34 int JSCallerSavedCode(int n);
35 
36 
37 // Callee-saved registers preserved when switching from C to JavaScript
39  1 << 4 | // r4 v1
40  1 << 5 | // r5 v2
41  1 << 6 | // r6 v3
42  1 << 7 | // r7 v4 (cp in JavaScript code)
43  1 << 8 | // r8 v5 (pp in JavaScript code)
44  kR9Available << 9 | // r9 v6
45  1 << 10 | // r10 v7
46  1 << 11; // r11 v8 (fp in JavaScript code)
47 
48 // When calling into C++ (only for C++ calls that can't cause a GC).
49 // The call code will take care of lr, fp, etc.
51  1 << 0 | // r0
52  1 << 1 | // r1
53  1 << 2 | // r2
54  1 << 3 | // r3
55  1 << 9; // r9
56 
57 
58 const int kNumCalleeSaved = 7 + kR9Available;
59 
60 // Double registers d8 to d15 are callee-saved.
61 const int kNumDoubleCalleeSaved = 8;
62 
63 
64 // Number of registers for which space is reserved in safepoints. Must be a
65 // multiple of 8.
66 // TODO(regis): Only 8 registers may actually be sufficient. Revisit.
67 const int kNumSafepointRegisters = 16;
68 
69 // Define the list of registers actually saved at safepoints.
70 // Note that the number of saved registers may be smaller than the reserved
71 // space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
74 
75 // ----------------------------------------------------
76 
77 
79  public:
80  static const int kCallerFPOffset =
82 };
83 
84 
85 class ExitFrameConstants : public AllStatic {
86  public:
87  static const int kFrameSize = FLAG_enable_ool_constant_pool ?
88  3 * kPointerSize : 2 * kPointerSize;
89 
90  static const int kConstantPoolOffset = FLAG_enable_ool_constant_pool ?
91  -3 * kPointerSize : 0;
92  static const int kCodeOffset = -2 * kPointerSize;
93  static const int kSPOffset = -1 * kPointerSize;
94 
95  // The caller fields are below the frame pointer on the stack.
96  static const int kCallerFPOffset = 0 * kPointerSize;
97  // The calling JS function is below FP.
98  static const int kCallerPCOffset = 1 * kPointerSize;
99 
100  // FP-relative displacement of the caller's SP. It points just
101  // below the saved PC.
102  static const int kCallerSPDisplacement = 2 * kPointerSize;
103 };
104 
105 
107  public:
108  // FP-relative.
110  static const int kLastParameterOffset = +2 * kPointerSize;
112 
113  // Caller SP-relative.
114  static const int kParam0Offset = -2 * kPointerSize;
115  static const int kReceiverOffset = -1 * kPointerSize;
116 };
117 
118 
120  public:
121  // FP-relative.
123 
124  static const int kFrameSize =
126 };
127 
128 
130  public:
131  // FP-relative.
132  static const int kImplicitReceiverOffset = -6 * kPointerSize;
133  static const int kConstructorOffset = -5 * kPointerSize;
134  static const int kLengthOffset = -4 * kPointerSize;
136 
137  static const int kFrameSize =
139 };
140 
141 
143  public:
144  // FP-relative.
146 };
147 
148 
151  return Memory::Object_at(fp() + offset);
152 }
153 
154 
155 inline void StackHandler::SetFp(Address slot, Address fp) {
156  Memory::Address_at(slot) = fp;
157 }
158 
159 
160 } } // namespace v8::internal
161 
162 #endif // V8_ARM_FRAMES_ARM_H_
static const int kImplicitReceiverOffset
Definition: frames-arm.h:132
static const int kCallerFPOffset
Definition: frames-arm.h:80
static const int kCallerSPDisplacement
Definition: frames-arm.h:102
static const int kCallerPCOffset
Definition: frames-arm.h:98
static const int kCodeOffset
Definition: frames-arm.h:92
static const int kConstantPoolOffset
Definition: frames-arm.h:90
static const int kCallerFPOffset
Definition: frames-arm.h:96
Object * function_slot_object() const
Definition: frames-arm.h:149
static Object *& Object_at(Address addr)
Definition: v8memory.h:60
static Address & Address_at(Address addr)
Definition: v8memory.h:56
static const int kFixedFrameSizeFromFp
Definition: frames.h:157
static const int kFixedFrameSize
Definition: frames.h:158
static const int kExpressionsOffset
Definition: frames.h:160
static const int kMarkerOffset
Definition: frames.h:161
const int kPointerSize
Definition: globals.h:129
const RegList kJSCallerSaved
Definition: frames-arm.h:24
const int kNumSafepointSavedRegisters
Definition: frames-arm.h:73
const RegList kCalleeSaved
Definition: frames-arm.h:38
int JSCallerSavedCode(int n)
Definition: frames.cc:1601
const int kR9Available
Definition: frames-arm.h:15
const int kNumSafepointRegisters
Definition: frames-arm.h:67
const Register fp
uint32_t RegList
Definition: frames.h:18
byte * Address
Definition: globals.h:101
const int kNumJSCallerSaved
Definition: frames-arm.h:30
const int kNumCalleeSaved
Definition: frames-arm.h:58
const int kNumDoubleCalleeSaved
Definition: frames-arm.h:61
const RegList kSafepointSavedRegisters
Definition: frames-arm.h:72
const RegList kCallerSaved
Definition: frames-arm.h:50
const int kNumRegs
Definition: frames-arm.h:20
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20