v8  3.25.30(node0.11.13)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
frames-x64.h
Go to the documentation of this file.
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
4 // met:
5 //
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.
15 //
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.
27 
28 #ifndef V8_X64_FRAMES_X64_H_
29 #define V8_X64_FRAMES_X64_H_
30 
31 namespace v8 {
32 namespace internal {
33 
34 const int kNumRegs = 16;
35 const RegList kJSCallerSaved =
36  1 << 0 | // rax
37  1 << 1 | // rcx
38  1 << 2 | // rdx
39  1 << 3 | // rbx - used as a caller-saved register in JavaScript code
40  1 << 7; // rdi - callee function
41 
42 const int kNumJSCallerSaved = 5;
43 
45 
46 // Number of registers for which space is reserved in safepoints.
47 const int kNumSafepointRegisters = 16;
48 
49 // ----------------------------------------------------
50 
51 class EntryFrameConstants : public AllStatic {
52  public:
53 #ifdef _WIN64
54  static const int kCalleeSaveXMMRegisters = 10;
55  static const int kXMMRegisterSize = 16;
56  static const int kXMMRegistersBlockSize =
57  kXMMRegisterSize * kCalleeSaveXMMRegisters;
58  static const int kCallerFPOffset =
59  -10 * kPointerSize - kXMMRegistersBlockSize;
60 #else
61  static const int kCallerFPOffset = -8 * kPointerSize;
62 #endif
63  static const int kArgvOffset = 6 * kPointerSize;
64 };
65 
66 
67 class ExitFrameConstants : public AllStatic {
68  public:
69  static const int kFrameSize = 2 * kPointerSize;
70 
71  static const int kCodeOffset = -2 * kPointerSize;
72  static const int kSPOffset = -1 * kPointerSize;
73 
74  static const int kCallerFPOffset = +0 * kPointerSize;
75  static const int kCallerPCOffset = kFPOnStackSize;
76 
77  // FP-relative displacement of the caller's SP. It points just
78  // below the saved PC.
80 
81  static const int kConstantPoolOffset = 0; // Not used
82 };
83 
84 
85 class JavaScriptFrameConstants : public AllStatic {
86  public:
87  // FP-relative.
91 
92  // Caller SP-relative.
93  static const int kParam0Offset = -2 * kPointerSize;
94  static const int kReceiverOffset = -1 * kPointerSize;
95 };
96 
97 
98 class ArgumentsAdaptorFrameConstants : public AllStatic {
99  public:
100  // FP-relative.
102 
103  static const int kFrameSize =
105 };
106 
107 
108 class ConstructFrameConstants : public AllStatic {
109  public:
110  // FP-relative.
111  static const int kImplicitReceiverOffset = -5 * kPointerSize;
112  static const int kConstructorOffset = kMinInt;
113  static const int kLengthOffset = -4 * kPointerSize;
115 
116  static const int kFrameSize =
118 };
119 
120 
121 class InternalFrameConstants : public AllStatic {
122  public:
123  // FP-relative.
125 };
126 
127 
128 inline Object* JavaScriptFrame::function_slot_object() const {
130  return Memory::Object_at(fp() + offset);
131 }
132 
133 
134 inline void StackHandler::SetFp(Address slot, Address fp) {
135  Memory::Address_at(slot) = fp;
136 }
137 
138 
139 } } // namespace v8::internal
140 
141 #endif // V8_X64_FRAMES_X64_H_
byte * Address
Definition: globals.h:186
const int kMinInt
Definition: globals.h:249
static const int kImplicitReceiverOffset
Definition: frames-arm.h:157
static Object *& Object_at(Address addr)
Definition: v8memory.h:83
static const int kFixedFrameSize
Definition: frames.h:181
kSerializedDataOffset Object
Definition: objects-inl.h:5016
uint32_t RegList
Definition: frames.h:41
const RegList kJSCallerSaved
Definition: frames-arm.h:47
static const int kCallerPCOffset
Definition: frames-arm.h:123
static const int kCallerFPOffset
Definition: frames-arm.h:121
const int kPointerSize
Definition: globals.h:268
static Address & Address_at(Address addr)
Definition: v8memory.h:79
const int kFPOnStackSize
Definition: globals.h:271
const int kNumJSCallerSaved
Definition: frames-arm.h:53
static const int kMarkerOffset
Definition: frames.h:184
static const int kExpressionsOffset
Definition: frames.h:183
static const int kCallerSPDisplacement
Definition: frames-arm.h:127
static const int kCallerFPOffset
Definition: frames-arm.h:105
const int kNumSafepointRegisters
Definition: frames-arm.h:92
Object * JSCallerSavedBuffer[kNumJSCallerSaved]
Definition: frames-arm.h:55
static const int kArgvOffset
Definition: frames-ia32.h:70
const Register fp
const int kPCOnStackSize
Definition: globals.h:270
const int kNumRegs
Definition: frames-arm.h:43
static const int kConstantPoolOffset
Definition: frames-arm.h:115