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_IA32_FRAMES_IA32_H_
6 #define V8_IA32_FRAMES_IA32_H_
13 // Note that the bit values must match those used in actual instruction encoding
14 const int kNumRegs = 8;
17 // Caller-saved registers
18 const RegList kJSCallerSaved =
22 1 << 3 | // ebx - used as a caller-saved register in JavaScript code
23 1 << 7; // edi - callee function
25 const int kNumJSCallerSaved = 5;
27 typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved];
30 // Number of registers for which space is reserved in safepoints.
31 const int kNumSafepointRegisters = 8;
33 const int kNoAlignmentPadding = 0;
34 const int kAlignmentPaddingPushed = 2;
35 const int kAlignmentZapValue = 0x12345678; // Not heap object tagged.
37 // ----------------------------------------------------
40 class EntryFrameConstants : public AllStatic {
42 static const int kCallerFPOffset = -6 * kPointerSize;
44 static const int kFunctionArgOffset = +3 * kPointerSize;
45 static const int kReceiverArgOffset = +4 * kPointerSize;
46 static const int kArgcOffset = +5 * kPointerSize;
47 static const int kArgvOffset = +6 * kPointerSize;
51 class ExitFrameConstants : public AllStatic {
53 static const int kFrameSize = 2 * kPointerSize;
55 static const int kCodeOffset = -2 * kPointerSize;
56 static const int kSPOffset = -1 * kPointerSize;
58 static const int kCallerFPOffset = 0 * kPointerSize;
59 static const int kCallerPCOffset = +1 * kPointerSize;
61 // FP-relative displacement of the caller's SP. It points just
62 // below the saved PC.
63 static const int kCallerSPDisplacement = +2 * kPointerSize;
65 static const int kConstantPoolOffset = 0; // Not used
69 class JavaScriptFrameConstants : public AllStatic {
72 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
73 static const int kLastParameterOffset = +2 * kPointerSize;
74 static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset;
76 // Caller SP-relative.
77 static const int kParam0Offset = -2 * kPointerSize;
78 static const int kReceiverOffset = -1 * kPointerSize;
80 static const int kDynamicAlignmentStateOffset = kLocal0Offset;
84 class ArgumentsAdaptorFrameConstants : public AllStatic {
87 static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset;
89 static const int kFrameSize =
90 StandardFrameConstants::kFixedFrameSize + kPointerSize;
94 class ConstructFrameConstants : public AllStatic {
97 static const int kImplicitReceiverOffset = -5 * kPointerSize;
98 static const int kConstructorOffset = kMinInt;
99 static const int kLengthOffset = -4 * kPointerSize;
100 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
102 static const int kFrameSize =
103 StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize;
107 class InternalFrameConstants : public AllStatic {
110 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
114 inline Object* JavaScriptFrame::function_slot_object() const {
115 const int offset = JavaScriptFrameConstants::kFunctionOffset;
116 return Memory::Object_at(fp() + offset);
120 inline void StackHandler::SetFp(Address slot, Address fp) {
121 Memory::Address_at(slot) = fp;
125 } } // namespace v8::internal
127 #endif // V8_IA32_FRAMES_IA32_H_