Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 5 | #include "src/interface-descriptors.h" |
| 6 | |
| 7 | namespace v8 { |
| 8 | namespace internal { |
| 9 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 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 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 34 | FunctionType* CallInterfaceDescriptor::BuildDefaultFunctionType( |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 35 | Isolate* isolate, int parameter_count) { |
| 36 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 37 | FunctionType* function = |
| 38 | Type::Function(AnyTagged(zone), Type::Undefined(), parameter_count, zone) |
| 39 | ->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 40 | while (parameter_count-- != 0) { |
| 41 | function->InitParameter(parameter_count, AnyTagged(zone)); |
| 42 | } |
| 43 | return function; |
| 44 | } |
| 45 | |
| 46 | |
| 47 | void CallInterfaceDescriptorData::InitializePlatformSpecific( |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 48 | int register_parameter_count, Register* registers, |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 49 | PlatformInterfaceDescriptor* platform_descriptor) { |
| 50 | platform_specific_descriptor_ = platform_descriptor; |
| 51 | register_param_count_ = register_parameter_count; |
| 52 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 53 | // InterfaceDescriptor owns a copy of the registers array. |
| 54 | register_params_.Reset(NewArray<Register>(register_parameter_count)); |
| 55 | for (int i = 0; i < register_parameter_count; i++) { |
| 56 | register_params_[i] = registers[i]; |
| 57 | } |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 58 | } |
| 59 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 60 | const char* CallInterfaceDescriptor::DebugName(Isolate* isolate) const { |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 61 | CallInterfaceDescriptorData* start = isolate->call_descriptor_data(0); |
| 62 | size_t index = data_ - start; |
| 63 | DCHECK(index < CallDescriptors::NUMBER_OF_DESCRIPTORS); |
| 64 | CallDescriptors::Key key = static_cast<CallDescriptors::Key>(index); |
| 65 | switch (key) { |
| 66 | #define DEF_CASE(NAME) \ |
| 67 | case CallDescriptors::NAME: \ |
| 68 | return #NAME " Descriptor"; |
| 69 | INTERFACE_DESCRIPTOR_LIST(DEF_CASE) |
| 70 | #undef DEF_CASE |
| 71 | case CallDescriptors::NUMBER_OF_DESCRIPTORS: |
| 72 | break; |
| 73 | } |
| 74 | return ""; |
| 75 | } |
| 76 | |
| 77 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 78 | void AllocateMutableHeapNumberDescriptor::InitializePlatformSpecific( |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 79 | CallInterfaceDescriptorData* data) { |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 80 | data->InitializePlatformSpecific(0, nullptr, nullptr); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 84 | void VoidDescriptor::InitializePlatformSpecific( |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 85 | CallInterfaceDescriptorData* data) { |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 86 | data->InitializePlatformSpecific(0, nullptr); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 87 | } |
| 88 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 89 | FunctionType* LoadDescriptor::BuildCallInterfaceDescriptorFunctionType( |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 90 | Isolate* isolate, int paramater_count) { |
| 91 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 92 | FunctionType* function = |
| 93 | Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 94 | function->InitParameter(0, AnyTagged(zone)); |
| 95 | function->InitParameter(1, AnyTagged(zone)); |
| 96 | function->InitParameter(2, SmiType(zone)); |
| 97 | return function; |
| 98 | } |
| 99 | |
| 100 | |
| 101 | void LoadDescriptor::InitializePlatformSpecific( |
| 102 | CallInterfaceDescriptorData* data) { |
| 103 | Register registers[] = {ReceiverRegister(), NameRegister(), SlotRegister()}; |
| 104 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 105 | } |
| 106 | |
| 107 | |
| 108 | void StoreDescriptor::InitializePlatformSpecific( |
| 109 | CallInterfaceDescriptorData* data) { |
| 110 | Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister()}; |
| 111 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 112 | } |
| 113 | |
| 114 | |
| 115 | void StoreTransitionDescriptor::InitializePlatformSpecific( |
| 116 | CallInterfaceDescriptorData* data) { |
| 117 | Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(), |
| 118 | MapRegister()}; |
| 119 | |
| 120 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 121 | } |
| 122 | |
| 123 | |
| 124 | void VectorStoreTransitionDescriptor::InitializePlatformSpecific( |
| 125 | CallInterfaceDescriptorData* data) { |
| 126 | if (SlotRegister().is(no_reg)) { |
| 127 | Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(), |
| 128 | MapRegister(), VectorRegister()}; |
| 129 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 130 | } else { |
| 131 | Register registers[] = {ReceiverRegister(), NameRegister(), |
| 132 | ValueRegister(), MapRegister(), |
| 133 | SlotRegister(), VectorRegister()}; |
| 134 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 135 | } |
| 136 | } |
| 137 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 138 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 139 | StoreTransitionDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 140 | Isolate* isolate, int paramater_count) { |
| 141 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 142 | FunctionType* function = |
| 143 | Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 144 | function->InitParameter(0, AnyTagged(zone)); // Receiver |
| 145 | function->InitParameter(1, AnyTagged(zone)); // Name |
| 146 | function->InitParameter(2, AnyTagged(zone)); // Value |
| 147 | function->InitParameter(3, AnyTagged(zone)); // Map |
| 148 | return function; |
| 149 | } |
| 150 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 151 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 152 | LoadGlobalViaContextDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 153 | Isolate* isolate, int paramater_count) { |
| 154 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 155 | FunctionType* function = |
| 156 | Type::Function(AnyTagged(zone), Type::Undefined(), 1, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 157 | function->InitParameter(0, UntaggedIntegral32(zone)); |
| 158 | return function; |
| 159 | } |
| 160 | |
| 161 | |
| 162 | void LoadGlobalViaContextDescriptor::InitializePlatformSpecific( |
| 163 | CallInterfaceDescriptorData* data) { |
| 164 | Register registers[] = {SlotRegister()}; |
| 165 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 166 | } |
| 167 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 168 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 169 | StoreGlobalViaContextDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 170 | Isolate* isolate, int paramater_count) { |
| 171 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 172 | FunctionType* function = |
| 173 | Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 174 | function->InitParameter(0, UntaggedIntegral32(zone)); |
| 175 | function->InitParameter(1, AnyTagged(zone)); |
| 176 | return function; |
| 177 | } |
| 178 | |
| 179 | |
| 180 | void StoreGlobalViaContextDescriptor::InitializePlatformSpecific( |
| 181 | CallInterfaceDescriptorData* data) { |
| 182 | Register registers[] = {SlotRegister(), ValueRegister()}; |
| 183 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 184 | } |
| 185 | |
| 186 | |
| 187 | void InstanceOfDescriptor::InitializePlatformSpecific( |
| 188 | CallInterfaceDescriptorData* data) { |
| 189 | Register registers[] = {LeftRegister(), RightRegister()}; |
| 190 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 191 | } |
| 192 | |
| 193 | |
| 194 | void StringCompareDescriptor::InitializePlatformSpecific( |
| 195 | CallInterfaceDescriptorData* data) { |
| 196 | Register registers[] = {LeftRegister(), RightRegister()}; |
| 197 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 198 | } |
| 199 | |
| 200 | |
| 201 | void ToLengthDescriptor::InitializePlatformSpecific( |
| 202 | CallInterfaceDescriptorData* data) { |
| 203 | Register registers[] = {ReceiverRegister()}; |
| 204 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 205 | } |
| 206 | |
| 207 | |
| 208 | void ToStringDescriptor::InitializePlatformSpecific( |
| 209 | CallInterfaceDescriptorData* data) { |
| 210 | Register registers[] = {ReceiverRegister()}; |
| 211 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 212 | } |
| 213 | |
| 214 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 215 | void ToNameDescriptor::InitializePlatformSpecific( |
| 216 | CallInterfaceDescriptorData* data) { |
| 217 | Register registers[] = {ReceiverRegister()}; |
| 218 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 219 | } |
| 220 | |
| 221 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 222 | void ToObjectDescriptor::InitializePlatformSpecific( |
| 223 | CallInterfaceDescriptorData* data) { |
| 224 | Register registers[] = {ReceiverRegister()}; |
| 225 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 226 | } |
| 227 | |
| 228 | |
| 229 | void MathPowTaggedDescriptor::InitializePlatformSpecific( |
| 230 | CallInterfaceDescriptorData* data) { |
| 231 | Register registers[] = {exponent()}; |
| 232 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 233 | } |
| 234 | |
| 235 | |
| 236 | void MathPowIntegerDescriptor::InitializePlatformSpecific( |
| 237 | CallInterfaceDescriptorData* data) { |
| 238 | Register registers[] = {exponent()}; |
| 239 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 240 | } |
| 241 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 242 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 243 | LoadWithVectorDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 244 | Isolate* isolate, int paramater_count) { |
| 245 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 246 | FunctionType* function = |
| 247 | Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 248 | function->InitParameter(0, AnyTagged(zone)); |
| 249 | function->InitParameter(1, AnyTagged(zone)); |
| 250 | function->InitParameter(2, SmiType(zone)); |
| 251 | function->InitParameter(3, AnyTagged(zone)); |
| 252 | return function; |
| 253 | } |
| 254 | |
| 255 | |
| 256 | void LoadWithVectorDescriptor::InitializePlatformSpecific( |
| 257 | CallInterfaceDescriptorData* data) { |
| 258 | Register registers[] = {ReceiverRegister(), NameRegister(), SlotRegister(), |
| 259 | VectorRegister()}; |
| 260 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 261 | } |
| 262 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 263 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 264 | VectorStoreTransitionDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 265 | Isolate* isolate, int paramater_count) { |
| 266 | Zone* zone = isolate->interface_descriptor_zone(); |
| 267 | bool has_slot = !VectorStoreTransitionDescriptor::SlotRegister().is(no_reg); |
| 268 | int arg_count = has_slot ? 6 : 5; |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 269 | FunctionType* function = |
| 270 | Type::Function(AnyTagged(zone), Type::Undefined(), arg_count, zone) |
| 271 | ->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 272 | int index = 0; |
| 273 | function->InitParameter(index++, AnyTagged(zone)); // receiver |
| 274 | function->InitParameter(index++, AnyTagged(zone)); // name |
| 275 | function->InitParameter(index++, AnyTagged(zone)); // value |
| 276 | function->InitParameter(index++, AnyTagged(zone)); // map |
| 277 | if (has_slot) { |
| 278 | function->InitParameter(index++, SmiType(zone)); // slot |
| 279 | } |
| 280 | function->InitParameter(index++, AnyTagged(zone)); // vector |
| 281 | return function; |
| 282 | } |
| 283 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 284 | FunctionType* VectorStoreICDescriptor::BuildCallInterfaceDescriptorFunctionType( |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 285 | Isolate* isolate, int paramater_count) { |
| 286 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 287 | FunctionType* function = |
| 288 | Type::Function(AnyTagged(zone), Type::Undefined(), 5, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 289 | function->InitParameter(0, AnyTagged(zone)); |
| 290 | function->InitParameter(1, AnyTagged(zone)); |
| 291 | function->InitParameter(2, AnyTagged(zone)); |
| 292 | function->InitParameter(3, SmiType(zone)); |
| 293 | function->InitParameter(4, AnyTagged(zone)); |
| 294 | return function; |
| 295 | } |
| 296 | |
| 297 | |
| 298 | void VectorStoreICDescriptor::InitializePlatformSpecific( |
| 299 | CallInterfaceDescriptorData* data) { |
| 300 | Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(), |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 301 | SlotRegister(), VectorRegister()}; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 302 | data->InitializePlatformSpecific(arraysize(registers), registers); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 303 | } |
| 304 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 305 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 306 | VectorStoreICTrampolineDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 307 | Isolate* isolate, int paramater_count) { |
| 308 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 309 | FunctionType* function = |
| 310 | Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 311 | function->InitParameter(0, AnyTagged(zone)); |
| 312 | function->InitParameter(1, AnyTagged(zone)); |
| 313 | function->InitParameter(2, AnyTagged(zone)); |
| 314 | function->InitParameter(3, SmiType(zone)); |
| 315 | return function; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 316 | } |
| 317 | |
| 318 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 319 | void VectorStoreICTrampolineDescriptor::InitializePlatformSpecific( |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 320 | CallInterfaceDescriptorData* data) { |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 321 | Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(), |
| 322 | SlotRegister()}; |
| 323 | data->InitializePlatformSpecific(arraysize(registers), registers); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 324 | } |
| 325 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 326 | FunctionType* ApiGetterDescriptor::BuildCallInterfaceDescriptorFunctionType( |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 327 | Isolate* isolate, int paramater_count) { |
| 328 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 329 | FunctionType* function = |
| 330 | Type::Function(AnyTagged(zone), Type::Undefined(), 1, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 331 | function->InitParameter(0, ExternalPointer(zone)); |
| 332 | return function; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 333 | } |
| 334 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 335 | |
| 336 | void ApiGetterDescriptor::InitializePlatformSpecific( |
| 337 | CallInterfaceDescriptorData* data) { |
| 338 | Register registers[] = {function_address()}; |
| 339 | data->InitializePlatformSpecific(arraysize(registers), registers); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 340 | } |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 341 | |
| 342 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 343 | void ContextOnlyDescriptor::InitializePlatformSpecific( |
| 344 | CallInterfaceDescriptorData* data) { |
| 345 | data->InitializePlatformSpecific(0, nullptr); |
| 346 | } |
| 347 | |
| 348 | |
| 349 | void GrowArrayElementsDescriptor::InitializePlatformSpecific( |
| 350 | CallInterfaceDescriptorData* data) { |
| 351 | Register registers[] = {ObjectRegister(), KeyRegister()}; |
| 352 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 353 | } |
| 354 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 355 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 356 | FastCloneRegExpDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 357 | Isolate* isolate, int paramater_count) { |
| 358 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 359 | FunctionType* function = |
| 360 | Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 361 | function->InitParameter(0, AnyTagged(zone)); // closure |
| 362 | function->InitParameter(1, SmiType(zone)); // literal_index |
| 363 | function->InitParameter(2, AnyTagged(zone)); // pattern |
| 364 | function->InitParameter(3, AnyTagged(zone)); // flags |
| 365 | return function; |
| 366 | } |
| 367 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 368 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 369 | FastCloneShallowArrayDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 370 | Isolate* isolate, int paramater_count) { |
| 371 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 372 | FunctionType* function = |
| 373 | Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 374 | function->InitParameter(0, AnyTagged(zone)); |
| 375 | function->InitParameter(1, SmiType(zone)); |
| 376 | function->InitParameter(2, AnyTagged(zone)); |
| 377 | return function; |
| 378 | } |
| 379 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 380 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 381 | CreateAllocationSiteDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 382 | Isolate* isolate, int paramater_count) { |
| 383 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 384 | FunctionType* function = |
| 385 | Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 386 | function->InitParameter(0, AnyTagged(zone)); |
| 387 | function->InitParameter(1, SmiType(zone)); |
| 388 | return function; |
| 389 | } |
| 390 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 391 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 392 | CreateWeakCellDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 393 | Isolate* isolate, int paramater_count) { |
| 394 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 395 | FunctionType* function = |
| 396 | Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 397 | function->InitParameter(0, AnyTagged(zone)); |
| 398 | function->InitParameter(1, SmiType(zone)); |
| 399 | function->InitParameter(2, AnyTagged(zone)); |
| 400 | return function; |
| 401 | } |
| 402 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 403 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 404 | CallTrampolineDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 405 | Isolate* isolate, int paramater_count) { |
| 406 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 407 | FunctionType* function = |
| 408 | Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 409 | function->InitParameter(0, AnyTagged(zone)); // target |
| 410 | function->InitParameter(1, UntaggedIntegral32(zone)); // actual #arguments |
| 411 | return function; |
| 412 | } |
| 413 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 414 | FunctionType* ConstructStubDescriptor::BuildCallInterfaceDescriptorFunctionType( |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 415 | Isolate* isolate, int paramater_count) { |
| 416 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 417 | FunctionType* function = |
| 418 | Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 419 | function->InitParameter(0, AnyTagged(zone)); // target |
| 420 | function->InitParameter(1, AnyTagged(zone)); // new.target |
| 421 | function->InitParameter(2, UntaggedIntegral32(zone)); // actual #arguments |
| 422 | function->InitParameter(3, AnyTagged(zone)); // opt. allocation site |
| 423 | return function; |
| 424 | } |
| 425 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 426 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 427 | ConstructTrampolineDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 428 | Isolate* isolate, int paramater_count) { |
| 429 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 430 | FunctionType* function = |
| 431 | Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 432 | function->InitParameter(0, AnyTagged(zone)); // target |
| 433 | function->InitParameter(1, AnyTagged(zone)); // new.target |
| 434 | function->InitParameter(2, UntaggedIntegral32(zone)); // actual #arguments |
| 435 | return function; |
| 436 | } |
| 437 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 438 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 439 | CallFunctionWithFeedbackDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 440 | Isolate* isolate, int paramater_count) { |
| 441 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 442 | FunctionType* function = |
| 443 | Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 444 | function->InitParameter(0, Type::Receiver()); // JSFunction |
| 445 | function->InitParameter(1, SmiType(zone)); |
| 446 | return function; |
| 447 | } |
| 448 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 449 | FunctionType* CallFunctionWithFeedbackAndVectorDescriptor:: |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 450 | BuildCallInterfaceDescriptorFunctionType(Isolate* isolate, |
| 451 | int paramater_count) { |
| 452 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 453 | FunctionType* function = |
| 454 | Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 455 | function->InitParameter(0, Type::Receiver()); // JSFunction |
| 456 | function->InitParameter(1, SmiType(zone)); |
| 457 | function->InitParameter(2, AnyTagged(zone)); |
| 458 | return function; |
| 459 | } |
| 460 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 461 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 462 | ArrayConstructorDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 463 | Isolate* isolate, int paramater_count) { |
| 464 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 465 | FunctionType* function = |
| 466 | Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 467 | function->InitParameter(0, Type::Receiver()); // JSFunction |
| 468 | function->InitParameter(1, AnyTagged(zone)); |
| 469 | function->InitParameter(2, UntaggedIntegral32(zone)); |
| 470 | return function; |
| 471 | } |
| 472 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 473 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 474 | InternalArrayConstructorDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 475 | Isolate* isolate, int paramater_count) { |
| 476 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 477 | FunctionType* function = |
| 478 | Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 479 | function->InitParameter(0, Type::Receiver()); // JSFunction |
| 480 | function->InitParameter(1, UntaggedIntegral32(zone)); |
| 481 | return function; |
| 482 | } |
| 483 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 484 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 485 | ArgumentAdaptorDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 486 | Isolate* isolate, int paramater_count) { |
| 487 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 488 | FunctionType* function = |
| 489 | Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 490 | function->InitParameter(0, Type::Receiver()); // JSFunction |
| 491 | function->InitParameter(1, AnyTagged(zone)); // the new target |
| 492 | function->InitParameter(2, UntaggedIntegral32(zone)); // actual #arguments |
| 493 | function->InitParameter(3, UntaggedIntegral32(zone)); // expected #arguments |
| 494 | return function; |
| 495 | } |
| 496 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 497 | FunctionType* ApiFunctionDescriptor::BuildCallInterfaceDescriptorFunctionType( |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 498 | Isolate* isolate, int paramater_count) { |
| 499 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 500 | FunctionType* function = |
| 501 | Type::Function(AnyTagged(zone), Type::Undefined(), 5, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 502 | function->InitParameter(0, AnyTagged(zone)); // callee |
| 503 | function->InitParameter(1, AnyTagged(zone)); // call_data |
| 504 | function->InitParameter(2, AnyTagged(zone)); // holder |
| 505 | function->InitParameter(3, ExternalPointer(zone)); // api_function_address |
| 506 | function->InitParameter(4, UntaggedIntegral32(zone)); // actual #arguments |
| 507 | return function; |
| 508 | } |
| 509 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 510 | FunctionType* ApiAccessorDescriptor::BuildCallInterfaceDescriptorFunctionType( |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 511 | Isolate* isolate, int paramater_count) { |
| 512 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 513 | FunctionType* function = |
| 514 | Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 515 | function->InitParameter(0, AnyTagged(zone)); // callee |
| 516 | function->InitParameter(1, AnyTagged(zone)); // call_data |
| 517 | function->InitParameter(2, AnyTagged(zone)); // holder |
| 518 | function->InitParameter(3, ExternalPointer(zone)); // api_function_address |
| 519 | return function; |
| 520 | } |
| 521 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame^] | 522 | FunctionType* |
| 523 | InterpreterDispatchDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 524 | Isolate* isolate, int parameter_count) { |
| 525 | Zone* zone = isolate->interface_descriptor_zone(); |
| 526 | FunctionType* function = |
| 527 | Type::Function(AnyTagged(zone), Type::Undefined(), 5, zone)->AsFunction(); |
| 528 | function->InitParameter(kAccumulatorParameter, AnyTagged(zone)); |
| 529 | function->InitParameter(kRegisterFileParameter, ExternalPointer(zone)); |
| 530 | function->InitParameter(kBytecodeOffsetParameter, UntaggedIntegral32(zone)); |
| 531 | function->InitParameter(kBytecodeArrayParameter, AnyTagged(zone)); |
| 532 | function->InitParameter(kDispatchTableParameter, AnyTagged(zone)); |
| 533 | return function; |
| 534 | } |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 535 | |
| 536 | } // namespace internal |
| 537 | } // namespace v8 |