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.
5 #ifndef V8_X64_FRAMES_X64_H_
6 #define V8_X64_FRAMES_X64_H_
11 const int kNumRegs = 16;
12 const RegList kJSCallerSaved =
16 1 << 3 | // rbx - used as a caller-saved register in JavaScript code
17 1 << 7; // rdi - callee function
19 const int kNumJSCallerSaved = 5;
21 // Number of registers for which space is reserved in safepoints.
22 const int kNumSafepointRegisters = 16;
24 // ----------------------------------------------------
26 class EntryFrameConstants : public AllStatic {
29 static const int kCalleeSaveXMMRegisters = 10;
30 static const int kXMMRegisterSize = 16;
31 static const int kXMMRegistersBlockSize =
32 kXMMRegisterSize * kCalleeSaveXMMRegisters;
33 static const int kCallerFPOffset =
34 -3 * kPointerSize + -7 * kRegisterSize - kXMMRegistersBlockSize;
36 // We have 3 Push and 5 pushq in the JSEntryStub::GenerateBody.
37 static const int kCallerFPOffset = -3 * kPointerSize + -5 * kRegisterSize;
39 static const int kArgvOffset = 6 * kPointerSize;
43 class ExitFrameConstants : public AllStatic {
45 static const int kFrameSize = 2 * kPointerSize;
47 static const int kCodeOffset = -2 * kPointerSize;
48 static const int kSPOffset = -1 * kPointerSize;
50 static const int kCallerFPOffset = +0 * kPointerSize;
51 static const int kCallerPCOffset = kFPOnStackSize;
53 // FP-relative displacement of the caller's SP. It points just
54 // below the saved PC.
55 static const int kCallerSPDisplacement = kCallerPCOffset + kPCOnStackSize;
57 static const int kConstantPoolOffset = 0; // Not used
61 class JavaScriptFrameConstants : public AllStatic {
64 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
65 static const int kLastParameterOffset = kFPOnStackSize + kPCOnStackSize;
66 static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset;
68 // Caller SP-relative.
69 static const int kParam0Offset = -2 * kPointerSize;
70 static const int kReceiverOffset = -1 * kPointerSize;
74 class ArgumentsAdaptorFrameConstants : public AllStatic {
77 static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset;
79 static const int kFrameSize =
80 StandardFrameConstants::kFixedFrameSize + kPointerSize;
84 class ConstructFrameConstants : public AllStatic {
87 static const int kImplicitReceiverOffset = -5 * kPointerSize;
88 static const int kConstructorOffset = kMinInt;
89 static const int kLengthOffset = -4 * kPointerSize;
90 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
92 static const int kFrameSize =
93 StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize;
97 class InternalFrameConstants : public AllStatic {
100 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
104 inline Object* JavaScriptFrame::function_slot_object() const {
105 const int offset = JavaScriptFrameConstants::kFunctionOffset;
106 return Memory::Object_at(fp() + offset);
110 inline void StackHandler::SetFp(Address slot, Address fp) {
111 if (kFPOnStackSize == 2 * kPointerSize) {
112 // Zero out the high-32 bit of FP for x32 port.
113 Memory::Address_at(slot + kPointerSize) = 0;
115 Memory::Address_at(slot) = fp;
119 } } // namespace v8::internal
121 #endif // V8_X64_FRAMES_X64_H_