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