Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: src/interface-descriptors.cc

Issue 2301883002: CallInterfaceDescriptor should use MachineType (Closed)
Patch Set: Remove unneeded zone in the isolate. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interface-descriptors.h ('k') | src/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/interface-descriptors.h" 5 #include "src/interface-descriptors.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 9
10 namespace {
11 // Constructors for common combined semantic and representation types.
12 Type* SmiType(Zone* zone) {
13 return Type::Intersect(Type::SignedSmall(), Type::TaggedSigned(), zone);
14 }
15
16
17 Type* UntaggedIntegral32(Zone* zone) {
18 return Type::Intersect(Type::Signed32(), Type::UntaggedIntegral32(), zone);
19 }
20
21
22 Type* AnyTagged(Zone* zone) {
23 return Type::Intersect(
24 Type::Any(),
25 Type::Union(Type::TaggedPointer(), Type::TaggedSigned(), zone), zone);
26 }
27
28
29 Type* ExternalPointer(Zone* zone) {
30 return Type::Intersect(Type::Internal(), Type::UntaggedPointer(), zone);
31 }
32 } // namespace
33
34 FunctionType* CallInterfaceDescriptor::BuildDefaultFunctionType(
35 Isolate* isolate, int parameter_count) {
36 Zone* zone = isolate->interface_descriptor_zone();
37 FunctionType* function =
38 Type::Function(AnyTagged(zone), Type::Undefined(), parameter_count, zone)
39 ->AsFunction();
40 while (parameter_count-- != 0) {
41 function->InitParameter(parameter_count, AnyTagged(zone));
42 }
43 return function;
44 }
45 10
46 void CallInterfaceDescriptorData::InitializePlatformSpecific( 11 void CallInterfaceDescriptorData::InitializePlatformSpecific(
47 int register_parameter_count, const Register* registers, 12 int register_parameter_count, const Register* registers,
48 PlatformInterfaceDescriptor* platform_descriptor) { 13 PlatformInterfaceDescriptor* platform_descriptor) {
49 platform_specific_descriptor_ = platform_descriptor; 14 platform_specific_descriptor_ = platform_descriptor;
50 register_param_count_ = register_parameter_count; 15 register_param_count_ = register_parameter_count;
51 16
52 // InterfaceDescriptor owns a copy of the registers array. 17 // InterfaceDescriptor owns a copy of the registers array.
53 register_params_.reset(NewArray<Register>(register_parameter_count)); 18 register_params_.reset(NewArray<Register>(register_parameter_count));
54 for (int i = 0; i < register_parameter_count; i++) { 19 for (int i = 0; i < register_parameter_count; i++) {
55 register_params_[i] = registers[i]; 20 register_params_[i] = registers[i];
56 } 21 }
57 } 22 }
58 23
24 void CallInterfaceDescriptorData::InitializePlatformIndependent(
25 int parameter_count, int extra_parameter_count,
26 const MachineType* machine_types) {
27 // InterfaceDescriptor owns a copy of the MachineType array.
28 // We only care about parameters, not receiver and result.
29 param_count_ = parameter_count + extra_parameter_count;
30 machine_types_.reset(NewArray<MachineType>(param_count_));
31 for (int i = 0; i < param_count_; i++) {
32 if (machine_types == NULL || i >= parameter_count) {
33 machine_types_[i] = MachineType::AnyTagged();
34 } else {
35 machine_types_[i] = machine_types[i];
36 }
37 }
38 }
39
59 const char* CallInterfaceDescriptor::DebugName(Isolate* isolate) const { 40 const char* CallInterfaceDescriptor::DebugName(Isolate* isolate) const {
60 CallInterfaceDescriptorData* start = isolate->call_descriptor_data(0); 41 CallInterfaceDescriptorData* start = isolate->call_descriptor_data(0);
61 size_t index = data_ - start; 42 size_t index = data_ - start;
62 DCHECK(index < CallDescriptors::NUMBER_OF_DESCRIPTORS); 43 DCHECK(index < CallDescriptors::NUMBER_OF_DESCRIPTORS);
63 CallDescriptors::Key key = static_cast<CallDescriptors::Key>(index); 44 CallDescriptors::Key key = static_cast<CallDescriptors::Key>(index);
64 switch (key) { 45 switch (key) {
65 #define DEF_CASE(NAME) \ 46 #define DEF_CASE(NAME) \
66 case CallDescriptors::NAME: \ 47 case CallDescriptors::NAME: \
67 return #NAME " Descriptor"; 48 return #NAME " Descriptor";
68 INTERFACE_DESCRIPTOR_LIST(DEF_CASE) 49 INTERFACE_DESCRIPTOR_LIST(DEF_CASE)
69 #undef DEF_CASE 50 #undef DEF_CASE
70 case CallDescriptors::NUMBER_OF_DESCRIPTORS: 51 case CallDescriptors::NUMBER_OF_DESCRIPTORS:
71 break; 52 break;
72 } 53 }
73 return ""; 54 return "";
74 } 55 }
75 56
76 57
77 void VoidDescriptor::InitializePlatformSpecific( 58 void VoidDescriptor::InitializePlatformSpecific(
78 CallInterfaceDescriptorData* data) { 59 CallInterfaceDescriptorData* data) {
79 data->InitializePlatformSpecific(0, nullptr); 60 data->InitializePlatformSpecific(0, nullptr);
80 } 61 }
81 62
82 FunctionType* 63 void FastNewFunctionContextDescriptor::InitializePlatformIndependent(
83 FastNewFunctionContextDescriptor::BuildCallInterfaceDescriptorFunctionType( 64 CallInterfaceDescriptorData* data) {
84 Isolate* isolate, int parameter_count) { 65 MachineType machine_types[] = {MachineType::AnyTagged(),
85 Zone* zone = isolate->interface_descriptor_zone(); 66 MachineType::Int32()};
86 FunctionType* function = 67 data->InitializePlatformIndependent(arraysize(machine_types), 0,
87 Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction(); 68 machine_types);
88 function->InitParameter(0, AnyTagged(zone));
89 function->InitParameter(1, UntaggedIntegral32(zone));
90 return function;
91 } 69 }
92 70
93 void FastNewFunctionContextDescriptor::InitializePlatformSpecific( 71 void FastNewFunctionContextDescriptor::InitializePlatformSpecific(
94 CallInterfaceDescriptorData* data) { 72 CallInterfaceDescriptorData* data) {
95 Register registers[] = {FunctionRegister(), SlotsRegister()}; 73 Register registers[] = {FunctionRegister(), SlotsRegister()};
96 data->InitializePlatformSpecific(arraysize(registers), registers); 74 data->InitializePlatformSpecific(arraysize(registers), registers);
97 } 75 }
98 76
99 FunctionType* LoadDescriptor::BuildCallInterfaceDescriptorFunctionType( 77 void LoadDescriptor::InitializePlatformIndependent(
100 Isolate* isolate, int parameter_count) { 78 CallInterfaceDescriptorData* data) {
101 Zone* zone = isolate->interface_descriptor_zone(); 79 // kReceiver, kName, kSlot
102 FunctionType* function = 80 MachineType machine_types[] = {MachineType::AnyTagged(),
103 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 81 MachineType::AnyTagged(),
104 ->AsFunction(); 82 MachineType::TaggedSigned()};
105 function->InitParameter(kReceiver, AnyTagged(zone)); 83 data->InitializePlatformIndependent(arraysize(machine_types), 0,
106 function->InitParameter(kName, AnyTagged(zone)); 84 machine_types);
107 function->InitParameter(kSlot, SmiType(zone));
108 return function;
109 } 85 }
110 86
111
112 void LoadDescriptor::InitializePlatformSpecific( 87 void LoadDescriptor::InitializePlatformSpecific(
113 CallInterfaceDescriptorData* data) { 88 CallInterfaceDescriptorData* data) {
114 Register registers[] = {ReceiverRegister(), NameRegister(), SlotRegister()}; 89 Register registers[] = {ReceiverRegister(), NameRegister(), SlotRegister()};
115 data->InitializePlatformSpecific(arraysize(registers), registers); 90 data->InitializePlatformSpecific(arraysize(registers), registers);
116 } 91 }
117 92
118 FunctionType* LoadGlobalDescriptor::BuildCallInterfaceDescriptorFunctionType( 93 void LoadGlobalDescriptor::InitializePlatformIndependent(
119 Isolate* isolate, int parameter_count) { 94 CallInterfaceDescriptorData* data) {
120 Zone* zone = isolate->interface_descriptor_zone(); 95 // kSlot
121 FunctionType* function = 96 MachineType machine_types[] = {MachineType::TaggedSigned()};
122 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 97 data->InitializePlatformIndependent(arraysize(machine_types), 0,
123 ->AsFunction(); 98 machine_types);
124 function->InitParameter(kSlot, SmiType(zone));
125 return function;
126 } 99 }
127 100
128 void LoadGlobalDescriptor::InitializePlatformSpecific( 101 void LoadGlobalDescriptor::InitializePlatformSpecific(
129 CallInterfaceDescriptorData* data) { 102 CallInterfaceDescriptorData* data) {
130 Register registers[] = {LoadWithVectorDescriptor::SlotRegister()}; 103 Register registers[] = {LoadWithVectorDescriptor::SlotRegister()};
131 data->InitializePlatformSpecific(arraysize(registers), registers); 104 data->InitializePlatformSpecific(arraysize(registers), registers);
132 } 105 }
133 106
134 FunctionType* 107 void LoadGlobalWithVectorDescriptor::InitializePlatformIndependent(
135 LoadGlobalWithVectorDescriptor::BuildCallInterfaceDescriptorFunctionType( 108 CallInterfaceDescriptorData* data) {
136 Isolate* isolate, int parameter_count) { 109 // kSlot, kVector
137 Zone* zone = isolate->interface_descriptor_zone(); 110 MachineType machine_types[] = {MachineType::TaggedSigned(),
138 FunctionType* function = 111 MachineType::AnyTagged()};
139 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 112 data->InitializePlatformIndependent(arraysize(machine_types), 0,
140 ->AsFunction(); 113 machine_types);
141 function->InitParameter(kSlot, SmiType(zone));
142 function->InitParameter(kVector, AnyTagged(zone));
143 return function;
144 } 114 }
145 115
146 void LoadGlobalWithVectorDescriptor::InitializePlatformSpecific( 116 void LoadGlobalWithVectorDescriptor::InitializePlatformSpecific(
147 CallInterfaceDescriptorData* data) { 117 CallInterfaceDescriptorData* data) {
148 Register registers[] = {LoadWithVectorDescriptor::SlotRegister(), 118 Register registers[] = {LoadWithVectorDescriptor::SlotRegister(),
149 LoadWithVectorDescriptor::VectorRegister()}; 119 LoadWithVectorDescriptor::VectorRegister()};
150 data->InitializePlatformSpecific(arraysize(registers), registers); 120 data->InitializePlatformSpecific(arraysize(registers), registers);
151 } 121 }
152 122
153 FunctionType* StoreDescriptor::BuildCallInterfaceDescriptorFunctionType( 123 void StoreDescriptor::InitializePlatformIndependent(
154 Isolate* isolate, int parameter_count) { 124 CallInterfaceDescriptorData* data) {
155 Zone* zone = isolate->interface_descriptor_zone(); 125 // kReceiver, kName, kValue, kSlot
156 FunctionType* function = 126 MachineType machine_types[] = {
157 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 127 MachineType::AnyTagged(), MachineType::AnyTagged(),
158 ->AsFunction(); 128 MachineType::AnyTagged(), MachineType::TaggedSigned()};
159 function->InitParameter(kReceiver, AnyTagged(zone)); 129 data->InitializePlatformIndependent(arraysize(machine_types), 0,
160 function->InitParameter(kName, AnyTagged(zone)); 130 machine_types);
161 function->InitParameter(kValue, AnyTagged(zone));
162 function->InitParameter(kSlot, SmiType(zone));
163 return function;
164 } 131 }
165 132
166 void StoreDescriptor::InitializePlatformSpecific( 133 void StoreDescriptor::InitializePlatformSpecific(
167 CallInterfaceDescriptorData* data) { 134 CallInterfaceDescriptorData* data) {
168 Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(), 135 Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
169 SlotRegister()}; 136 SlotRegister()};
170 data->InitializePlatformSpecific(arraysize(registers), registers); 137 data->InitializePlatformSpecific(arraysize(registers), registers);
171 } 138 }
172 139
173 140
(...skipping 13 matching lines...) Expand all
187 MapRegister(), VectorRegister()}; 154 MapRegister(), VectorRegister()};
188 data->InitializePlatformSpecific(arraysize(registers), registers); 155 data->InitializePlatformSpecific(arraysize(registers), registers);
189 } else { 156 } else {
190 Register registers[] = {ReceiverRegister(), NameRegister(), 157 Register registers[] = {ReceiverRegister(), NameRegister(),
191 ValueRegister(), MapRegister(), 158 ValueRegister(), MapRegister(),
192 SlotRegister(), VectorRegister()}; 159 SlotRegister(), VectorRegister()};
193 data->InitializePlatformSpecific(arraysize(registers), registers); 160 data->InitializePlatformSpecific(arraysize(registers), registers);
194 } 161 }
195 } 162 }
196 163
197 FunctionType* 164 void StoreTransitionDescriptor::InitializePlatformIndependent(
198 StoreTransitionDescriptor::BuildCallInterfaceDescriptorFunctionType( 165 CallInterfaceDescriptorData* data) {
199 Isolate* isolate, int parameter_count) { 166 // kReceiver, kName, kValue, kMap
200 Zone* zone = isolate->interface_descriptor_zone(); 167 MachineType machine_types[] = {
201 FunctionType* function = 168 MachineType::AnyTagged(), MachineType::AnyTagged(),
202 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 169 MachineType::AnyTagged(), MachineType::AnyTagged()};
203 ->AsFunction(); 170 data->InitializePlatformIndependent(arraysize(machine_types), 0,
204 function->InitParameter(kReceiver, AnyTagged(zone)); 171 machine_types);
205 function->InitParameter(kName, AnyTagged(zone));
206 function->InitParameter(kValue, AnyTagged(zone));
207 function->InitParameter(kMap, AnyTagged(zone));
208 return function;
209 } 172 }
210 173
211 FunctionType* 174 void StoreGlobalViaContextDescriptor::InitializePlatformIndependent(
212 StoreGlobalViaContextDescriptor::BuildCallInterfaceDescriptorFunctionType( 175 CallInterfaceDescriptorData* data) {
213 Isolate* isolate, int parameter_count) { 176 // kSlot, kValue
214 Zone* zone = isolate->interface_descriptor_zone(); 177 MachineType machine_types[] = {MachineType::Int32(),
215 FunctionType* function = 178 MachineType::AnyTagged()};
216 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 179 data->InitializePlatformIndependent(arraysize(machine_types), 0,
217 ->AsFunction(); 180 machine_types);
218 function->InitParameter(kSlot, UntaggedIntegral32(zone));
219 function->InitParameter(kValue, AnyTagged(zone));
220 return function;
221 } 181 }
222 182
223
224 void StoreGlobalViaContextDescriptor::InitializePlatformSpecific( 183 void StoreGlobalViaContextDescriptor::InitializePlatformSpecific(
225 CallInterfaceDescriptorData* data) { 184 CallInterfaceDescriptorData* data) {
226 Register registers[] = {SlotRegister(), ValueRegister()}; 185 Register registers[] = {SlotRegister(), ValueRegister()};
227 data->InitializePlatformSpecific(arraysize(registers), registers); 186 data->InitializePlatformSpecific(arraysize(registers), registers);
228 } 187 }
229 188
230 189
231 void StringCompareDescriptor::InitializePlatformSpecific( 190 void StringCompareDescriptor::InitializePlatformSpecific(
232 CallInterfaceDescriptorData* data) { 191 CallInterfaceDescriptorData* data) {
233 Register registers[] = {LeftRegister(), RightRegister()}; 192 Register registers[] = {LeftRegister(), RightRegister()};
(...skipping 11 matching lines...) Expand all
245 Register registers[] = {exponent()}; 204 Register registers[] = {exponent()};
246 data->InitializePlatformSpecific(arraysize(registers), registers); 205 data->InitializePlatformSpecific(arraysize(registers), registers);
247 } 206 }
248 207
249 void MathPowIntegerDescriptor::InitializePlatformSpecific( 208 void MathPowIntegerDescriptor::InitializePlatformSpecific(
250 CallInterfaceDescriptorData* data) { 209 CallInterfaceDescriptorData* data) {
251 Register registers[] = {exponent()}; 210 Register registers[] = {exponent()};
252 data->InitializePlatformSpecific(arraysize(registers), registers); 211 data->InitializePlatformSpecific(arraysize(registers), registers);
253 } 212 }
254 213
255 FunctionType* 214 void LoadWithVectorDescriptor::InitializePlatformIndependent(
256 LoadWithVectorDescriptor::BuildCallInterfaceDescriptorFunctionType( 215 CallInterfaceDescriptorData* data) {
257 Isolate* isolate, int parameter_count) { 216 // kReceiver, kName, kSlot, kVector
258 Zone* zone = isolate->interface_descriptor_zone(); 217 MachineType machine_types[] = {
259 FunctionType* function = 218 MachineType::AnyTagged(), MachineType::AnyTagged(),
260 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 219 MachineType::TaggedSigned(), MachineType::AnyTagged()};
261 ->AsFunction(); 220 data->InitializePlatformIndependent(arraysize(machine_types), 0,
262 function->InitParameter(kReceiver, AnyTagged(zone)); 221 machine_types);
263 function->InitParameter(kName, AnyTagged(zone));
264 function->InitParameter(kSlot, SmiType(zone));
265 function->InitParameter(kVector, AnyTagged(zone));
266 return function;
267 } 222 }
268 223
269 224
270 void LoadWithVectorDescriptor::InitializePlatformSpecific( 225 void LoadWithVectorDescriptor::InitializePlatformSpecific(
271 CallInterfaceDescriptorData* data) { 226 CallInterfaceDescriptorData* data) {
272 Register registers[] = {ReceiverRegister(), NameRegister(), SlotRegister(), 227 Register registers[] = {ReceiverRegister(), NameRegister(), SlotRegister(),
273 VectorRegister()}; 228 VectorRegister()};
274 data->InitializePlatformSpecific(arraysize(registers), registers); 229 data->InitializePlatformSpecific(arraysize(registers), registers);
275 } 230 }
276 231
277 FunctionType* 232 void VectorStoreTransitionDescriptor::InitializePlatformIndependent(
278 VectorStoreTransitionDescriptor::BuildCallInterfaceDescriptorFunctionType( 233 CallInterfaceDescriptorData* data) {
279 Isolate* isolate, int parameter_count) {
280 Zone* zone = isolate->interface_descriptor_zone();
281 bool has_slot = !VectorStoreTransitionDescriptor::SlotRegister().is(no_reg); 234 bool has_slot = !VectorStoreTransitionDescriptor::SlotRegister().is(no_reg);
282 int arg_count = has_slot ? 6 : 5; 235
283 FunctionType* function =
284 Type::Function(AnyTagged(zone), Type::Undefined(), arg_count, zone)
285 ->AsFunction();
286 int index = 0;
287 // TODO(ishell): use ParameterIndices here
288 function->InitParameter(index++, AnyTagged(zone)); // receiver
289 function->InitParameter(index++, AnyTagged(zone)); // name
290 function->InitParameter(index++, AnyTagged(zone)); // value
291 function->InitParameter(index++, AnyTagged(zone)); // map
292 if (has_slot) { 236 if (has_slot) {
293 function->InitParameter(index++, SmiType(zone)); // slot 237 // kReceiver, kName, kValue, kMap, kSlot, kVector
238 MachineType machine_types[] = {
239 MachineType::AnyTagged(), MachineType::AnyTagged(),
240 MachineType::AnyTagged(), MachineType::AnyTagged(),
241 MachineType::TaggedSigned(), MachineType::AnyTagged()};
242 data->InitializePlatformIndependent(arraysize(machine_types), 0,
243 machine_types);
244 } else {
245 // kReceiver, kName, kValue, kMap, kVector
246 MachineType machine_types[] = {
247 MachineType::AnyTagged(), MachineType::AnyTagged(),
248 MachineType::AnyTagged(), MachineType::AnyTagged(),
249 MachineType::AnyTagged()};
250 data->InitializePlatformIndependent(arraysize(machine_types), 0,
251 machine_types);
294 } 252 }
295 function->InitParameter(index++, AnyTagged(zone)); // vector
296 return function;
297 } 253 }
298 254
299 FunctionType* 255 void StoreWithVectorDescriptor::InitializePlatformIndependent(
300 StoreWithVectorDescriptor::BuildCallInterfaceDescriptorFunctionType( 256 CallInterfaceDescriptorData* data) {
301 Isolate* isolate, int parameter_count) { 257 // kReceiver, kName, kValue, kSlot, kVector
302 Zone* zone = isolate->interface_descriptor_zone(); 258 MachineType machine_types[] = {
303 FunctionType* function = 259 MachineType::AnyTagged(), MachineType::AnyTagged(),
304 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 260 MachineType::AnyTagged(), MachineType::TaggedSigned(),
305 ->AsFunction(); 261 MachineType::AnyTagged()};
306 function->InitParameter(kReceiver, AnyTagged(zone)); 262 data->InitializePlatformIndependent(arraysize(machine_types), 0,
307 function->InitParameter(kName, AnyTagged(zone)); 263 machine_types);
308 function->InitParameter(kValue, AnyTagged(zone));
309 function->InitParameter(kSlot, SmiType(zone));
310 function->InitParameter(kVector, AnyTagged(zone));
311 return function;
312 } 264 }
313 265
314 void StoreWithVectorDescriptor::InitializePlatformSpecific( 266 void StoreWithVectorDescriptor::InitializePlatformSpecific(
315 CallInterfaceDescriptorData* data) { 267 CallInterfaceDescriptorData* data) {
316 Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(), 268 Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
317 SlotRegister(), VectorRegister()}; 269 SlotRegister(), VectorRegister()};
318 data->InitializePlatformSpecific(arraysize(registers), registers); 270 data->InitializePlatformSpecific(arraysize(registers), registers);
319 } 271 }
320 272
321 FunctionType* 273 void BinaryOpWithVectorDescriptor::InitializePlatformIndependent(
322 BinaryOpWithVectorDescriptor::BuildCallInterfaceDescriptorFunctionType( 274 CallInterfaceDescriptorData* data) {
323 Isolate* isolate, int parameter_count) { 275 // kLeft, kRight, kSlot, kVector
324 DCHECK_EQ(parameter_count, kParameterCount); 276 MachineType machine_types[] = {MachineType::AnyTagged(),
325 Zone* zone = isolate->interface_descriptor_zone(); 277 MachineType::AnyTagged(), MachineType::Int32(),
326 FunctionType* function = 278 MachineType::AnyTagged()};
327 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 279 data->InitializePlatformIndependent(arraysize(machine_types), 0,
328 ->AsFunction(); 280 machine_types);
329 function->InitParameter(kLeft, AnyTagged(zone));
330 function->InitParameter(kRight, AnyTagged(zone));
331 function->InitParameter(kSlot, UntaggedIntegral32(zone));
332 function->InitParameter(kVector, AnyTagged(zone));
333 return function;
334 } 281 }
335 282
336 const Register ApiGetterDescriptor::ReceiverRegister() { 283 const Register ApiGetterDescriptor::ReceiverRegister() {
337 return LoadDescriptor::ReceiverRegister(); 284 return LoadDescriptor::ReceiverRegister();
338 } 285 }
339 286
340 void ApiGetterDescriptor::InitializePlatformSpecific( 287 void ApiGetterDescriptor::InitializePlatformSpecific(
341 CallInterfaceDescriptorData* data) { 288 CallInterfaceDescriptorData* data) {
342 Register registers[] = {ReceiverRegister(), HolderRegister(), 289 Register registers[] = {ReceiverRegister(), HolderRegister(),
343 CallbackRegister()}; 290 CallbackRegister()};
(...skipping 21 matching lines...) Expand all
365 case 6: 312 case 6:
366 return OnStackWith6ArgsDescriptor(isolate); 313 return OnStackWith6ArgsDescriptor(isolate);
367 case 7: 314 case 7:
368 return OnStackWith7ArgsDescriptor(isolate); 315 return OnStackWith7ArgsDescriptor(isolate);
369 default: 316 default:
370 UNREACHABLE(); 317 UNREACHABLE();
371 return VoidDescriptor(isolate); 318 return VoidDescriptor(isolate);
372 } 319 }
373 } 320 }
374 321
375 FunctionType* 322 void OnStackArgsDescriptorBase::InitializePlatformIndependent(
376 OnStackArgsDescriptorBase::BuildCallInterfaceDescriptorFunctionTypeWithArg( 323 CallInterfaceDescriptorData* data) {
377 Isolate* isolate, int register_parameter_count, int parameter_count) { 324 data->InitializePlatformIndependent(0, extra_args(), NULL);
378 DCHECK_EQ(0, register_parameter_count);
379 DCHECK_GT(parameter_count, 0);
380 Zone* zone = isolate->interface_descriptor_zone();
381 FunctionType* function =
382 Type::Function(AnyTagged(zone), AnyTagged(zone), parameter_count, zone)
383 ->AsFunction();
384 for (int i = 0; i < parameter_count; i++) {
385 function->InitParameter(i, AnyTagged(zone));
386 }
387 return function;
388 } 325 }
389 326
390 void OnStackArgsDescriptorBase::InitializePlatformSpecific( 327 void OnStackArgsDescriptorBase::InitializePlatformSpecific(
391 CallInterfaceDescriptorData* data) { 328 CallInterfaceDescriptorData* data) {
392 data->InitializePlatformSpecific(0, nullptr); 329 data->InitializePlatformSpecific(0, nullptr);
393 } 330 }
394 331
395 void GrowArrayElementsDescriptor::InitializePlatformSpecific( 332 void GrowArrayElementsDescriptor::InitializePlatformSpecific(
396 CallInterfaceDescriptorData* data) { 333 CallInterfaceDescriptorData* data) {
397 Register registers[] = {ObjectRegister(), KeyRegister()}; 334 Register registers[] = {ObjectRegister(), KeyRegister()};
398 data->InitializePlatformSpecific(arraysize(registers), registers); 335 data->InitializePlatformSpecific(arraysize(registers), registers);
399 } 336 }
400 337
401 FunctionType* 338 void VarArgFunctionDescriptor::InitializePlatformIndependent(
402 VarArgFunctionDescriptor::BuildCallInterfaceDescriptorFunctionType( 339 CallInterfaceDescriptorData* data) {
403 Isolate* isolate, int parameter_count) { 340 // kActualArgumentsCount
404 Zone* zone = isolate->interface_descriptor_zone(); 341 MachineType machine_types[] = {MachineType::Int32()};
405 FunctionType* function = 342 data->InitializePlatformIndependent(arraysize(machine_types), 0,
406 Type::Function(AnyTagged(zone), AnyTagged(zone), kParameterCount, zone) 343 machine_types);
407 ->AsFunction();
408 function->InitParameter(kActualArgumentsCount, UntaggedIntegral32(zone));
409 return function;
410 } 344 }
411 345
412 FunctionType* 346 void FastCloneRegExpDescriptor::InitializePlatformIndependent(
413 FastCloneRegExpDescriptor::BuildCallInterfaceDescriptorFunctionType( 347 CallInterfaceDescriptorData* data) {
414 Isolate* isolate, int parameter_count) { 348 // kClosure, kLiteralIndex, kPattern, kFlags
415 Zone* zone = isolate->interface_descriptor_zone(); 349 MachineType machine_types[] = {
416 FunctionType* function = 350 MachineType::AnyTagged(), MachineType::TaggedSigned(),
417 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 351 MachineType::AnyTagged(), MachineType::AnyTagged()};
418 ->AsFunction(); 352 data->InitializePlatformIndependent(arraysize(machine_types), 0,
419 function->InitParameter(kClosure, AnyTagged(zone)); 353 machine_types);
420 function->InitParameter(kLiteralIndex, SmiType(zone));
421 function->InitParameter(kPattern, AnyTagged(zone));
422 function->InitParameter(kFlags, AnyTagged(zone));
423 return function;
424 } 354 }
425 355
426 FunctionType* 356 void FastCloneShallowArrayDescriptor::InitializePlatformIndependent(
427 FastCloneShallowArrayDescriptor::BuildCallInterfaceDescriptorFunctionType( 357 CallInterfaceDescriptorData* data) {
428 Isolate* isolate, int parameter_count) { 358 // kClosure, kLiteralIndex, kConstantElements
429 Zone* zone = isolate->interface_descriptor_zone(); 359 MachineType machine_types[] = {MachineType::AnyTagged(),
430 FunctionType* function = 360 MachineType::TaggedSigned(),
431 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 361 MachineType::AnyTagged()};
432 ->AsFunction(); 362 data->InitializePlatformIndependent(arraysize(machine_types), 0,
433 function->InitParameter(kClosure, AnyTagged(zone)); 363 machine_types);
434 function->InitParameter(kLiteralIndex, SmiType(zone));
435 function->InitParameter(kConstantElements, AnyTagged(zone));
436 return function;
437 } 364 }
438 365
439 FunctionType* 366 void CreateAllocationSiteDescriptor::InitializePlatformIndependent(
440 CreateAllocationSiteDescriptor::BuildCallInterfaceDescriptorFunctionType( 367 CallInterfaceDescriptorData* data) {
441 Isolate* isolate, int parameter_count) { 368 // kVector, kSlot
442 Zone* zone = isolate->interface_descriptor_zone(); 369 MachineType machine_types[] = {MachineType::AnyTagged(),
443 FunctionType* function = 370 MachineType::TaggedSigned()};
444 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 371 data->InitializePlatformIndependent(arraysize(machine_types), 0,
445 ->AsFunction(); 372 machine_types);
446 function->InitParameter(kVector, AnyTagged(zone));
447 function->InitParameter(kSlot, SmiType(zone));
448 return function;
449 } 373 }
450 374
451 FunctionType* 375 void CreateWeakCellDescriptor::InitializePlatformIndependent(
452 CreateWeakCellDescriptor::BuildCallInterfaceDescriptorFunctionType( 376 CallInterfaceDescriptorData* data) {
453 Isolate* isolate, int parameter_count) { 377 // kVector, kSlot, kValue
454 Zone* zone = isolate->interface_descriptor_zone(); 378 MachineType machine_types[] = {MachineType::AnyTagged(),
455 FunctionType* function = 379 MachineType::TaggedSigned(),
456 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 380 MachineType::AnyTagged()};
457 ->AsFunction(); 381 data->InitializePlatformIndependent(arraysize(machine_types), 0,
458 function->InitParameter(kVector, AnyTagged(zone)); 382 machine_types);
459 function->InitParameter(kSlot, SmiType(zone));
460 function->InitParameter(kValue, AnyTagged(zone));
461 return function;
462 } 383 }
463 384
464 FunctionType* 385 void CallTrampolineDescriptor::InitializePlatformIndependent(
465 CallTrampolineDescriptor::BuildCallInterfaceDescriptorFunctionType( 386 CallInterfaceDescriptorData* data) {
466 Isolate* isolate, int parameter_count) { 387 // kFunction, kActualArgumentsCount
467 Zone* zone = isolate->interface_descriptor_zone(); 388 MachineType machine_types[] = {MachineType::AnyTagged(),
468 FunctionType* function = 389 MachineType::Int32()};
469 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 390 data->InitializePlatformIndependent(arraysize(machine_types), 0,
470 ->AsFunction(); 391 machine_types);
471 function->InitParameter(kFunction, AnyTagged(zone));
472 function->InitParameter(kActualArgumentsCount, UntaggedIntegral32(zone));
473 return function;
474 } 392 }
475 393
476 FunctionType* ConstructStubDescriptor::BuildCallInterfaceDescriptorFunctionType( 394 void ConstructStubDescriptor::InitializePlatformIndependent(
477 Isolate* isolate, int parameter_count) { 395 CallInterfaceDescriptorData* data) {
478 Zone* zone = isolate->interface_descriptor_zone(); 396 // kFunction, kNewTarget, kActualArgumentsCount, kAllocationSite
479 FunctionType* function = 397 MachineType machine_types[] = {MachineType::AnyTagged(),
480 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 398 MachineType::AnyTagged(), MachineType::Int32(),
481 ->AsFunction(); 399 MachineType::AnyTagged()};
482 function->InitParameter(kFunction, AnyTagged(zone)); 400 data->InitializePlatformIndependent(arraysize(machine_types), 0,
483 function->InitParameter(kNewTarget, AnyTagged(zone)); 401 machine_types);
484 function->InitParameter(kActualArgumentsCount, UntaggedIntegral32(zone));
485 function->InitParameter(kAllocationSite, AnyTagged(zone));
486 return function;
487 } 402 }
488 403
489 FunctionType* 404 void ConstructTrampolineDescriptor::InitializePlatformIndependent(
490 ConstructTrampolineDescriptor::BuildCallInterfaceDescriptorFunctionType( 405 CallInterfaceDescriptorData* data) {
491 Isolate* isolate, int parameter_count) { 406 // kFunction, kNewTarget, kActualArgumentsCount
492 Zone* zone = isolate->interface_descriptor_zone(); 407 MachineType machine_types[] = {
493 FunctionType* function = 408 MachineType::AnyTagged(), MachineType::AnyTagged(), MachineType::Int32()};
494 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 409 data->InitializePlatformIndependent(arraysize(machine_types), 0,
495 ->AsFunction(); 410 machine_types);
496 function->InitParameter(kFunction, AnyTagged(zone));
497 function->InitParameter(kNewTarget, AnyTagged(zone));
498 function->InitParameter(kActualArgumentsCount, UntaggedIntegral32(zone));
499 return function;
500 } 411 }
501 412
502 FunctionType* 413 void CallFunctionWithFeedbackDescriptor::InitializePlatformIndependent(
503 CallFunctionWithFeedbackDescriptor::BuildCallInterfaceDescriptorFunctionType( 414 CallInterfaceDescriptorData* data) {
504 Isolate* isolate, int parameter_count) { 415 // kFunction, kSlot
505 Zone* zone = isolate->interface_descriptor_zone(); 416 MachineType machine_types[] = {MachineType::AnyTagged(),
506 FunctionType* function = 417 MachineType::TaggedSigned()};
507 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 418 data->InitializePlatformIndependent(arraysize(machine_types), 0,
508 ->AsFunction(); 419 machine_types);
509 function->InitParameter(kFunction, Type::Receiver());
510 function->InitParameter(kSlot, SmiType(zone));
511 return function;
512 } 420 }
513 421
514 FunctionType* CallFunctionWithFeedbackAndVectorDescriptor:: 422 void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformIndependent(
515 BuildCallInterfaceDescriptorFunctionType(Isolate* isolate, 423 CallInterfaceDescriptorData* data) {
516 int parameter_count) { 424 // kFunction, kSlot, kVector
517 Zone* zone = isolate->interface_descriptor_zone(); 425 MachineType machine_types[] = {MachineType::TaggedPointer(),
518 FunctionType* function = 426 MachineType::TaggedSigned(),
519 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 427 MachineType::AnyTagged()};
520 ->AsFunction(); 428 data->InitializePlatformIndependent(arraysize(machine_types), 0,
521 function->InitParameter(kFunction, Type::Receiver()); 429 machine_types);
522 function->InitParameter(kSlot, SmiType(zone));
523 function->InitParameter(kVector, AnyTagged(zone));
524 return function;
525 } 430 }
526 431
527 FunctionType* 432 void ArrayNoArgumentConstructorDescriptor::InitializePlatformIndependent(
528 ArrayNoArgumentConstructorDescriptor::BuildCallInterfaceDescriptorFunctionType( 433 CallInterfaceDescriptorData* data) {
529 Isolate* isolate, int parameter_count) { 434 // kFunction, kAllocationSite, kActualArgumentsCount, kFunctionParameter
530 Zone* zone = isolate->interface_descriptor_zone(); 435 MachineType machine_types[] = {MachineType::TaggedPointer(),
531 FunctionType* function = 436 MachineType::AnyTagged(), MachineType::Int32(),
532 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 437 MachineType::AnyTagged()};
533 ->AsFunction(); 438 data->InitializePlatformIndependent(arraysize(machine_types), 0,
534 function->InitParameter(kFunction, Type::Receiver()); 439 machine_types);
535 function->InitParameter(kAllocationSite, AnyTagged(zone));
536 function->InitParameter(kActualArgumentsCount, UntaggedIntegral32(zone));
537 function->InitParameter(kFunctionParameter, AnyTagged(zone));
538 return function;
539 } 440 }
540 441
541 FunctionType* ArraySingleArgumentConstructorDescriptor:: 442 void ArraySingleArgumentConstructorDescriptor::InitializePlatformIndependent(
542 BuildCallInterfaceDescriptorFunctionType(Isolate* isolate, 443 CallInterfaceDescriptorData* data) {
543 int parameter_count) { 444 // kFunction, kAllocationSite, kActualArgumentsCount, kFunctionParameter,
544 Zone* zone = isolate->interface_descriptor_zone(); 445 // kArraySizeSmiParameter
545 FunctionType* function = 446 MachineType machine_types[] = {
546 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 447 MachineType::TaggedPointer(), MachineType::AnyTagged(),
547 ->AsFunction(); 448 MachineType::Int32(), MachineType::AnyTagged(), MachineType::AnyTagged()};
548 function->InitParameter(kFunction, Type::Receiver()); 449 data->InitializePlatformIndependent(arraysize(machine_types), 0,
549 function->InitParameter(kAllocationSite, AnyTagged(zone)); 450 machine_types);
550 function->InitParameter(kActualArgumentsCount, UntaggedIntegral32(zone));
551 function->InitParameter(kFunctionParameter, AnyTagged(zone));
552 function->InitParameter(kArraySizeSmiParameter, AnyTagged(zone));
553 return function;
554 } 451 }
555 452
556 FunctionType* 453 void ArrayNArgumentsConstructorDescriptor::InitializePlatformIndependent(
557 ArrayNArgumentsConstructorDescriptor::BuildCallInterfaceDescriptorFunctionType( 454 CallInterfaceDescriptorData* data) {
558 Isolate* isolate, int parameter_count) { 455 // kFunction, kAllocationSite, kActualArgumentsCount
559 Zone* zone = isolate->interface_descriptor_zone(); 456 MachineType machine_types[] = {MachineType::TaggedPointer(),
560 FunctionType* function = 457 MachineType::AnyTagged(),
561 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 458 MachineType::Int32()};
562 ->AsFunction(); 459 data->InitializePlatformIndependent(arraysize(machine_types), 0,
563 function->InitParameter(kFunction, Type::Receiver()); 460 machine_types);
564 function->InitParameter(kAllocationSite, AnyTagged(zone));
565 function->InitParameter(kActualArgumentsCount, UntaggedIntegral32(zone));
566 return function;
567 } 461 }
568 462
569 FunctionType* 463 void ArgumentAdaptorDescriptor::InitializePlatformIndependent(
570 ArgumentAdaptorDescriptor::BuildCallInterfaceDescriptorFunctionType( 464 CallInterfaceDescriptorData* data) {
571 Isolate* isolate, int parameter_count) { 465 // kFunction, kNewTarget, kActualArgumentsCount, kExpectedArgumentsCount
572 Zone* zone = isolate->interface_descriptor_zone(); 466 MachineType machine_types[] = {MachineType::TaggedPointer(),
573 FunctionType* function = 467 MachineType::AnyTagged(), MachineType::Int32(),
574 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 468 MachineType::Int32()};
575 ->AsFunction(); 469 data->InitializePlatformIndependent(arraysize(machine_types), 0,
576 function->InitParameter(kFunction, Type::Receiver()); 470 machine_types);
577 function->InitParameter(kNewTarget, AnyTagged(zone));
578 function->InitParameter(kActualArgumentsCount, UntaggedIntegral32(zone));
579 function->InitParameter(kExpectedArgumentsCount, UntaggedIntegral32(zone));
580 return function;
581 } 471 }
582 472
583 CallInterfaceDescriptor ApiCallbackDescriptorBase::ForArgs(Isolate* isolate, 473 CallInterfaceDescriptor ApiCallbackDescriptorBase::ForArgs(Isolate* isolate,
584 int argc) { 474 int argc) {
585 switch (argc) { 475 switch (argc) {
586 case 0: 476 case 0:
587 return ApiCallbackWith0ArgsDescriptor(isolate); 477 return ApiCallbackWith0ArgsDescriptor(isolate);
588 case 1: 478 case 1:
589 return ApiCallbackWith1ArgsDescriptor(isolate); 479 return ApiCallbackWith1ArgsDescriptor(isolate);
590 case 2: 480 case 2:
591 return ApiCallbackWith2ArgsDescriptor(isolate); 481 return ApiCallbackWith2ArgsDescriptor(isolate);
592 case 3: 482 case 3:
593 return ApiCallbackWith3ArgsDescriptor(isolate); 483 return ApiCallbackWith3ArgsDescriptor(isolate);
594 case 4: 484 case 4:
595 return ApiCallbackWith4ArgsDescriptor(isolate); 485 return ApiCallbackWith4ArgsDescriptor(isolate);
596 case 5: 486 case 5:
597 return ApiCallbackWith5ArgsDescriptor(isolate); 487 return ApiCallbackWith5ArgsDescriptor(isolate);
598 case 6: 488 case 6:
599 return ApiCallbackWith6ArgsDescriptor(isolate); 489 return ApiCallbackWith6ArgsDescriptor(isolate);
600 case 7: 490 case 7:
601 return ApiCallbackWith7ArgsDescriptor(isolate); 491 return ApiCallbackWith7ArgsDescriptor(isolate);
602 default: 492 default:
603 UNREACHABLE(); 493 UNREACHABLE();
604 return VoidDescriptor(isolate); 494 return VoidDescriptor(isolate);
605 } 495 }
606 } 496 }
607 497
608 FunctionType* 498 void ApiCallbackDescriptorBase::InitializePlatformIndependent(
609 ApiCallbackDescriptorBase::BuildCallInterfaceDescriptorFunctionTypeWithArg( 499 CallInterfaceDescriptorData* data) {
610 Isolate* isolate, int parameter_count, int argc) { 500 // kFunction, kCallData, kHolder, kApiFunctionAddress
611 Zone* zone = isolate->interface_descriptor_zone(); 501 MachineType machine_types[] = {
612 FunctionType* function = Type::Function(AnyTagged(zone), Type::Undefined(), 502 MachineType::AnyTagged(), MachineType::AnyTagged(),
613 kParameterCount + argc, zone) 503 MachineType::AnyTagged(), MachineType::Pointer()};
614 ->AsFunction(); 504 data->InitializePlatformIndependent(arraysize(machine_types), extra_args(),
615 function->InitParameter(kFunction, AnyTagged(zone)); 505 machine_types);
616 function->InitParameter(kCallData, AnyTagged(zone));
617 function->InitParameter(kHolder, AnyTagged(zone));
618 function->InitParameter(kApiFunctionAddress, ExternalPointer(zone));
619 for (int i = 0; i < argc; i++) {
620 function->InitParameter(i, AnyTagged(zone));
621 }
622 return function;
623 } 506 }
624 507
625 FunctionType* 508 void InterpreterDispatchDescriptor::InitializePlatformIndependent(
626 InterpreterDispatchDescriptor::BuildCallInterfaceDescriptorFunctionType( 509 CallInterfaceDescriptorData* data) {
627 Isolate* isolate, int parameter_count) { 510 // kAccumulator, kBytecodeOffset, kBytecodeArray, kDispatchTable
628 Zone* zone = isolate->interface_descriptor_zone(); 511 MachineType machine_types[] = {MachineType::AnyTagged(), MachineType::Int32(),
629 FunctionType* function = 512 MachineType::AnyTagged(),
630 Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone) 513 MachineType::AnyTagged()};
631 ->AsFunction(); 514 data->InitializePlatformIndependent(arraysize(machine_types), 0,
632 function->InitParameter(kAccumulator, AnyTagged(zone)); 515 machine_types);
633 function->InitParameter(kBytecodeOffset, UntaggedIntegral32(zone));
634 function->InitParameter(kBytecodeArray, AnyTagged(zone));
635 function->InitParameter(kDispatchTable, AnyTagged(zone));
636 return function;
637 } 516 }
638 517
639 } // namespace internal 518 } // namespace internal
640 } // namespace v8 519 } // namespace v8
OLDNEW
« no previous file with comments | « src/interface-descriptors.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698