interface-descriptors-mips64.cc 12.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#if V8_TARGET_ARCH_MIPS64

#include "src/interface-descriptors.h"

namespace v8 {
namespace internal {

12
const Register CallInterfaceDescriptor::ContextRegister() { return cp; }
13

14 15 16 17 18 19 20 21
void CallInterfaceDescriptor::DefaultInitializePlatformSpecific(
    CallInterfaceDescriptorData* data, int register_parameter_count) {
  const Register default_stub_registers[] = {a0, a1, a2, a3, a4};
  CHECK_LE(static_cast<size_t>(register_parameter_count),
           arraysize(default_stub_registers));
  data->InitializePlatformSpecific(register_parameter_count,
                                   default_stub_registers);
}
22

23 24 25 26 27
const Register FastNewFunctionContextDescriptor::FunctionRegister() {
  return a1;
}
const Register FastNewFunctionContextDescriptor::SlotsRegister() { return a0; }

28 29
const Register LoadDescriptor::ReceiverRegister() { return a1; }
const Register LoadDescriptor::NameRegister() { return a2; }
30
const Register LoadDescriptor::SlotRegister() { return a0; }
31

32
const Register LoadWithVectorDescriptor::VectorRegister() { return a3; }
33

34
const Register LoadICProtoArrayDescriptor::HandlerRegister() { return a4; }
35 36 37 38

const Register StoreDescriptor::ReceiverRegister() { return a1; }
const Register StoreDescriptor::NameRegister() { return a2; }
const Register StoreDescriptor::ValueRegister() { return a0; }
39
const Register StoreDescriptor::SlotRegister() { return a4; }
40

41
const Register StoreWithVectorDescriptor::VectorRegister() { return a3; }
42

43 44 45
const Register StoreTransitionDescriptor::SlotRegister() { return a4; }
const Register StoreTransitionDescriptor::VectorRegister() { return a3; }
const Register StoreTransitionDescriptor::MapRegister() { return a5; }
46

47 48 49
const Register StringCompareDescriptor::LeftRegister() { return a1; }
const Register StringCompareDescriptor::RightRegister() { return a0; }

50 51
const Register ApiGetterDescriptor::HolderRegister() { return a0; }
const Register ApiGetterDescriptor::CallbackRegister() { return a3; }
52

53 54 55 56 57
const Register MathPowTaggedDescriptor::exponent() { return a2; }

const Register MathPowIntegerDescriptor::exponent() {
  return MathPowTaggedDescriptor::exponent();
}
58 59


60 61 62 63
const Register GrowArrayElementsDescriptor::ObjectRegister() { return a0; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return a3; }


64 65
void FastNewClosureDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
66
  Register registers[] = {a1, a2, a3};
67
  data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
68 69
}

70
// static
71
const Register TypeConversionDescriptor::ArgumentRegister() { return a0; }
72

73 74
void TypeofDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
75
  Register registers[] = {a3};
76
  data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
77 78 79
}


80 81 82 83 84 85 86
void FastCloneRegExpDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  Register registers[] = {a3, a2, a1, a0};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}


87
void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
88
    CallInterfaceDescriptorData* data) {
89
  Register registers[] = {a3, a2, a1};
90
  data->InitializePlatformSpecific(arraysize(registers), registers);
91 92 93
}


94
void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
95
    CallInterfaceDescriptorData* data) {
96
  Register registers[] = {a3, a2, a1, a0};
97
  data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
98 99
}

100 101
void CallFunctionDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
102
  Register registers[] = {a1};
103
  data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
104 105
}

106 107 108 109 110 111 112 113
void CallTrampolineDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // a1: target
  // a0: number of arguments
  Register registers[] = {a1, a0};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

114 115 116 117 118 119 120 121 122 123
void CallVarargsDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // a0 : number of arguments (on the stack, not including receiver)
  // a1 : the target to call
  // a2 : arguments list (FixedArray)
  // a4 : arguments list length (untagged)
  Register registers[] = {a1, a0, a2, a4};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

124 125 126
void CallForwardVarargsDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // a1: the target to call
127 128 129 130 131 132
  // a0: number of arguments
  // a2: start index (to support rest parameters)
  Register registers[] = {a1, a0, a2};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

133 134 135 136 137 138 139 140 141
void CallWithSpreadDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // a0 : number of arguments (on the stack, not including receiver)
  // a1 : the target to call
  // a2 : the object to spread
  Register registers[] = {a1, a0, a2};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
void CallWithArrayLikeDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // a1 : the target to call
  // a2 : the arguments list
  Register registers[] = {a1, a2};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

void ConstructVarargsDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // a0 : number of arguments (on the stack, not including receiver)
  // a1 : the target to call
  // a3 : the new target
  // a2 : arguments list (FixedArray)
  // a4 : arguments list length (untagged)
  Register registers[] = {a1, a3, a0, a2, a4};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

161 162 163 164 165
void ConstructForwardVarargsDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // a1: the target to call
  // a3: new target
  // a0: number of arguments
166
  // a2: start index (to support rest parameters)
167
  Register registers[] = {a1, a3, a0, a2};
168
  data->InitializePlatformSpecific(arraysize(registers), registers);
169 170
}

171 172 173 174 175 176 177 178 179 180
void ConstructWithSpreadDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // a0 : number of arguments (on the stack, not including receiver)
  // a1 : the target to call
  // a3 : the new target
  // a2 : the object to spread
  Register registers[] = {a1, a3, a0, a2};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

181 182 183 184 185 186 187
void ConstructWithArrayLikeDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // a1 : the target to call
  // a3 : the new target
  // a2 : the arguments list
  Register registers[] = {a1, a3, a2};
  data->InitializePlatformSpecific(arraysize(registers), registers);
188
}
189

190 191 192 193 194 195 196 197 198 199 200
void ConstructStubDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // a1: target
  // a3: new target
  // a0: number of arguments
  // a2: allocation site or undefined
  Register registers[] = {a1, a3, a0, a2};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}


201 202 203 204 205 206 207 208 209 210
void ConstructTrampolineDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // a1: target
  // a3: new target
  // a0: number of arguments
  Register registers[] = {a1, a3, a0};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}


211
void TransitionElementsKindDescriptor::InitializePlatformSpecific(
212
    CallInterfaceDescriptorData* data) {
213
  Register registers[] = {a0, a1};
214
  data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
215 216 217
}


218
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
219 220
    CallInterfaceDescriptorData* data) {
  // register state
221
  data->InitializePlatformSpecific(0, nullptr, nullptr);
222 223
}

224 225 226 227 228 229 230
void ArrayConstructorDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // kTarget, kNewTarget, kActualArgumentsCount, kAllocationSite
  Register registers[] = {a1, a3, a0, a2};
  data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}

231 232 233 234 235 236 237 238 239 240
void ArrayNoArgumentConstructorDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // register state
  // a0 -- number of arguments
  // a1 -- function
  // a2 -- allocation site with elements kind
  Register registers[] = {a1, a2, a0};
  data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}

241
void ArraySingleArgumentConstructorDescriptor::InitializePlatformSpecific(
242
    CallInterfaceDescriptorData* data) {
243 244 245 246
  // register state
  // a0 -- number of arguments
  // a1 -- function
  // a2 -- allocation site with elements kind
247
  Register registers[] = {a1, a2, a0};
248
  data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
249 250
}

251
void ArrayNArgumentsConstructorDescriptor::InitializePlatformSpecific(
252
    CallInterfaceDescriptorData* data) {
253
  // stack param count needs (constructor pointer, and single argument)
254
  Register registers[] = {a1, a2, a0};
255
  data->InitializePlatformSpecific(arraysize(registers), registers);
256 257
}

258 259
void CompareDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
260
  Register registers[] = {a1, a0};
261
  data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
262 263 264
}


265 266
void BinaryOpDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
267
  Register registers[] = {a1, a0};
268
  data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
269 270
}

271 272
void StringAddDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
273
  Register registers[] = {a1, a0};
274
  data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
275 276
}

277 278
void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
279 280
  Register registers[] = {
      a1,  // JSFunction
281
      a3,  // the new target
282 283 284
      a0,  // actual number of arguments
      a2,  // expected number of arguments
  };
285
  data->InitializePlatformSpecific(arraysize(registers), registers);
286 287
}

288
void ApiCallbackDescriptor::InitializePlatformSpecific(
289
    CallInterfaceDescriptorData* data) {
290 291 292 293 294 295
  Register registers[] = {
      a0,  // callee
      a4,  // call_data
      a2,  // holder
      a1,  // api_function_address
  };
296
  data->InitializePlatformSpecific(arraysize(registers), registers);
297
}
298

299 300 301
void InterpreterDispatchDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  Register registers[] = {
302 303
      kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister,
      kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister};
304 305
  data->InitializePlatformSpecific(arraysize(registers), registers);
}
306

307
void InterpreterPushArgsThenCallDescriptor::InitializePlatformSpecific(
308 309
    CallInterfaceDescriptorData* data) {
  Register registers[] = {
310
      a0,  // argument count (not including receiver)
311 312 313 314 315 316
      a2,  // address of first argument
      a1   // the target callable to be call
  };
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

317
void InterpreterPushArgsThenConstructDescriptor::InitializePlatformSpecific(
318 319 320
    CallInterfaceDescriptorData* data) {
  Register registers[] = {
      a0,  // argument count (not including receiver)
321
      a3,  // new target
322
      a1,  // constructor to call
323 324
      a2,  // allocation site feedback if available, undefined otherwise.
      a4   // address of the first argument
325 326
  };
  data->InitializePlatformSpecific(arraysize(registers), registers);
327 328
}

329 330 331 332 333 334 335 336 337 338
void InterpreterCEntryDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  Register registers[] = {
      a0,  // argument count (argc)
      a2,  // address of first argument (argv)
      a1   // the runtime function to call
  };
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

339 340 341 342 343
void ResumeGeneratorDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  Register registers[] = {
      v0,  // the value to pass to the generator
      a1,  // the JSGeneratorObject to resume
344
      a2   // the resume mode (tagged)
345 346 347 348
  };
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

349 350 351 352 353 354 355 356
void FrameDropperTrampolineDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  Register registers[] = {
      a1,  // loaded new FP
  };
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

357 358
}  // namespace internal
}  // namespace v8
359 360

#endif  // V8_TARGET_ARCH_MIPS64