1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #ifndef V8_IA32_FRAMES_IA32_H_
29 #define V8_IA32_FRAMES_IA32_H_
36 // Note that the bit values must match those used in actual instruction encoding
37 const int kNumRegs = 8;
40 // Caller-saved registers
41 const RegList kJSCallerSaved =
45 1 << 3 | // ebx - used as a caller-saved register in JavaScript code
46 1 << 7; // edi - callee function
48 const int kNumJSCallerSaved = 5;
50 typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved];
53 // Number of registers for which space is reserved in safepoints.
54 const int kNumSafepointRegisters = 8;
56 const int kNoAlignmentPadding = 0;
57 const int kAlignmentPaddingPushed = 2;
58 const int kAlignmentZapValue = 0x12345678; // Not heap object tagged.
60 // ----------------------------------------------------
63 class StackHandlerConstants : public AllStatic {
65 static const int kNextOffset = 0 * kPointerSize;
66 static const int kCodeOffset = 1 * kPointerSize;
67 static const int kStateOffset = 2 * kPointerSize;
68 static const int kContextOffset = 3 * kPointerSize;
69 static const int kFPOffset = 4 * kPointerSize;
71 static const int kSize = kFPOffset + kPointerSize;
75 class EntryFrameConstants : public AllStatic {
77 static const int kCallerFPOffset = -6 * kPointerSize;
79 static const int kFunctionArgOffset = +3 * kPointerSize;
80 static const int kReceiverArgOffset = +4 * kPointerSize;
81 static const int kArgcOffset = +5 * kPointerSize;
82 static const int kArgvOffset = +6 * kPointerSize;
86 class ExitFrameConstants : public AllStatic {
88 static const int kCodeOffset = -2 * kPointerSize;
89 static const int kSPOffset = -1 * kPointerSize;
91 static const int kCallerFPOffset = 0 * kPointerSize;
92 static const int kCallerPCOffset = +1 * kPointerSize;
94 // FP-relative displacement of the caller's SP. It points just
95 // below the saved PC.
96 static const int kCallerSPDisplacement = +2 * kPointerSize;
100 class JavaScriptFrameConstants : public AllStatic {
103 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
104 static const int kLastParameterOffset = +2 * kPointerSize;
105 static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset;
107 // Caller SP-relative.
108 static const int kParam0Offset = -2 * kPointerSize;
109 static const int kReceiverOffset = -1 * kPointerSize;
111 static const int kDynamicAlignmentStateOffset = kLocal0Offset;
115 class ArgumentsAdaptorFrameConstants : public AllStatic {
118 static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset;
120 static const int kFrameSize =
121 StandardFrameConstants::kFixedFrameSize + kPointerSize;
125 class ConstructFrameConstants : public AllStatic {
128 static const int kImplicitReceiverOffset = -5 * kPointerSize;
129 static const int kConstructorOffset = kMinInt;
130 static const int kLengthOffset = -4 * kPointerSize;
131 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
133 static const int kFrameSize =
134 StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize;
138 class InternalFrameConstants : public AllStatic {
141 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
145 inline Object* JavaScriptFrame::function_slot_object() const {
146 const int offset = JavaScriptFrameConstants::kFunctionOffset;
147 return Memory::Object_at(fp() + offset);
151 } } // namespace v8::internal
153 #endif // V8_IA32_FRAMES_IA32_H_