interface-descriptors-s390.cc 11.7 KB
Newer Older
1 2 3 4 5 6
// Copyright 2015 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_S390

7
#include "src/codegen/interface-descriptors.h"
8

9
#include "src/execution/frames.h"
10 11 12 13 14 15

namespace v8 {
namespace internal {

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

16 17 18 19 20 21 22 23 24
void CallInterfaceDescriptor::DefaultInitializePlatformSpecific(
    CallInterfaceDescriptorData* data, int register_parameter_count) {
  const Register default_stub_registers[] = {r2, r3, r4, r5, r6};
  CHECK_LE(static_cast<size_t>(register_parameter_count),
           arraysize(default_stub_registers));
  data->InitializePlatformSpecific(register_parameter_count,
                                   default_stub_registers);
}

25 26
void RecordWriteDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
27 28 29 30 31 32 33 34
  const Register default_stub_registers[] = {r2, r3, r4, r5, r6};

  data->RestrictAllocatableRegisters(default_stub_registers,
                                     arraysize(default_stub_registers));

  CHECK_LE(static_cast<size_t>(kParameterCount),
           arraysize(default_stub_registers));
  data->InitializePlatformSpecific(kParameterCount, default_stub_registers);
35 36
}

37 38 39 40 41 42 43 44 45 46 47 48
void EphemeronKeyBarrierDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  const Register default_stub_registers[] = {r2, r3, r4, r5, r6};

  data->RestrictAllocatableRegisters(default_stub_registers,
                                     arraysize(default_stub_registers));

  CHECK_LE(static_cast<size_t>(kParameterCount),
           arraysize(default_stub_registers));
  data->InitializePlatformSpecific(kParameterCount, default_stub_registers);
}

49
const Register FastNewFunctionContextDescriptor::ScopeInfoRegister() {
50 51 52 53
  return r3;
}
const Register FastNewFunctionContextDescriptor::SlotsRegister() { return r2; }

54 55 56 57 58 59 60 61 62
const Register LoadDescriptor::ReceiverRegister() { return r3; }
const Register LoadDescriptor::NameRegister() { return r4; }
const Register LoadDescriptor::SlotRegister() { return r2; }

const Register LoadWithVectorDescriptor::VectorRegister() { return r5; }

const Register StoreDescriptor::ReceiverRegister() { return r3; }
const Register StoreDescriptor::NameRegister() { return r4; }
const Register StoreDescriptor::ValueRegister() { return r2; }
63
const Register StoreDescriptor::SlotRegister() { return r6; }
64

65
const Register StoreWithVectorDescriptor::VectorRegister() { return r5; }
66

67 68 69
const Register StoreTransitionDescriptor::SlotRegister() { return r6; }
const Register StoreTransitionDescriptor::VectorRegister() { return r5; }
const Register StoreTransitionDescriptor::MapRegister() { return r7; }
70

71 72
const Register ApiGetterDescriptor::HolderRegister() { return r2; }
const Register ApiGetterDescriptor::CallbackRegister() { return r5; }
73 74 75 76 77

const Register GrowArrayElementsDescriptor::ObjectRegister() { return r2; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return r5; }

// static
78
const Register TypeConversionDescriptor::ArgumentRegister() { return r2; }
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93

void TypeofDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  Register registers[] = {r5};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

void CallTrampolineDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // r2 : number of arguments
  // r3 : the target to call
  Register registers[] = {r3, r2};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

94 95 96 97 98
void CallVarargsDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // r2 : number of arguments (on the stack, not including receiver)
  // r3 : the target to call
  // r6 : arguments list length (untagged)
99 100
  // r4 : arguments list (FixedArray)
  Register registers[] = {r3, r2, r6, r4};
101 102 103
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

104 105
void CallForwardVarargsDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
106 107 108 109 110 111 112
  // r2 : number of arguments
  // r4 : start index (to support rest parameters)
  // r3 : the target to call
  Register registers[] = {r3, r2, r4};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

113 114 115 116 117 118 119 120
void CallFunctionTemplateDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // r3 : function template info
  // r4 : number of arguments (on the stack, not including receiver)
  Register registers[] = {r3, r4};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

121 122 123 124 125 126 127 128 129
void CallWithSpreadDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // r2 : number of arguments (on the stack, not including receiver)
  // r3 : the target to call
  // r4 : the object to spread
  Register registers[] = {r3, r2, r4};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

130 131 132 133 134 135 136 137 138 139 140 141 142 143
void CallWithArrayLikeDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // r3 : the target to call
  // r4 : the arguments list
  Register registers[] = {r3, r4};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

void ConstructVarargsDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // r2 : number of arguments (on the stack, not including receiver)
  // r3 : the target to call
  // r5 : the new target
  // r6 : arguments list length (untagged)
144 145
  // r4 : arguments list (FixedArray)
  Register registers[] = {r3, r5, r2, r6, r4};
146 147 148
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

149 150 151 152
void ConstructForwardVarargsDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // r2 : number of arguments
  // r5 : the new target
153 154
  // r4 : start index (to support rest parameters)
  // r3 : the target to call
155
  Register registers[] = {r3, r5, r2, r4};
156
  data->InitializePlatformSpecific(arraysize(registers), registers);
157 158
}

159 160 161 162 163 164 165 166 167 168
void ConstructWithSpreadDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // r2 : number of arguments (on the stack, not including receiver)
  // r3 : the target to call
  // r5 : the new target
  // r4 : the object to spread
  Register registers[] = {r3, r5, r2, r4};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

169 170 171 172 173 174 175
void ConstructWithArrayLikeDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // r3 : the target to call
  // r5 : the new target
  // r4 : the arguments list
  Register registers[] = {r3, r5, r4};
  data->InitializePlatformSpecific(arraysize(registers), registers);
176 177
}

178 179 180 181 182 183 184 185 186 187
void ConstructStubDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // r2 : number of arguments
  // r3 : the target to call
  // r5 : the new target
  // r4 : allocation site or undefined
  Register registers[] = {r3, r5, r2, r4};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

188
void AbortDescriptor::InitializePlatformSpecific(
189 190 191 192 193
    CallInterfaceDescriptorData* data) {
  Register registers[] = {r3};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

194 195 196 197 198 199 200 201 202 203 204 205
void CompareDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  Register registers[] = {r3, r2};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

void BinaryOpDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  Register registers[] = {r3, r2};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

206
void ArgumentsAdaptorDescriptor::InitializePlatformSpecific(
207 208 209 210 211 212 213 214 215 216
    CallInterfaceDescriptorData* data) {
  Register registers[] = {
      r3,  // JSFunction
      r5,  // the new target
      r2,  // actual number of arguments
      r4,  // expected number of arguments
  };
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

217
void ApiCallbackDescriptor::InitializePlatformSpecific(
218 219
    CallInterfaceDescriptorData* data) {
  Register registers[] = {
220 221 222 223
      r3,  // kApiFunctionAddress
      r4,  // kArgc
      r5,  // kCallData
      r2,  // kHolder
224 225 226 227 228 229 230
  };
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

void InterpreterDispatchDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  Register registers[] = {
231
      kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister,
232
      kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister};
233 234 235
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

236
void InterpreterPushArgsThenCallDescriptor::InitializePlatformSpecific(
237 238 239 240 241 242 243 244 245
    CallInterfaceDescriptorData* data) {
  Register registers[] = {
      r2,  // argument count (not including receiver)
      r4,  // address of first argument
      r3   // the target callable to be call
  };
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

246
void InterpreterPushArgsThenConstructDescriptor::InitializePlatformSpecific(
247 248 249
    CallInterfaceDescriptorData* data) {
  Register registers[] = {
      r2,  // argument count (not including receiver)
250
      r6,  // address of the first argument
251
      r3,  // constructor to call
252
      r5,  // new target
253
      r4,  // allocation site feedback if available, undefined otherwise
254 255
  };
  data->InitializePlatformSpecific(arraysize(registers), registers);
256 257
}

258 259 260 261
void ResumeGeneratorDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  Register registers[] = {
      r2,  // the value to pass to the generator
262
      r3   // the JSGeneratorObject to resume
263 264 265
  };
  data->InitializePlatformSpecific(arraysize(registers), registers);
}
266

267 268 269 270 271 272 273 274
void FrameDropperTrampolineDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  Register registers[] = {
      r3,  // loaded new FP
  };
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

275 276 277 278 279 280
void RunMicrotasksEntryDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  Register registers[] = {r2, r3};
  data->InitializePlatformSpecific(arraysize(registers), registers);
}

281 282 283 284 285 286 287 288 289 290 291 292
void BinaryOp_WithFeedbackDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // TODO(v8:8888): Implement on this platform.
  DefaultInitializePlatformSpecific(data, 4);
}

void CallTrampoline_WithFeedbackDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // TODO(v8:8888): Implement on this platform.
  DefaultInitializePlatformSpecific(data, 4);
}

293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316
void CallWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // TODO(v8:8888): Implement on this platform.
  DefaultInitializePlatformSpecific(data, 4);
}

void CallWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // TODO(v8:8888): Implement on this platform.
  DefaultInitializePlatformSpecific(data, 4);
}

void ConstructWithArrayLike_WithFeedbackDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // TODO(v8:8888): Implement on this platform.
  DefaultInitializePlatformSpecific(data, 4);
}

void ConstructWithSpread_WithFeedbackDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // TODO(v8:8888): Implement on this platform.
  DefaultInitializePlatformSpecific(data, 4);
}

317 318 319 320 321 322 323 324 325 326 327 328
void Compare_WithFeedbackDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // TODO(v8:8888): Implement on this platform.
  DefaultInitializePlatformSpecific(data, 4);
}

void UnaryOp_WithFeedbackDescriptor::InitializePlatformSpecific(
    CallInterfaceDescriptorData* data) {
  // TODO(v8:8888): Implement on this platform.
  DefaultInitializePlatformSpecific(data, 3);
}

329 330 331 332
}  // namespace internal
}  // namespace v8

#endif  // V8_TARGET_ARCH_S390