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 // Number of registers for which space is reserved in safepoints. Must be a
60 const int kNumSafepointRegisters = 32;
62 // The following constants describe the stack frame linkage area as
63 // defined by the ABI. Note that kNumRequiredStackFrameSlots must
64 // satisfy alignment requirements (rounding up if required).
65 #if V8_TARGET_ARCH_PPC64 && V8_TARGET_LITTLE_ENDIAN
67 // [1] condition register save area
68 // [2] link register save area
70 // [4] Parameter1 save area
72 // [11] Parameter8 save area
73 // [12] Parameter9 slot (if necessary)
75 const int kNumRequiredStackFrameSlots = 12;
76 const int kStackFrameLRSlot = 2;
77 const int kStackFrameExtraParamSlot = 12;
78 #elif V8_OS_AIX || V8_TARGET_ARCH_PPC64
80 // [1] condition register save area
81 // [2] link register save area
82 // [3] reserved for compiler
83 // [4] reserved by binder
85 // [6] Parameter1 save area
87 // [13] Parameter8 save area
88 // [14] Parameter9 slot (if necessary)
90 #if V8_TARGET_ARCH_PPC64
91 const int kNumRequiredStackFrameSlots = 14;
93 const int kNumRequiredStackFrameSlots = 16;
95 const int kStackFrameLRSlot = 2;
96 const int kStackFrameExtraParamSlot = 14;
99 // [1] link register save area
100 // [2] Parameter9 slot (if necessary)
102 const int kNumRequiredStackFrameSlots = 4;
103 const int kStackFrameLRSlot = 1;
104 const int kStackFrameExtraParamSlot = 2;
107 // ----------------------------------------------------
110 class EntryFrameConstants : public AllStatic {
112 static const int kCallerFPOffset =
113 -(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize);
117 class ExitFrameConstants : public AllStatic {
119 static const int kFrameSize = 2 * kPointerSize;
120 static const int kConstantPoolOffset = 0; // Not used.
121 static const int kCodeOffset = -2 * kPointerSize;
122 static const int kSPOffset = -1 * kPointerSize;
124 // The caller fields are below the frame pointer on the stack.
125 static const int kCallerFPOffset = 0 * kPointerSize;
126 // The calling JS function is below FP.
127 static const int kCallerPCOffset = 1 * kPointerSize;
129 // FP-relative displacement of the caller's SP. It points just
130 // below the saved PC.
131 static const int kCallerSPDisplacement = 2 * kPointerSize;
135 class JavaScriptFrameConstants : public AllStatic {
138 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
139 static const int kLastParameterOffset = +2 * kPointerSize;
140 static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset;
142 // Caller SP-relative.
143 static const int kParam0Offset = -2 * kPointerSize;
144 static const int kReceiverOffset = -1 * kPointerSize;
148 class ArgumentsAdaptorFrameConstants : public AllStatic {
151 static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset;
153 static const int kFrameSize =
154 StandardFrameConstants::kFixedFrameSize + kPointerSize;
158 class ConstructFrameConstants : public AllStatic {
161 static const int kImplicitReceiverOffset = -6 * kPointerSize;
162 static const int kConstructorOffset = -5 * kPointerSize;
163 static const int kLengthOffset = -4 * kPointerSize;
164 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
166 static const int kFrameSize =
167 StandardFrameConstants::kFixedFrameSize + 4 * kPointerSize;
171 class InternalFrameConstants : public AllStatic {
174 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
178 inline Object* JavaScriptFrame::function_slot_object() const {
179 const int offset = JavaScriptFrameConstants::kFunctionOffset;
180 return Memory::Object_at(fp() + offset);
185 } // namespace v8::internal
187 #endif // V8_PPC_FRAMES_PPC_H_