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-arm.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_ARM_FRAMES_ARM_H_
29 #define V8_ARM_FRAMES_ARM_H_
30 
31 namespace v8 {
32 namespace internal {
33 
34 
35 // The ARM ABI does not specify the usage of register r9, which may be reserved
36 // as the static base or thread register on some platforms, in which case we
37 // leave it alone. Adjust the value of kR9Available accordingly:
38 const int kR9Available = 1; // 1 if available to us, 0 if reserved
39 
40 
41 // Register list in load/store instructions
42 // Note that the bit values must match those used in actual instruction encoding
43 const int kNumRegs = 16;
44 
45 
46 // Caller-saved/arguments registers
48  1 << 0 | // r0 a1
49  1 << 1 | // r1 a2
50  1 << 2 | // r2 a3
51  1 << 3; // r3 a4
52 
53 const int kNumJSCallerSaved = 4;
54 
56 
57 // Return the code of the n-th caller-saved register available to JavaScript
58 // e.g. JSCallerSavedReg(0) returns r0.code() == 0
59 int JSCallerSavedCode(int n);
60 
61 
62 // Callee-saved registers preserved when switching from C to JavaScript
64  1 << 4 | // r4 v1
65  1 << 5 | // r5 v2
66  1 << 6 | // r6 v3
67  1 << 7 | // r7 v4 (cp in JavaScript code)
68  1 << 8 | // r8 v5 (pp in JavaScript code)
69  kR9Available << 9 | // r9 v6
70  1 << 10 | // r10 v7
71  1 << 11; // r11 v8 (fp in JavaScript code)
72 
73 // When calling into C++ (only for C++ calls that can't cause a GC).
74 // The call code will take care of lr, fp, etc.
76  1 << 0 | // r0
77  1 << 1 | // r1
78  1 << 2 | // r2
79  1 << 3 | // r3
80  1 << 9; // r9
81 
82 
83 const int kNumCalleeSaved = 7 + kR9Available;
84 
85 // Double registers d8 to d15 are callee-saved.
86 const int kNumDoubleCalleeSaved = 8;
87 
88 
89 // Number of registers for which space is reserved in safepoints. Must be a
90 // multiple of 8.
91 // TODO(regis): Only 8 registers may actually be sufficient. Revisit.
92 const int kNumSafepointRegisters = 16;
93 
94 // Define the list of registers actually saved at safepoints.
95 // Note that the number of saved registers may be smaller than the reserved
96 // space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters.
99 
100 // ----------------------------------------------------
101 
102 
104  public:
105  static const int kCallerFPOffset =
107 };
108 
109 
111  public:
112  static const int kFrameSize = FLAG_enable_ool_constant_pool ?
113  3 * kPointerSize : 2 * kPointerSize;
114 
115  static const int kConstantPoolOffset = FLAG_enable_ool_constant_pool ?
116  -3 * kPointerSize : 0;
117  static const int kCodeOffset = -2 * kPointerSize;
118  static const int kSPOffset = -1 * kPointerSize;
119 
120  // The caller fields are below the frame pointer on the stack.
121  static const int kCallerFPOffset = 0 * kPointerSize;
122  // The calling JS function is below FP.
123  static const int kCallerPCOffset = 1 * kPointerSize;
124 
125  // FP-relative displacement of the caller's SP. It points just
126  // below the saved PC.
127  static const int kCallerSPDisplacement = 2 * kPointerSize;
128 };
129 
130 
132  public:
133  // FP-relative.
135  static const int kLastParameterOffset = +2 * kPointerSize;
137 
138  // Caller SP-relative.
139  static const int kParam0Offset = -2 * kPointerSize;
140  static const int kReceiverOffset = -1 * kPointerSize;
141 };
142 
143 
145  public:
146  // FP-relative.
148 
149  static const int kFrameSize =
151 };
152 
153 
155  public:
156  // FP-relative.
157  static const int kImplicitReceiverOffset = -6 * kPointerSize;
158  static const int kConstructorOffset = -5 * kPointerSize;
159  static const int kLengthOffset = -4 * kPointerSize;
161 
162  static const int kFrameSize =
164 };
165 
166 
168  public:
169  // FP-relative.
171 };
172 
173 
174 inline Object* JavaScriptFrame::function_slot_object() const {
176  return Memory::Object_at(fp() + offset);
177 }
178 
179 
180 inline void StackHandler::SetFp(Address slot, Address fp) {
181  Memory::Address_at(slot) = fp;
182 }
183 
184 
185 } } // namespace v8::internal
186 
187 #endif // V8_ARM_FRAMES_ARM_H_
byte * Address
Definition: globals.h:186
const RegList kSafepointSavedRegisters
Definition: frames-arm.h:97
static const int kImplicitReceiverOffset
Definition: frames-arm.h:157
static Object *& Object_at(Address addr)
Definition: v8memory.h:83
const RegList kCallerSaved
Definition: frames-arm.h:75
Definition: frames-arm.h:103
static const int kFixedFrameSize
Definition: frames.h:181
uint32_t RegList
Definition: frames.h:41
const int kNumSafepointSavedRegisters
Definition: frames-arm.h:98
const RegList kJSCallerSaved
Definition: frames-arm.h:47
int JSCallerSavedCode(int n)
Definition: frames.cc:1610
const int kNumDoubleCalleeSaved
Definition: frames-arm.h:86
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 RegList kCalleeSaved
Definition: frames-arm.h:63
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 kFixedFrameSizeFromFp
Definition: frames.h:180
const int kNumCalleeSaved
Definition: frames-arm.h:83
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
const int kR9Available
Definition: frames-arm.h:38
const Register fp
const int kNumRegs
Definition: frames-arm.h:43
static const int kConstantPoolOffset
Definition: frames-arm.h:115