OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/interface-descriptors.h" | 9 #include "src/interface-descriptors.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 const Register CallInterfaceDescriptor::ContextRegister() { return rsi; } | 14 const Register CallInterfaceDescriptor::ContextRegister() { return rsi; } |
15 | 15 |
16 | 16 |
17 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { | 17 const Register LoadDescriptor::ReceiverRegister() { return rdx; } |
18 InitializeForIsolateAllPlatforms(isolate); | 18 const Register LoadDescriptor::NameRegister() { return rcx; } |
19 | 19 |
20 { | 20 |
21 CallInterfaceDescriptor* descriptor = | 21 const Register VectorLoadICDescriptor::ReceiverRegister() { |
22 isolate->call_descriptor(CallDescriptorKey::FastNewClosureCall); | 22 return LoadDescriptor::ReceiverRegister(); |
23 Register registers[] = {rsi, rbx}; | 23 } |
24 descriptor->Initialize(arraysize(registers), registers, NULL); | 24 |
25 } | 25 |
26 { | 26 const Register VectorLoadICDescriptor::NameRegister() { |
27 CallInterfaceDescriptor* descriptor = | 27 return LoadDescriptor::NameRegister(); |
28 isolate->call_descriptor(CallDescriptorKey::FastNewContextCall); | 28 } |
29 Register registers[] = {rsi, rdi}; | 29 |
30 descriptor->Initialize(arraysize(registers), registers, NULL); | 30 |
31 } | 31 const Register VectorLoadICDescriptor::SlotRegister() { return rax; } |
32 { | 32 const Register VectorLoadICDescriptor::VectorRegister() { return rbx; } |
33 CallInterfaceDescriptor* descriptor = | 33 |
34 isolate->call_descriptor(CallDescriptorKey::ToNumberCall); | 34 |
35 // ToNumberStub invokes a function, and therefore needs a context. | 35 const Register StoreDescriptor::ReceiverRegister() { return rdx; } |
36 Register registers[] = {rsi, rax}; | 36 const Register StoreDescriptor::NameRegister() { return rcx; } |
37 descriptor->Initialize(arraysize(registers), registers, NULL); | 37 const Register StoreDescriptor::ValueRegister() { return rax; } |
38 } | 38 |
39 { | 39 |
40 CallInterfaceDescriptor* descriptor = | 40 const Register ElementTransitionAndStoreDescriptor::ReceiverRegister() { |
41 isolate->call_descriptor(CallDescriptorKey::NumberToStringCall); | 41 return StoreDescriptor::ReceiverRegister(); |
42 Register registers[] = {rsi, rax}; | 42 } |
43 descriptor->Initialize(arraysize(registers), registers, NULL); | 43 |
44 } | 44 |
45 { | 45 const Register ElementTransitionAndStoreDescriptor::NameRegister() { |
46 CallInterfaceDescriptor* descriptor = | 46 return StoreDescriptor::NameRegister(); |
47 isolate->call_descriptor(CallDescriptorKey::FastCloneShallowArrayCall); | 47 } |
48 Register registers[] = {rsi, rax, rbx, rcx}; | 48 |
49 Representation representations[] = { | 49 |
50 Representation::Tagged(), Representation::Tagged(), | 50 const Register ElementTransitionAndStoreDescriptor::ValueRegister() { |
51 Representation::Smi(), Representation::Tagged()}; | 51 return StoreDescriptor::ValueRegister(); |
52 descriptor->Initialize(arraysize(registers), registers, representations); | 52 } |
53 } | 53 |
54 { | 54 |
55 CallInterfaceDescriptor* descriptor = | 55 const Register ElementTransitionAndStoreDescriptor::MapRegister() { |
56 isolate->call_descriptor(CallDescriptorKey::FastCloneShallowObjectCall); | 56 return rbx; |
57 Register registers[] = {rsi, rax, rbx, rcx, rdx}; | 57 } |
58 descriptor->Initialize(arraysize(registers), registers, NULL); | 58 |
59 } | 59 |
60 { | 60 const Register InstanceofDescriptor::left() { return rax; } |
61 CallInterfaceDescriptor* descriptor = | 61 const Register InstanceofDescriptor::right() { return rdx; } |
62 isolate->call_descriptor(CallDescriptorKey::CreateAllocationSiteCall); | 62 |
63 Register registers[] = {rsi, rbx, rdx}; | 63 |
64 descriptor->Initialize(arraysize(registers), registers, NULL); | 64 void FastNewClosureDescriptor::Initialize(Isolate* isolate) { |
65 } | 65 Register registers[] = {rsi, rbx}; |
66 { | 66 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
67 CallInterfaceDescriptor* descriptor = | 67 } |
68 isolate->call_descriptor(CallDescriptorKey::CallFunctionCall); | 68 |
69 Register registers[] = {rsi, rdi}; | 69 |
70 descriptor->Initialize(arraysize(registers), registers, NULL); | 70 void FastNewContextDescriptor::Initialize(Isolate* isolate) { |
71 } | 71 Register registers[] = {rsi, rdi}; |
72 { | 72 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
73 CallInterfaceDescriptor* descriptor = | 73 } |
74 isolate->call_descriptor(CallDescriptorKey::CallConstructCall); | 74 |
75 // rax : number of arguments | 75 |
76 // rbx : feedback vector | 76 void ToNumberDescriptor::Initialize(Isolate* isolate) { |
77 // rdx : (only if rbx is not the megamorphic symbol) slot in feedback | 77 // ToNumberStub invokes a function, and therefore needs a context. |
78 // vector (Smi) | 78 Register registers[] = {rsi, rax}; |
79 // rdi : constructor function | 79 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
80 // TODO(turbofan): So far we don't gather type feedback and hence skip the | 80 } |
81 // slot parameter, but ArrayConstructStub needs the vector to be undefined. | 81 |
82 Register registers[] = {rsi, rax, rdi, rbx}; | 82 |
83 descriptor->Initialize(arraysize(registers), registers, NULL); | 83 void NumberToStringDescriptor::Initialize(Isolate* isolate) { |
84 } | 84 Register registers[] = {rsi, rax}; |
85 { | 85 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
86 CallInterfaceDescriptor* descriptor = | 86 } |
87 isolate->call_descriptor(CallDescriptorKey::RegExpConstructResultCall); | 87 |
88 Register registers[] = {rsi, rcx, rbx, rax}; | 88 |
89 descriptor->Initialize(arraysize(registers), registers, NULL); | 89 void FastCloneShallowArrayDescriptor::Initialize(Isolate* isolate) { |
90 } | 90 Register registers[] = {rsi, rax, rbx, rcx}; |
91 { | 91 Representation representations[] = { |
92 CallInterfaceDescriptor* descriptor = | 92 Representation::Tagged(), Representation::Tagged(), Representation::Smi(), |
93 isolate->call_descriptor(CallDescriptorKey::TransitionElementsKindCall); | 93 Representation::Tagged()}; |
94 Register registers[] = {rsi, rax, rbx}; | 94 InitializeData(isolate, key(), arraysize(registers), registers, |
95 descriptor->Initialize(arraysize(registers), registers, NULL); | 95 representations); |
96 } | 96 } |
97 { | 97 |
98 CallInterfaceDescriptor* descriptor = isolate->call_descriptor( | 98 |
99 CallDescriptorKey::ArrayConstructorConstantArgCountCall); | 99 void FastCloneShallowObjectDescriptor::Initialize(Isolate* isolate) { |
100 // register state | 100 Register registers[] = {rsi, rax, rbx, rcx, rdx}; |
101 // rax -- number of arguments | 101 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
102 // rdi -- function | 102 } |
103 // rbx -- allocation site with elements kind | 103 |
104 Register registers[] = {rsi, rdi, rbx}; | 104 |
105 descriptor->Initialize(arraysize(registers), registers, NULL); | 105 void CreateAllocationSiteDescriptor::Initialize(Isolate* isolate) { |
106 } | 106 Register registers[] = {rsi, rbx, rdx}; |
107 { | 107 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
108 CallInterfaceDescriptor* descriptor = | 108 } |
109 isolate->call_descriptor(CallDescriptorKey::ArrayConstructorCall); | 109 |
110 // stack param count needs (constructor pointer, and single argument) | 110 |
111 Register registers[] = {rsi, rdi, rbx, rax}; | 111 void CallFunctionDescriptor::Initialize(Isolate* isolate) { |
112 Representation representations[] = { | 112 Register registers[] = {rsi, rdi}; |
113 Representation::Tagged(), Representation::Tagged(), | 113 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
114 Representation::Tagged(), Representation::Integer32()}; | 114 } |
115 descriptor->Initialize(arraysize(registers), registers, representations); | 115 |
116 } | 116 |
117 { | 117 void CallConstructDescriptor::Initialize(Isolate* isolate) { |
118 CallInterfaceDescriptor* descriptor = isolate->call_descriptor( | 118 // rax : number of arguments |
119 CallDescriptorKey::InternalArrayConstructorConstantArgCountCall); | 119 // rbx : feedback vector |
120 // register state | 120 // rdx : (only if rbx is not the megamorphic symbol) slot in feedback |
121 // rsi -- context | 121 // vector (Smi) |
122 // rax -- number of arguments | 122 // rdi : constructor function |
123 // rdi -- constructor function | 123 // TODO(turbofan): So far we don't gather type feedback and hence skip the |
124 Register registers[] = {rsi, rdi}; | 124 // slot parameter, but ArrayConstructStub needs the vector to be undefined. |
125 descriptor->Initialize(arraysize(registers), registers, NULL); | 125 Register registers[] = {rsi, rax, rdi, rbx}; |
126 } | 126 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
127 { | 127 } |
128 CallInterfaceDescriptor* descriptor = isolate->call_descriptor( | 128 |
129 CallDescriptorKey::InternalArrayConstructorCall); | 129 |
130 // stack param count needs (constructor pointer, and single argument) | 130 void RegExpConstructResultDescriptor::Initialize(Isolate* isolate) { |
131 Register registers[] = {rsi, rdi, rax}; | 131 Register registers[] = {rsi, rcx, rbx, rax}; |
132 Representation representations[] = {Representation::Tagged(), | 132 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
133 Representation::Tagged(), | 133 } |
134 Representation::Integer32()}; | 134 |
135 descriptor->Initialize(arraysize(registers), registers, representations); | 135 |
136 } | 136 void TransitionElementsKindDescriptor::Initialize(Isolate* isolate) { |
137 { | 137 Register registers[] = {rsi, rax, rbx}; |
138 CallInterfaceDescriptor* descriptor = | 138 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
139 isolate->call_descriptor(CallDescriptorKey::CompareNilCall); | 139 } |
140 Register registers[] = {rsi, rax}; | 140 |
141 descriptor->Initialize(arraysize(registers), registers, NULL); | 141 |
142 } | 142 void ArrayConstructorConstantArgCountDescriptor::Initialize(Isolate* isolate) { |
143 { | 143 // register state |
144 CallInterfaceDescriptor* descriptor = | 144 // rax -- number of arguments |
145 isolate->call_descriptor(CallDescriptorKey::ToBooleanCall); | 145 // rdi -- function |
146 Register registers[] = {rsi, rax}; | 146 // rbx -- allocation site with elements kind |
147 descriptor->Initialize(arraysize(registers), registers, NULL); | 147 Register registers[] = {rsi, rdi, rbx}; |
148 } | 148 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
149 { | 149 } |
150 CallInterfaceDescriptor* descriptor = | 150 |
151 isolate->call_descriptor(CallDescriptorKey::BinaryOpCall); | 151 |
152 Register registers[] = {rsi, rdx, rax}; | 152 void ArrayConstructorDescriptor::Initialize(Isolate* isolate) { |
153 descriptor->Initialize(arraysize(registers), registers, NULL); | 153 // stack param count needs (constructor pointer, and single argument) |
154 } | 154 Register registers[] = {rsi, rdi, rbx, rax}; |
155 { | 155 Representation representations[] = { |
156 CallInterfaceDescriptor* descriptor = isolate->call_descriptor( | 156 Representation::Tagged(), Representation::Tagged(), |
157 CallDescriptorKey::BinaryOpWithAllocationSiteCall); | 157 Representation::Tagged(), Representation::Integer32()}; |
158 Register registers[] = {rsi, rcx, rdx, rax}; | 158 InitializeData(isolate, key(), arraysize(registers), registers, |
159 descriptor->Initialize(arraysize(registers), registers, NULL); | 159 representations); |
160 } | 160 } |
161 { | 161 |
162 CallInterfaceDescriptor* descriptor = | 162 |
163 isolate->call_descriptor(CallDescriptorKey::StringAddCall); | 163 void InternalArrayConstructorConstantArgCountDescriptor::Initialize( |
164 Register registers[] = {rsi, rdx, rax}; | 164 Isolate* isolate) { |
165 descriptor->Initialize(arraysize(registers), registers, NULL); | 165 // register state |
166 } | 166 // rsi -- context |
167 | 167 // rax -- number of arguments |
168 { | 168 // rdi -- constructor function |
169 CallInterfaceDescriptor* descriptor = | 169 Register registers[] = {rsi, rdi}; |
170 isolate->call_descriptor(CallDescriptorKey::ArgumentAdaptorCall); | 170 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
171 Register registers[] = { | 171 } |
172 rsi, // context | 172 |
173 rdi, // JSFunction | 173 |
174 rax, // actual number of arguments | 174 void InternalArrayConstructorDescriptor::Initialize(Isolate* isolate) { |
175 rbx, // expected number of arguments | 175 // stack param count needs (constructor pointer, and single argument) |
176 }; | 176 Register registers[] = {rsi, rdi, rax}; |
177 Representation representations[] = { | 177 Representation representations[] = {Representation::Tagged(), |
178 Representation::Tagged(), // context | 178 Representation::Tagged(), |
179 Representation::Tagged(), // JSFunction | 179 Representation::Integer32()}; |
180 Representation::Integer32(), // actual number of arguments | 180 InitializeData(isolate, key(), arraysize(registers), registers, |
181 Representation::Integer32(), // expected number of arguments | 181 representations); |
182 }; | 182 } |
183 descriptor->Initialize(arraysize(registers), registers, representations); | 183 |
184 } | 184 |
185 { | 185 void CompareNilDescriptor::Initialize(Isolate* isolate) { |
186 CallInterfaceDescriptor* descriptor = | 186 Register registers[] = {rsi, rax}; |
187 isolate->call_descriptor(CallDescriptorKey::KeyedCall); | 187 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
188 Register registers[] = { | 188 } |
189 rsi, // context | 189 |
190 rcx, // key | 190 |
191 }; | 191 void ToBooleanDescriptor::Initialize(Isolate* isolate) { |
192 Representation representations[] = { | 192 Register registers[] = {rsi, rax}; |
193 Representation::Tagged(), // context | 193 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
194 Representation::Tagged(), // key | 194 } |
195 }; | 195 |
196 descriptor->Initialize(arraysize(registers), registers, representations); | 196 |
197 } | 197 void BinaryOpDescriptor::Initialize(Isolate* isolate) { |
198 { | 198 Register registers[] = {rsi, rdx, rax}; |
199 CallInterfaceDescriptor* descriptor = | 199 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
200 isolate->call_descriptor(CallDescriptorKey::NamedCall); | 200 } |
201 Register registers[] = { | 201 |
202 rsi, // context | 202 |
203 rcx, // name | 203 void BinaryOpWithAllocationSiteDescriptor::Initialize(Isolate* isolate) { |
204 }; | 204 Register registers[] = {rsi, rcx, rdx, rax}; |
205 Representation representations[] = { | 205 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
206 Representation::Tagged(), // context | 206 } |
207 Representation::Tagged(), // name | 207 |
208 }; | 208 |
209 descriptor->Initialize(arraysize(registers), registers, representations); | 209 void StringAddDescriptor::Initialize(Isolate* isolate) { |
210 } | 210 Register registers[] = {rsi, rdx, rax}; |
211 { | 211 InitializeData(isolate, key(), arraysize(registers), registers, NULL); |
212 CallInterfaceDescriptor* descriptor = | 212 } |
213 isolate->call_descriptor(CallDescriptorKey::CallHandler); | 213 |
214 Register registers[] = { | 214 |
215 rsi, // context | 215 void KeyedDescriptor::Initialize(Isolate* isolate) { |
216 rdx, // receiver | 216 Register registers[] = { |
217 }; | 217 rsi, // context |
218 Representation representations[] = { | 218 rcx, // key |
219 Representation::Tagged(), // context | 219 }; |
220 Representation::Tagged(), // receiver | 220 Representation representations[] = { |
221 }; | 221 Representation::Tagged(), // context |
222 descriptor->Initialize(arraysize(registers), registers, representations); | 222 Representation::Tagged(), // key |
223 } | 223 }; |
224 { | 224 InitializeData(isolate, key(), arraysize(registers), registers, |
225 CallInterfaceDescriptor* descriptor = | 225 representations); |
226 isolate->call_descriptor(CallDescriptorKey::ApiFunctionCall); | 226 } |
227 Register registers[] = { | 227 |
228 rsi, // context | 228 |
229 rax, // callee | 229 void NamedDescriptor::Initialize(Isolate* isolate) { |
230 rbx, // call_data | 230 Register registers[] = { |
231 rcx, // holder | 231 rsi, // context |
232 rdx, // api_function_address | 232 rcx, // name |
233 }; | 233 }; |
234 Representation representations[] = { | 234 Representation representations[] = { |
235 Representation::Tagged(), // context | 235 Representation::Tagged(), // context |
236 Representation::Tagged(), // callee | 236 Representation::Tagged(), // name |
237 Representation::Tagged(), // call_data | 237 }; |
238 Representation::Tagged(), // holder | 238 InitializeData(isolate, key(), arraysize(registers), registers, |
239 Representation::External(), // api_function_address | 239 representations); |
240 }; | 240 } |
241 descriptor->Initialize(arraysize(registers), registers, representations); | 241 |
242 } | 242 |
| 243 void CallHandlerDescriptor::Initialize(Isolate* isolate) { |
| 244 Register registers[] = { |
| 245 rsi, // context |
| 246 rdx, // receiver |
| 247 }; |
| 248 Representation representations[] = { |
| 249 Representation::Tagged(), // context |
| 250 Representation::Tagged(), // receiver |
| 251 }; |
| 252 InitializeData(isolate, key(), arraysize(registers), registers, |
| 253 representations); |
| 254 } |
| 255 |
| 256 |
| 257 void ArgumentAdaptorDescriptor::Initialize(Isolate* isolate) { |
| 258 Register registers[] = { |
| 259 rsi, // context |
| 260 rdi, // JSFunction |
| 261 rax, // actual number of arguments |
| 262 rbx, // expected number of arguments |
| 263 }; |
| 264 Representation representations[] = { |
| 265 Representation::Tagged(), // context |
| 266 Representation::Tagged(), // JSFunction |
| 267 Representation::Integer32(), // actual number of arguments |
| 268 Representation::Integer32(), // expected number of arguments |
| 269 }; |
| 270 InitializeData(isolate, key(), arraysize(registers), registers, |
| 271 representations); |
| 272 } |
| 273 |
| 274 |
| 275 void ApiFunctionDescriptor::Initialize(Isolate* isolate) { |
| 276 Register registers[] = { |
| 277 rsi, // context |
| 278 rax, // callee |
| 279 rbx, // call_data |
| 280 rcx, // holder |
| 281 rdx, // api_function_address |
| 282 }; |
| 283 Representation representations[] = { |
| 284 Representation::Tagged(), // context |
| 285 Representation::Tagged(), // callee |
| 286 Representation::Tagged(), // call_data |
| 287 Representation::Tagged(), // holder |
| 288 Representation::External(), // api_function_address |
| 289 }; |
| 290 InitializeData(isolate, key(), arraysize(registers), registers, |
| 291 representations); |
243 } | 292 } |
244 } | 293 } |
245 } // namespace v8::internal | 294 } // namespace v8::internal |
246 | 295 |
247 #endif // V8_TARGET_ARCH_X64 | 296 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |