Home | History | Annotate | Download | only in mips64
      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 
      5 #if V8_TARGET_ARCH_MIPS64
      6 
      7 #include "src/interface-descriptors.h"
      8 
      9 namespace v8 {
     10 namespace internal {
     11 
     12 const Register CallInterfaceDescriptor::ContextRegister() { return cp; }
     13 
     14 
     15 const Register LoadDescriptor::ReceiverRegister() { return a1; }
     16 const Register LoadDescriptor::NameRegister() { return a2; }
     17 const Register LoadDescriptor::SlotRegister() { return a0; }
     18 
     19 
     20 const Register LoadWithVectorDescriptor::VectorRegister() { return a3; }
     21 
     22 
     23 const Register StoreDescriptor::ReceiverRegister() { return a1; }
     24 const Register StoreDescriptor::NameRegister() { return a2; }
     25 const Register StoreDescriptor::ValueRegister() { return a0; }
     26 
     27 
     28 const Register VectorStoreICTrampolineDescriptor::SlotRegister() { return a4; }
     29 
     30 
     31 const Register VectorStoreICDescriptor::VectorRegister() { return a3; }
     32 
     33 
     34 const Register VectorStoreTransitionDescriptor::SlotRegister() { return a4; }
     35 const Register VectorStoreTransitionDescriptor::VectorRegister() { return a3; }
     36 const Register VectorStoreTransitionDescriptor::MapRegister() { return a5; }
     37 
     38 
     39 const Register StoreTransitionDescriptor::MapRegister() { return a3; }
     40 
     41 
     42 const Register LoadGlobalViaContextDescriptor::SlotRegister() { return a2; }
     43 
     44 
     45 const Register StoreGlobalViaContextDescriptor::SlotRegister() { return a2; }
     46 const Register StoreGlobalViaContextDescriptor::ValueRegister() { return a0; }
     47 
     48 
     49 const Register InstanceOfDescriptor::LeftRegister() { return a1; }
     50 const Register InstanceOfDescriptor::RightRegister() { return a0; }
     51 
     52 
     53 const Register StringCompareDescriptor::LeftRegister() { return a1; }
     54 const Register StringCompareDescriptor::RightRegister() { return a0; }
     55 
     56 
     57 const Register ArgumentsAccessReadDescriptor::index() { return a1; }
     58 const Register ArgumentsAccessReadDescriptor::parameter_count() { return a0; }
     59 
     60 
     61 const Register ArgumentsAccessNewDescriptor::function() { return a1; }
     62 const Register ArgumentsAccessNewDescriptor::parameter_count() { return a2; }
     63 const Register ArgumentsAccessNewDescriptor::parameter_pointer() { return a3; }
     64 
     65 
     66 const Register RestParamAccessDescriptor::parameter_count() { return a2; }
     67 const Register RestParamAccessDescriptor::parameter_pointer() { return a3; }
     68 const Register RestParamAccessDescriptor::rest_parameter_index() { return a4; }
     69 
     70 
     71 const Register ApiGetterDescriptor::function_address() { return a2; }
     72 
     73 
     74 const Register MathPowTaggedDescriptor::exponent() { return a2; }
     75 
     76 
     77 const Register MathPowIntegerDescriptor::exponent() {
     78   return MathPowTaggedDescriptor::exponent();
     79 }
     80 
     81 
     82 const Register GrowArrayElementsDescriptor::ObjectRegister() { return a0; }
     83 const Register GrowArrayElementsDescriptor::KeyRegister() { return a3; }
     84 
     85 
     86 void FastNewClosureDescriptor::InitializePlatformSpecific(
     87     CallInterfaceDescriptorData* data) {
     88   Register registers[] = {a2};
     89   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
     90 }
     91 
     92 
     93 void FastNewContextDescriptor::InitializePlatformSpecific(
     94     CallInterfaceDescriptorData* data) {
     95   Register registers[] = {a1};
     96   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
     97 }
     98 
     99 
    100 void ToNumberDescriptor::InitializePlatformSpecific(
    101     CallInterfaceDescriptorData* data) {
    102   Register registers[] = {a0};
    103   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    104 }
    105 
    106 
    107 // static
    108 const Register ToLengthDescriptor::ReceiverRegister() { return a0; }
    109 
    110 
    111 // static
    112 const Register ToStringDescriptor::ReceiverRegister() { return a0; }
    113 
    114 
    115 // static
    116 const Register ToObjectDescriptor::ReceiverRegister() { return a0; }
    117 
    118 
    119 void NumberToStringDescriptor::InitializePlatformSpecific(
    120     CallInterfaceDescriptorData* data) {
    121   Register registers[] = {a0};
    122   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    123 }
    124 
    125 
    126 void TypeofDescriptor::InitializePlatformSpecific(
    127     CallInterfaceDescriptorData* data) {
    128   Register registers[] = {a3};
    129   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    130 }
    131 
    132 
    133 void FastCloneRegExpDescriptor::InitializePlatformSpecific(
    134     CallInterfaceDescriptorData* data) {
    135   Register registers[] = {a3, a2, a1, a0};
    136   data->InitializePlatformSpecific(arraysize(registers), registers);
    137 }
    138 
    139 
    140 void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
    141     CallInterfaceDescriptorData* data) {
    142   Register registers[] = {a3, a2, a1};
    143   data->InitializePlatformSpecific(arraysize(registers), registers);
    144 }
    145 
    146 
    147 void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
    148     CallInterfaceDescriptorData* data) {
    149   Register registers[] = {a3, a2, a1, a0};
    150   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    151 }
    152 
    153 
    154 void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
    155     CallInterfaceDescriptorData* data) {
    156   Register registers[] = {a2, a3};
    157   data->InitializePlatformSpecific(arraysize(registers), registers);
    158 }
    159 
    160 
    161 void CreateWeakCellDescriptor::InitializePlatformSpecific(
    162     CallInterfaceDescriptorData* data) {
    163   Register registers[] = {a2, a3, a1};
    164   data->InitializePlatformSpecific(arraysize(registers), registers);
    165 }
    166 
    167 
    168 void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
    169     CallInterfaceDescriptorData* data) {
    170   Register registers[] = {a3, a0};
    171   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    172 }
    173 
    174 
    175 void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
    176     CallInterfaceDescriptorData* data) {
    177   Register registers[] = {a1, a3};
    178   data->InitializePlatformSpecific(arraysize(registers), registers);
    179 }
    180 
    181 
    182 void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
    183     CallInterfaceDescriptorData* data) {
    184   Register registers[] = {a1, a3, a2};
    185   data->InitializePlatformSpecific(arraysize(registers), registers);
    186 }
    187 
    188 
    189 void CallFunctionDescriptor::InitializePlatformSpecific(
    190     CallInterfaceDescriptorData* data) {
    191   Register registers[] = {a1};
    192   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    193 }
    194 
    195 
    196 void CallConstructDescriptor::InitializePlatformSpecific(
    197     CallInterfaceDescriptorData* data) {
    198   // a0 : number of arguments
    199   // a1 : the function to call
    200   // a2 : feedback vector
    201   // a3 : slot in feedback vector (Smi, for RecordCallTarget)
    202   // a4 : new target (for IsSuperConstructorCall)
    203   // TODO(turbofan): So far we don't gather type feedback and hence skip the
    204   // slot parameter, but ArrayConstructStub needs the vector to be undefined.
    205   Register registers[] = {a0, a1, a4, a2};
    206   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    207 }
    208 
    209 
    210 void CallTrampolineDescriptor::InitializePlatformSpecific(
    211     CallInterfaceDescriptorData* data) {
    212   // a1: target
    213   // a0: number of arguments
    214   Register registers[] = {a1, a0};
    215   data->InitializePlatformSpecific(arraysize(registers), registers);
    216 }
    217 
    218 
    219 void ConstructStubDescriptor::InitializePlatformSpecific(
    220     CallInterfaceDescriptorData* data) {
    221   // a1: target
    222   // a3: new target
    223   // a0: number of arguments
    224   // a2: allocation site or undefined
    225   Register registers[] = {a1, a3, a0, a2};
    226   data->InitializePlatformSpecific(arraysize(registers), registers);
    227 }
    228 
    229 
    230 void ConstructTrampolineDescriptor::InitializePlatformSpecific(
    231     CallInterfaceDescriptorData* data) {
    232   // a1: target
    233   // a3: new target
    234   // a0: number of arguments
    235   Register registers[] = {a1, a3, a0};
    236   data->InitializePlatformSpecific(arraysize(registers), registers);
    237 }
    238 
    239 
    240 void RegExpConstructResultDescriptor::InitializePlatformSpecific(
    241     CallInterfaceDescriptorData* data) {
    242   Register registers[] = {a2, a1, a0};
    243   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    244 }
    245 
    246 
    247 void TransitionElementsKindDescriptor::InitializePlatformSpecific(
    248     CallInterfaceDescriptorData* data) {
    249   Register registers[] = {a0, a1};
    250   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    251 }
    252 
    253 
    254 void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
    255     CallInterfaceDescriptorData* data) {
    256   // register state
    257   data->InitializePlatformSpecific(0, nullptr, nullptr);
    258 }
    259 
    260 
    261 void AllocateInNewSpaceDescriptor::InitializePlatformSpecific(
    262     CallInterfaceDescriptorData* data) {
    263   Register registers[] = {a0};
    264   data->InitializePlatformSpecific(arraysize(registers), registers);
    265 }
    266 
    267 
    268 void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
    269     CallInterfaceDescriptorData* data) {
    270   // register state
    271   // a0 -- number of arguments
    272   // a1 -- function
    273   // a2 -- allocation site with elements kind
    274   Register registers[] = {a1, a2};
    275   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    276 }
    277 
    278 
    279 void ArrayConstructorDescriptor::InitializePlatformSpecific(
    280     CallInterfaceDescriptorData* data) {
    281   // stack param count needs (constructor pointer, and single argument)
    282   Register registers[] = {a1, a2, a0};
    283   data->InitializePlatformSpecific(arraysize(registers), registers);
    284 }
    285 
    286 
    287 void InternalArrayConstructorConstantArgCountDescriptor::
    288     InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
    289   // register state
    290   // a0 -- number of arguments
    291   // a1 -- constructor function
    292   Register registers[] = {a1};
    293   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    294 }
    295 
    296 
    297 void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
    298     CallInterfaceDescriptorData* data) {
    299   // stack param count needs (constructor pointer, and single argument)
    300   Register registers[] = {a1, a0};
    301   data->InitializePlatformSpecific(arraysize(registers), registers);
    302 }
    303 
    304 
    305 void CompareDescriptor::InitializePlatformSpecific(
    306     CallInterfaceDescriptorData* data) {
    307   Register registers[] = {a1, a0};
    308   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    309 }
    310 
    311 
    312 void CompareNilDescriptor::InitializePlatformSpecific(
    313     CallInterfaceDescriptorData* data) {
    314   Register registers[] = {a0};
    315   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    316 }
    317 
    318 
    319 void ToBooleanDescriptor::InitializePlatformSpecific(
    320     CallInterfaceDescriptorData* data) {
    321   Register registers[] = {a0};
    322   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    323 }
    324 
    325 
    326 void BinaryOpDescriptor::InitializePlatformSpecific(
    327     CallInterfaceDescriptorData* data) {
    328   Register registers[] = {a1, a0};
    329   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    330 }
    331 
    332 
    333 void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
    334     CallInterfaceDescriptorData* data) {
    335   Register registers[] = {a2, a1, a0};
    336   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    337 }
    338 
    339 
    340 void StringAddDescriptor::InitializePlatformSpecific(
    341     CallInterfaceDescriptorData* data) {
    342   Register registers[] = {a1, a0};
    343   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
    344 }
    345 
    346 
    347 void KeyedDescriptor::InitializePlatformSpecific(
    348     CallInterfaceDescriptorData* data) {
    349   Register registers[] = {
    350       a2,  // key
    351   };
    352   data->InitializePlatformSpecific(arraysize(registers), registers);
    353 }
    354 
    355 
    356 void NamedDescriptor::InitializePlatformSpecific(
    357     CallInterfaceDescriptorData* data) {
    358   Register registers[] = {
    359       a2,  // name
    360   };
    361   data->InitializePlatformSpecific(arraysize(registers), registers);
    362 }
    363 
    364 
    365 void CallHandlerDescriptor::InitializePlatformSpecific(
    366     CallInterfaceDescriptorData* data) {
    367   Register registers[] = {
    368       a0,  // receiver
    369   };
    370   data->InitializePlatformSpecific(arraysize(registers), registers);
    371 }
    372 
    373 
    374 void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
    375     CallInterfaceDescriptorData* data) {
    376   Register registers[] = {
    377       a1,  // JSFunction
    378       a3,  // the new target
    379       a0,  // actual number of arguments
    380       a2,  // expected number of arguments
    381   };
    382   data->InitializePlatformSpecific(arraysize(registers), registers);
    383 }
    384 
    385 
    386 void ApiFunctionDescriptor::InitializePlatformSpecific(
    387     CallInterfaceDescriptorData* data) {
    388   Register registers[] = {
    389       a0,  // callee
    390       a4,  // call_data
    391       a2,  // holder
    392       a1,  // api_function_address
    393       a3,  // actual number of arguments
    394   };
    395   data->InitializePlatformSpecific(arraysize(registers), registers);
    396 }
    397 
    398 
    399 void ApiAccessorDescriptor::InitializePlatformSpecific(
    400     CallInterfaceDescriptorData* data) {
    401   Register registers[] = {
    402       a0,  // callee
    403       a4,  // call_data
    404       a2,  // holder
    405       a1,  // api_function_address
    406   };
    407   data->InitializePlatformSpecific(arraysize(registers), registers);
    408 }
    409 
    410 
    411 void InterpreterPushArgsAndCallDescriptor::InitializePlatformSpecific(
    412     CallInterfaceDescriptorData* data) {
    413   Register registers[] = {
    414       a0,  // argument count (not including receiver)
    415       a2,  // address of first argument
    416       a1   // the target callable to be call
    417   };
    418   data->InitializePlatformSpecific(arraysize(registers), registers);
    419 }
    420 
    421 
    422 void InterpreterPushArgsAndConstructDescriptor::InitializePlatformSpecific(
    423     CallInterfaceDescriptorData* data) {
    424   Register registers[] = {
    425       a0,  // argument count (not including receiver)
    426       a3,  // new target
    427       a1,  // constructor to call
    428       a2   // address of the first argument
    429   };
    430   data->InitializePlatformSpecific(arraysize(registers), registers);
    431 }
    432 
    433 
    434 void InterpreterCEntryDescriptor::InitializePlatformSpecific(
    435     CallInterfaceDescriptorData* data) {
    436   Register registers[] = {
    437       a0,  // argument count (argc)
    438       a2,  // address of first argument (argv)
    439       a1   // the runtime function to call
    440   };
    441   data->InitializePlatformSpecific(arraysize(registers), registers);
    442 }
    443 
    444 }  // namespace internal
    445 }  // namespace v8
    446 
    447 #endif  // V8_TARGET_ARCH_MIPS64
    448