1 // Copyright 2014 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.
5 #ifndef V8_PPC_FRAMES_PPC_H_
6 #define V8_PPC_FRAMES_PPC_H_
12 // Register list in load/store instructions
13 // Note that the bit values must match those used in actual instruction encoding
14 const int kNumRegs = 32;
17 // Caller-saved/arguments registers
18 const RegList kJSCallerSaved = 1 << 3 | // r3 a1
28 const int kNumJSCallerSaved = 9;
30 // Return the code of the n-th caller-saved register available to JavaScript
31 // e.g. JSCallerSavedReg(0) returns r0.code() == 0
32 int JSCallerSavedCode(int n);
35 // Callee-saved registers preserved when switching from C to JavaScript
36 const RegList kCalleeSaved = 1 << 14 | // r14
56 const int kNumCalleeSaved = 18;
58 const RegList kCallerSavedDoubles = 1 << 0 | // d0
73 const RegList kCalleeSavedDoubles = 1 << 14 | // d14
92 const int kNumCalleeSavedDoubles = 18;
95 // Number of registers for which space is reserved in safepoints. Must be a
97 const int kNumSafepointRegisters = 32;
99 // The following constants describe the stack frame linkage area as
100 // defined by the ABI. Note that kNumRequiredStackFrameSlots must
101 // satisfy alignment requirements (rounding up if required).
102 #if V8_TARGET_ARCH_PPC64 && V8_TARGET_LITTLE_ENDIAN
104 // [1] condition register save area
105 // [2] link register save area
107 // [4] Parameter1 save area
109 // [11] Parameter8 save area
110 // [12] Parameter9 slot (if necessary)
112 const int kNumRequiredStackFrameSlots = 12;
113 const int kStackFrameLRSlot = 2;
114 const int kStackFrameExtraParamSlot = 12;
115 #elif V8_OS_AIX || V8_TARGET_ARCH_PPC64
117 // [1] condition register save area
118 // [2] link register save area
119 // [3] reserved for compiler
120 // [4] reserved by binder
122 // [6] Parameter1 save area
124 // [13] Parameter8 save area
125 // [14] Parameter9 slot (if necessary)
127 #if V8_TARGET_ARCH_PPC64
128 const int kNumRequiredStackFrameSlots = 14;
130 const int kNumRequiredStackFrameSlots = 16;
132 const int kStackFrameLRSlot = 2;
133 const int kStackFrameExtraParamSlot = 14;
136 // [1] link register save area
137 // [2] Parameter9 slot (if necessary)
139 const int kNumRequiredStackFrameSlots = 4;
140 const int kStackFrameLRSlot = 1;
141 const int kStackFrameExtraParamSlot = 2;
144 // ----------------------------------------------------
147 class EntryFrameConstants : public AllStatic {
149 static const int kCallerFPOffset =
150 -(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize);
154 class ExitFrameConstants : public AllStatic {
156 static const int kFrameSize =
157 FLAG_enable_embedded_constant_pool ? 3 * kPointerSize : 2 * kPointerSize;
159 static const int kConstantPoolOffset =
160 FLAG_enable_embedded_constant_pool ? -3 * kPointerSize : 0;
161 static const int kCodeOffset = -2 * kPointerSize;
162 static const int kSPOffset = -1 * kPointerSize;
164 // The caller fields are below the frame pointer on the stack.
165 static const int kCallerFPOffset = 0 * kPointerSize;
166 // The calling JS function is below FP.
167 static const int kCallerPCOffset = 1 * kPointerSize;
169 // FP-relative displacement of the caller's SP. It points just
170 // below the saved PC.
171 static const int kCallerSPDisplacement = 2 * kPointerSize;
175 class JavaScriptFrameConstants : public AllStatic {
178 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
179 static const int kLastParameterOffset = +2 * kPointerSize;
180 static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset;
182 // Caller SP-relative.
183 static const int kParam0Offset = -2 * kPointerSize;
184 static const int kReceiverOffset = -1 * kPointerSize;
189 } // namespace v8::internal
191 #endif // V8_PPC_FRAMES_PPC_H_