1 // Copyright 2011 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.
7 #ifndef V8_MIPS_FRAMES_MIPS_H_
8 #define V8_MIPS_FRAMES_MIPS_H_
14 // Note that the bit values must match those used in actual instruction
16 const int kNumRegs = 32;
18 const RegList kJSCallerSaved =
34 const int kNumJSCallerSaved = 14;
37 // Return the code of the n-th caller-saved register available to JavaScript
38 // e.g. JSCallerSavedReg(0) returns a0.code() == 4.
39 int JSCallerSavedCode(int n);
42 // Callee-saved registers preserved when switching from C to JavaScript.
43 const RegList kCalleeSaved =
50 1 << 22 | // s6 (roots in Javascript code)
51 1 << 23 | // s7 (cp in Javascript code)
54 const int kNumCalleeSaved = 9;
56 const RegList kCalleeSavedFPU =
64 const int kNumCalleeSavedFPU = 6;
66 const RegList kCallerSavedFPU =
79 // Number of registers for which space is reserved in safepoints. Must be a
81 const int kNumSafepointRegisters = 24;
83 // Define the list of registers actually saved at safepoints.
84 // Note that the number of saved registers may be smaller than the reserved
85 // space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
86 const RegList kSafepointSavedRegisters = kJSCallerSaved | kCalleeSaved;
87 const int kNumSafepointSavedRegisters =
88 kNumJSCallerSaved + kNumCalleeSaved;
90 const int kUndefIndex = -1;
91 // Map with indexes on stack that corresponds to codes of saved registers.
92 const int kSafepointRegisterStackIndexMap[kNumRegs] = {
93 kUndefIndex, // zero_reg
128 // ----------------------------------------------------
130 class EntryFrameConstants : public AllStatic {
132 static const int kCallerFPOffset =
133 -(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize);
137 class ExitFrameConstants : public AllStatic {
139 static const int kFrameSize = 2 * kPointerSize;
141 static const int kCodeOffset = -2 * kPointerSize;
142 static const int kSPOffset = -1 * kPointerSize;
144 // The caller fields are below the frame pointer on the stack.
145 static const int kCallerFPOffset = +0 * kPointerSize;
146 // The calling JS function is between FP and PC.
147 static const int kCallerPCOffset = +1 * kPointerSize;
149 // MIPS-specific: a pointer to the old sp to avoid unnecessary calculations.
150 static const int kCallerSPOffset = +2 * kPointerSize;
152 // FP-relative displacement of the caller's SP.
153 static const int kCallerSPDisplacement = +2 * kPointerSize;
155 static const int kConstantPoolOffset = 0; // Not used.
159 class JavaScriptFrameConstants : public AllStatic {
162 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
163 static const int kLastParameterOffset = +2 * kPointerSize;
164 static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset;
166 // Caller SP-relative.
167 static const int kParam0Offset = -2 * kPointerSize;
168 static const int kReceiverOffset = -1 * kPointerSize;
172 } // namespace internal