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