OLD | NEW |
| (Empty) |
1 // Copyright 2013 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 #include "a64/constants-a64.h" | |
29 #include "a64/assembler-a64.h" | |
30 | |
31 #ifndef V8_A64_FRAMES_A64_H_ | |
32 #define V8_A64_FRAMES_A64_H_ | |
33 | |
34 namespace v8 { | |
35 namespace internal { | |
36 | |
37 const int kNumRegs = kNumberOfRegisters; | |
38 // Registers x0-x17 are caller-saved. | |
39 const int kNumJSCallerSaved = 18; | |
40 const RegList kJSCallerSaved = 0x3ffff; | |
41 typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved]; | |
42 | |
43 // Number of registers for which space is reserved in safepoints. Must be a | |
44 // multiple of eight. | |
45 // TODO(all): Refine this number. | |
46 const int kNumSafepointRegisters = 32; | |
47 | |
48 // Define the list of registers actually saved at safepoints. | |
49 // Note that the number of saved registers may be smaller than the reserved | |
50 // space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters. | |
51 #define kSafepointSavedRegisters CPURegList::GetSafepointSavedRegisters().list() | |
52 #define kNumSafepointSavedRegisters \ | |
53 CPURegList::GetSafepointSavedRegisters().Count(); | |
54 | |
55 class EntryFrameConstants : public AllStatic { | |
56 public: | |
57 static const int kCallerFPOffset = | |
58 -(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize); | |
59 }; | |
60 | |
61 | |
62 class ExitFrameConstants : public AllStatic { | |
63 public: | |
64 static const int kFrameSize = 2 * kPointerSize; | |
65 | |
66 static const int kCallerSPDisplacement = 2 * kPointerSize; | |
67 static const int kCallerPCOffset = 1 * kPointerSize; | |
68 static const int kCallerFPOffset = 0 * kPointerSize; // <- fp | |
69 static const int kSPOffset = -1 * kPointerSize; | |
70 static const int kCodeOffset = -2 * kPointerSize; | |
71 static const int kLastExitFrameField = kCodeOffset; | |
72 | |
73 static const int kConstantPoolOffset = 0; // Not used | |
74 }; | |
75 | |
76 | |
77 class JavaScriptFrameConstants : public AllStatic { | |
78 public: | |
79 // FP-relative. | |
80 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset; | |
81 | |
82 // There are two words on the stack (saved fp and saved lr) between fp and | |
83 // the arguments. | |
84 static const int kLastParameterOffset = 2 * kPointerSize; | |
85 | |
86 static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset; | |
87 }; | |
88 | |
89 | |
90 class ArgumentsAdaptorFrameConstants : public AllStatic { | |
91 public: | |
92 // FP-relative. | |
93 static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset; | |
94 | |
95 static const int kFrameSize = | |
96 StandardFrameConstants::kFixedFrameSize + kPointerSize; | |
97 }; | |
98 | |
99 | |
100 class ConstructFrameConstants : public AllStatic { | |
101 public: | |
102 // FP-relative. | |
103 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset; | |
104 static const int kLengthOffset = -4 * kPointerSize; | |
105 static const int kConstructorOffset = -5 * kPointerSize; | |
106 static const int kImplicitReceiverOffset = -6 * kPointerSize; | |
107 | |
108 static const int kFrameSize = | |
109 StandardFrameConstants::kFixedFrameSize + 4 * kPointerSize; | |
110 }; | |
111 | |
112 | |
113 class InternalFrameConstants : public AllStatic { | |
114 public: | |
115 // FP-relative. | |
116 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset; | |
117 }; | |
118 | |
119 | |
120 inline Object* JavaScriptFrame::function_slot_object() const { | |
121 const int offset = JavaScriptFrameConstants::kFunctionOffset; | |
122 return Memory::Object_at(fp() + offset); | |
123 } | |
124 | |
125 | |
126 inline void StackHandler::SetFp(Address slot, Address fp) { | |
127 Memory::Address_at(slot) = fp; | |
128 } | |
129 | |
130 | |
131 } } // namespace v8::internal | |
132 | |
133 #endif // V8_A64_FRAMES_A64_H_ | |
OLD | NEW |