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 | |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame^] | 200 | void TypeConversionDescriptor::InitializePlatformSpecific( |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 201 | CallInterfaceDescriptorData* data) { |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame^] | 202 | Register registers[] = {ArgumentRegister()}; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 203 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 204 | } |
| 205 | |
| 206 | |
| 207 | void MathPowTaggedDescriptor::InitializePlatformSpecific( |
| 208 | CallInterfaceDescriptorData* data) { |
| 209 | Register registers[] = {exponent()}; |
| 210 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 211 | } |
| 212 | |
| 213 | |
| 214 | void MathPowIntegerDescriptor::InitializePlatformSpecific( |
| 215 | CallInterfaceDescriptorData* data) { |
| 216 | Register registers[] = {exponent()}; |
| 217 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 218 | } |
| 219 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 220 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 221 | LoadWithVectorDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 222 | Isolate* isolate, int paramater_count) { |
| 223 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 224 | FunctionType* function = |
| 225 | Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 226 | function->InitParameter(0, AnyTagged(zone)); |
| 227 | function->InitParameter(1, AnyTagged(zone)); |
| 228 | function->InitParameter(2, SmiType(zone)); |
| 229 | function->InitParameter(3, AnyTagged(zone)); |
| 230 | return function; |
| 231 | } |
| 232 | |
| 233 | |
| 234 | void LoadWithVectorDescriptor::InitializePlatformSpecific( |
| 235 | CallInterfaceDescriptorData* data) { |
| 236 | Register registers[] = {ReceiverRegister(), NameRegister(), SlotRegister(), |
| 237 | VectorRegister()}; |
| 238 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 239 | } |
| 240 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 241 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 242 | VectorStoreTransitionDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 243 | Isolate* isolate, int paramater_count) { |
| 244 | Zone* zone = isolate->interface_descriptor_zone(); |
| 245 | bool has_slot = !VectorStoreTransitionDescriptor::SlotRegister().is(no_reg); |
| 246 | int arg_count = has_slot ? 6 : 5; |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 247 | FunctionType* function = |
| 248 | Type::Function(AnyTagged(zone), Type::Undefined(), arg_count, zone) |
| 249 | ->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 250 | int index = 0; |
| 251 | function->InitParameter(index++, AnyTagged(zone)); // receiver |
| 252 | function->InitParameter(index++, AnyTagged(zone)); // name |
| 253 | function->InitParameter(index++, AnyTagged(zone)); // value |
| 254 | function->InitParameter(index++, AnyTagged(zone)); // map |
| 255 | if (has_slot) { |
| 256 | function->InitParameter(index++, SmiType(zone)); // slot |
| 257 | } |
| 258 | function->InitParameter(index++, AnyTagged(zone)); // vector |
| 259 | return function; |
| 260 | } |
| 261 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 262 | FunctionType* VectorStoreICDescriptor::BuildCallInterfaceDescriptorFunctionType( |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 263 | Isolate* isolate, int paramater_count) { |
| 264 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 265 | FunctionType* function = |
| 266 | Type::Function(AnyTagged(zone), Type::Undefined(), 5, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 267 | function->InitParameter(0, AnyTagged(zone)); |
| 268 | function->InitParameter(1, AnyTagged(zone)); |
| 269 | function->InitParameter(2, AnyTagged(zone)); |
| 270 | function->InitParameter(3, SmiType(zone)); |
| 271 | function->InitParameter(4, AnyTagged(zone)); |
| 272 | return function; |
| 273 | } |
| 274 | |
| 275 | |
| 276 | void VectorStoreICDescriptor::InitializePlatformSpecific( |
| 277 | CallInterfaceDescriptorData* data) { |
| 278 | Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(), |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 279 | SlotRegister(), VectorRegister()}; |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 280 | data->InitializePlatformSpecific(arraysize(registers), registers); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 281 | } |
| 282 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 283 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 284 | VectorStoreICTrampolineDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 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(), 4, 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 | return function; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 297 | void VectorStoreICTrampolineDescriptor::InitializePlatformSpecific( |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 298 | CallInterfaceDescriptorData* data) { |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 299 | Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(), |
| 300 | SlotRegister()}; |
| 301 | data->InitializePlatformSpecific(arraysize(registers), registers); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 302 | } |
| 303 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 304 | FunctionType* ApiGetterDescriptor::BuildCallInterfaceDescriptorFunctionType( |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 305 | Isolate* isolate, int paramater_count) { |
| 306 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 307 | FunctionType* function = |
| 308 | Type::Function(AnyTagged(zone), Type::Undefined(), 1, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 309 | function->InitParameter(0, ExternalPointer(zone)); |
| 310 | return function; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 311 | } |
| 312 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 313 | |
| 314 | void ApiGetterDescriptor::InitializePlatformSpecific( |
| 315 | CallInterfaceDescriptorData* data) { |
| 316 | Register registers[] = {function_address()}; |
| 317 | data->InitializePlatformSpecific(arraysize(registers), registers); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 318 | } |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 319 | |
| 320 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 321 | void ContextOnlyDescriptor::InitializePlatformSpecific( |
| 322 | CallInterfaceDescriptorData* data) { |
| 323 | data->InitializePlatformSpecific(0, nullptr); |
| 324 | } |
| 325 | |
| 326 | |
| 327 | void GrowArrayElementsDescriptor::InitializePlatformSpecific( |
| 328 | CallInterfaceDescriptorData* data) { |
| 329 | Register registers[] = {ObjectRegister(), KeyRegister()}; |
| 330 | data->InitializePlatformSpecific(arraysize(registers), registers); |
| 331 | } |
| 332 | |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame^] | 333 | FunctionType* FastArrayPushDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 334 | Isolate* isolate, int paramater_count) { |
| 335 | Zone* zone = isolate->interface_descriptor_zone(); |
| 336 | FunctionType* function = |
| 337 | Type::Function(AnyTagged(zone), AnyTagged(zone), 1, zone)->AsFunction(); |
| 338 | function->InitParameter(0, UntaggedIntegral32(zone)); // actual #arguments |
| 339 | return function; |
| 340 | } |
| 341 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 342 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 343 | FastCloneRegExpDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 344 | Isolate* isolate, int paramater_count) { |
| 345 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 346 | FunctionType* function = |
| 347 | Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 348 | function->InitParameter(0, AnyTagged(zone)); // closure |
| 349 | function->InitParameter(1, SmiType(zone)); // literal_index |
| 350 | function->InitParameter(2, AnyTagged(zone)); // pattern |
| 351 | function->InitParameter(3, AnyTagged(zone)); // flags |
| 352 | return function; |
| 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 | FastCloneShallowArrayDescriptor::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(), 3, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 361 | function->InitParameter(0, AnyTagged(zone)); |
| 362 | function->InitParameter(1, SmiType(zone)); |
| 363 | function->InitParameter(2, AnyTagged(zone)); |
| 364 | return function; |
| 365 | } |
| 366 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 367 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 368 | CreateAllocationSiteDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 369 | Isolate* isolate, int paramater_count) { |
| 370 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 371 | FunctionType* function = |
| 372 | Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 373 | function->InitParameter(0, AnyTagged(zone)); |
| 374 | function->InitParameter(1, SmiType(zone)); |
| 375 | return function; |
| 376 | } |
| 377 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 378 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 379 | CreateWeakCellDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 380 | Isolate* isolate, int paramater_count) { |
| 381 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 382 | FunctionType* function = |
| 383 | Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 384 | function->InitParameter(0, AnyTagged(zone)); |
| 385 | function->InitParameter(1, SmiType(zone)); |
| 386 | function->InitParameter(2, AnyTagged(zone)); |
| 387 | return function; |
| 388 | } |
| 389 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 390 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 391 | CallTrampolineDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 392 | Isolate* isolate, int paramater_count) { |
| 393 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 394 | FunctionType* function = |
| 395 | Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 396 | function->InitParameter(0, AnyTagged(zone)); // target |
| 397 | function->InitParameter(1, UntaggedIntegral32(zone)); // actual #arguments |
| 398 | return function; |
| 399 | } |
| 400 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 401 | FunctionType* ConstructStubDescriptor::BuildCallInterfaceDescriptorFunctionType( |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 402 | Isolate* isolate, int paramater_count) { |
| 403 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 404 | FunctionType* function = |
| 405 | Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 406 | function->InitParameter(0, AnyTagged(zone)); // target |
| 407 | function->InitParameter(1, AnyTagged(zone)); // new.target |
| 408 | function->InitParameter(2, UntaggedIntegral32(zone)); // actual #arguments |
| 409 | function->InitParameter(3, AnyTagged(zone)); // opt. allocation site |
| 410 | return function; |
| 411 | } |
| 412 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 413 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 414 | ConstructTrampolineDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 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(), 3, 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 | return function; |
| 423 | } |
| 424 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 425 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 426 | CallFunctionWithFeedbackDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 427 | Isolate* isolate, int paramater_count) { |
| 428 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 429 | FunctionType* function = |
| 430 | Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 431 | function->InitParameter(0, Type::Receiver()); // JSFunction |
| 432 | function->InitParameter(1, SmiType(zone)); |
| 433 | return function; |
| 434 | } |
| 435 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 436 | FunctionType* CallFunctionWithFeedbackAndVectorDescriptor:: |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 437 | BuildCallInterfaceDescriptorFunctionType(Isolate* isolate, |
| 438 | int paramater_count) { |
| 439 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 440 | FunctionType* function = |
| 441 | Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 442 | function->InitParameter(0, Type::Receiver()); // JSFunction |
| 443 | function->InitParameter(1, SmiType(zone)); |
| 444 | function->InitParameter(2, AnyTagged(zone)); |
| 445 | return function; |
| 446 | } |
| 447 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 448 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 449 | ArrayConstructorDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 450 | Isolate* isolate, int paramater_count) { |
| 451 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 452 | FunctionType* function = |
| 453 | Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 454 | function->InitParameter(0, Type::Receiver()); // JSFunction |
| 455 | function->InitParameter(1, AnyTagged(zone)); |
| 456 | function->InitParameter(2, UntaggedIntegral32(zone)); |
| 457 | return function; |
| 458 | } |
| 459 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 460 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 461 | InternalArrayConstructorDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 462 | Isolate* isolate, int paramater_count) { |
| 463 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 464 | FunctionType* function = |
| 465 | Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 466 | function->InitParameter(0, Type::Receiver()); // JSFunction |
| 467 | function->InitParameter(1, UntaggedIntegral32(zone)); |
| 468 | return function; |
| 469 | } |
| 470 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 471 | FunctionType* |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 472 | ArgumentAdaptorDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 473 | Isolate* isolate, int paramater_count) { |
| 474 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 475 | FunctionType* function = |
| 476 | Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 477 | function->InitParameter(0, Type::Receiver()); // JSFunction |
| 478 | function->InitParameter(1, AnyTagged(zone)); // the new target |
| 479 | function->InitParameter(2, UntaggedIntegral32(zone)); // actual #arguments |
| 480 | function->InitParameter(3, UntaggedIntegral32(zone)); // expected #arguments |
| 481 | return function; |
| 482 | } |
| 483 | |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame^] | 484 | CallInterfaceDescriptor ApiCallbackDescriptorBase::ForArgs(Isolate* isolate, |
| 485 | int argc) { |
| 486 | switch (argc) { |
| 487 | case 0: |
| 488 | return ApiCallbackWith0ArgsDescriptor(isolate); |
| 489 | case 1: |
| 490 | return ApiCallbackWith1ArgsDescriptor(isolate); |
| 491 | case 2: |
| 492 | return ApiCallbackWith2ArgsDescriptor(isolate); |
| 493 | case 3: |
| 494 | return ApiCallbackWith3ArgsDescriptor(isolate); |
| 495 | case 4: |
| 496 | return ApiCallbackWith4ArgsDescriptor(isolate); |
| 497 | case 5: |
| 498 | return ApiCallbackWith5ArgsDescriptor(isolate); |
| 499 | case 6: |
| 500 | return ApiCallbackWith6ArgsDescriptor(isolate); |
| 501 | case 7: |
| 502 | return ApiCallbackWith7ArgsDescriptor(isolate); |
| 503 | default: |
| 504 | UNREACHABLE(); |
| 505 | return VoidDescriptor(isolate); |
| 506 | } |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 507 | } |
| 508 | |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame^] | 509 | FunctionType* |
| 510 | ApiCallbackDescriptorBase::BuildCallInterfaceDescriptorFunctionTypeWithArg( |
| 511 | Isolate* isolate, int parameter_count, int argc) { |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 512 | Zone* zone = isolate->interface_descriptor_zone(); |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 513 | FunctionType* function = |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame^] | 514 | Type::Function(AnyTagged(zone), Type::Undefined(), 4 + argc, zone) |
| 515 | ->AsFunction(); |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 516 | function->InitParameter(0, AnyTagged(zone)); // callee |
| 517 | function->InitParameter(1, AnyTagged(zone)); // call_data |
| 518 | function->InitParameter(2, AnyTagged(zone)); // holder |
| 519 | function->InitParameter(3, ExternalPointer(zone)); // api_function_address |
Ben Murdoch | da12d29 | 2016-06-02 14:46:10 +0100 | [diff] [blame^] | 520 | for (int i = 0; i < argc; i++) { |
| 521 | function->InitParameter(i, AnyTagged(zone)); |
| 522 | } |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 523 | return function; |
| 524 | } |
| 525 | |
Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 526 | FunctionType* |
| 527 | InterpreterDispatchDescriptor::BuildCallInterfaceDescriptorFunctionType( |
| 528 | Isolate* isolate, int parameter_count) { |
| 529 | Zone* zone = isolate->interface_descriptor_zone(); |
| 530 | FunctionType* function = |
| 531 | Type::Function(AnyTagged(zone), Type::Undefined(), 5, zone)->AsFunction(); |
| 532 | function->InitParameter(kAccumulatorParameter, AnyTagged(zone)); |
| 533 | function->InitParameter(kRegisterFileParameter, ExternalPointer(zone)); |
| 534 | function->InitParameter(kBytecodeOffsetParameter, UntaggedIntegral32(zone)); |
| 535 | function->InitParameter(kBytecodeArrayParameter, AnyTagged(zone)); |
| 536 | function->InitParameter(kDispatchTableParameter, AnyTagged(zone)); |
| 537 | return function; |
| 538 | } |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 539 | |
| 540 | } // namespace internal |
| 541 | } // namespace v8 |