11cb0ef41Sopenharmony_ci// Copyright 2021 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#ifndef V8_CODEGEN_S390_INTERFACE_DESCRIPTORS_S390_INL_H_ 61cb0ef41Sopenharmony_ci#define V8_CODEGEN_S390_INTERFACE_DESCRIPTORS_S390_INL_H_ 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci#if V8_TARGET_ARCH_S390 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci#include "src/codegen/interface-descriptors.h" 111cb0ef41Sopenharmony_ci#include "src/execution/frames.h" 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_cinamespace v8 { 141cb0ef41Sopenharmony_cinamespace internal { 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ciconstexpr auto CallInterfaceDescriptor::DefaultRegisterArray() { 171cb0ef41Sopenharmony_ci auto registers = RegisterArray(r2, r3, r4, r5, r6); 181cb0ef41Sopenharmony_ci STATIC_ASSERT(registers.size() == kMaxBuiltinRegisterParams); 191cb0ef41Sopenharmony_ci return registers; 201cb0ef41Sopenharmony_ci} 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ci#if DEBUG 231cb0ef41Sopenharmony_citemplate <typename DerivedDescriptor> 241cb0ef41Sopenharmony_civoid StaticCallInterfaceDescriptor<DerivedDescriptor>:: 251cb0ef41Sopenharmony_ci VerifyArgumentRegisterCount(CallInterfaceDescriptorData* data, int argc) { 261cb0ef41Sopenharmony_ci RegList allocatable_regs = data->allocatable_registers(); 271cb0ef41Sopenharmony_ci if (argc >= 1) DCHECK(allocatable_regs.has(r2)); 281cb0ef41Sopenharmony_ci if (argc >= 2) DCHECK(allocatable_regs.has(r3)); 291cb0ef41Sopenharmony_ci if (argc >= 3) DCHECK(allocatable_regs.has(r4)); 301cb0ef41Sopenharmony_ci if (argc >= 4) DCHECK(allocatable_regs.has(r5)); 311cb0ef41Sopenharmony_ci if (argc >= 5) DCHECK(allocatable_regs.has(r6)); 321cb0ef41Sopenharmony_ci if (argc >= 6) DCHECK(allocatable_regs.has(r7)); 331cb0ef41Sopenharmony_ci if (argc >= 7) DCHECK(allocatable_regs.has(r8)); 341cb0ef41Sopenharmony_ci if (argc >= 8) DCHECK(allocatable_regs.has(r9)); 351cb0ef41Sopenharmony_ci // Additional arguments are passed on the stack. 361cb0ef41Sopenharmony_ci} 371cb0ef41Sopenharmony_ci#endif // DEBUG 381cb0ef41Sopenharmony_ci 391cb0ef41Sopenharmony_ci// static 401cb0ef41Sopenharmony_ciconstexpr auto WriteBarrierDescriptor::registers() { 411cb0ef41Sopenharmony_ci return RegisterArray(r3, r7, r6, r4, r2, r5, kContextRegister); 421cb0ef41Sopenharmony_ci} 431cb0ef41Sopenharmony_ci 441cb0ef41Sopenharmony_ci// static 451cb0ef41Sopenharmony_ciconstexpr Register LoadDescriptor::ReceiverRegister() { return r3; } 461cb0ef41Sopenharmony_ci// static 471cb0ef41Sopenharmony_ciconstexpr Register LoadDescriptor::NameRegister() { return r4; } 481cb0ef41Sopenharmony_ci// static 491cb0ef41Sopenharmony_ciconstexpr Register LoadDescriptor::SlotRegister() { return r2; } 501cb0ef41Sopenharmony_ci 511cb0ef41Sopenharmony_ci// static 521cb0ef41Sopenharmony_ciconstexpr Register LoadWithVectorDescriptor::VectorRegister() { return r5; } 531cb0ef41Sopenharmony_ci 541cb0ef41Sopenharmony_ci// static 551cb0ef41Sopenharmony_ciconstexpr Register KeyedLoadBaselineDescriptor::ReceiverRegister() { 561cb0ef41Sopenharmony_ci return r3; 571cb0ef41Sopenharmony_ci} 581cb0ef41Sopenharmony_ci// static 591cb0ef41Sopenharmony_ciconstexpr Register KeyedLoadBaselineDescriptor::NameRegister() { 601cb0ef41Sopenharmony_ci return kInterpreterAccumulatorRegister; 611cb0ef41Sopenharmony_ci} 621cb0ef41Sopenharmony_ci// static 631cb0ef41Sopenharmony_ciconstexpr Register KeyedLoadBaselineDescriptor::SlotRegister() { return r4; } 641cb0ef41Sopenharmony_ci 651cb0ef41Sopenharmony_ci// static 661cb0ef41Sopenharmony_ciconstexpr Register KeyedLoadWithVectorDescriptor::VectorRegister() { 671cb0ef41Sopenharmony_ci return r5; 681cb0ef41Sopenharmony_ci} 691cb0ef41Sopenharmony_ci 701cb0ef41Sopenharmony_ci// static 711cb0ef41Sopenharmony_ciconstexpr Register KeyedHasICBaselineDescriptor::ReceiverRegister() { 721cb0ef41Sopenharmony_ci return kInterpreterAccumulatorRegister; 731cb0ef41Sopenharmony_ci} 741cb0ef41Sopenharmony_ci// static 751cb0ef41Sopenharmony_ciconstexpr Register KeyedHasICBaselineDescriptor::NameRegister() { return r3; } 761cb0ef41Sopenharmony_ci// static 771cb0ef41Sopenharmony_ciconstexpr Register KeyedHasICBaselineDescriptor::SlotRegister() { return r4; } 781cb0ef41Sopenharmony_ci 791cb0ef41Sopenharmony_ci// static 801cb0ef41Sopenharmony_ciconstexpr Register KeyedHasICWithVectorDescriptor::VectorRegister() { 811cb0ef41Sopenharmony_ci return r5; 821cb0ef41Sopenharmony_ci} 831cb0ef41Sopenharmony_ci 841cb0ef41Sopenharmony_ci// static 851cb0ef41Sopenharmony_ciconstexpr Register 861cb0ef41Sopenharmony_ciLoadWithReceiverAndVectorDescriptor::LookupStartObjectRegister() { 871cb0ef41Sopenharmony_ci return r6; 881cb0ef41Sopenharmony_ci} 891cb0ef41Sopenharmony_ci 901cb0ef41Sopenharmony_ci// static 911cb0ef41Sopenharmony_ciconstexpr Register StoreDescriptor::ReceiverRegister() { return r3; } 921cb0ef41Sopenharmony_ci// static 931cb0ef41Sopenharmony_ciconstexpr Register StoreDescriptor::NameRegister() { return r4; } 941cb0ef41Sopenharmony_ci// static 951cb0ef41Sopenharmony_ciconstexpr Register StoreDescriptor::ValueRegister() { return r2; } 961cb0ef41Sopenharmony_ci// static 971cb0ef41Sopenharmony_ciconstexpr Register StoreDescriptor::SlotRegister() { return r6; } 981cb0ef41Sopenharmony_ci 991cb0ef41Sopenharmony_ci// static 1001cb0ef41Sopenharmony_ciconstexpr Register StoreWithVectorDescriptor::VectorRegister() { return r5; } 1011cb0ef41Sopenharmony_ci 1021cb0ef41Sopenharmony_ci// static 1031cb0ef41Sopenharmony_ciconstexpr Register StoreTransitionDescriptor::MapRegister() { return r7; } 1041cb0ef41Sopenharmony_ci 1051cb0ef41Sopenharmony_ci// static 1061cb0ef41Sopenharmony_ciconstexpr Register ApiGetterDescriptor::HolderRegister() { return r2; } 1071cb0ef41Sopenharmony_ci// static 1081cb0ef41Sopenharmony_ciconstexpr Register ApiGetterDescriptor::CallbackRegister() { return r5; } 1091cb0ef41Sopenharmony_ci 1101cb0ef41Sopenharmony_ci// static 1111cb0ef41Sopenharmony_ciconstexpr Register GrowArrayElementsDescriptor::ObjectRegister() { return r2; } 1121cb0ef41Sopenharmony_ci// static 1131cb0ef41Sopenharmony_ciconstexpr Register GrowArrayElementsDescriptor::KeyRegister() { return r5; } 1141cb0ef41Sopenharmony_ci 1151cb0ef41Sopenharmony_ci// static 1161cb0ef41Sopenharmony_ciconstexpr Register BaselineLeaveFrameDescriptor::ParamsSizeRegister() { 1171cb0ef41Sopenharmony_ci // TODO(v8:11421): Implement on this platform. 1181cb0ef41Sopenharmony_ci return r5; 1191cb0ef41Sopenharmony_ci} 1201cb0ef41Sopenharmony_ci// static 1211cb0ef41Sopenharmony_ciconstexpr Register BaselineLeaveFrameDescriptor::WeightRegister() { 1221cb0ef41Sopenharmony_ci // TODO(v8:11421): Implement on this platform. 1231cb0ef41Sopenharmony_ci return r6; 1241cb0ef41Sopenharmony_ci} 1251cb0ef41Sopenharmony_ci 1261cb0ef41Sopenharmony_ci// static 1271cb0ef41Sopenharmony_ci// static 1281cb0ef41Sopenharmony_ciconstexpr Register TypeConversionDescriptor::ArgumentRegister() { return r2; } 1291cb0ef41Sopenharmony_ci 1301cb0ef41Sopenharmony_ci// static 1311cb0ef41Sopenharmony_ciconstexpr auto TypeofDescriptor::registers() { return RegisterArray(r2); } 1321cb0ef41Sopenharmony_ci 1331cb0ef41Sopenharmony_ci// static 1341cb0ef41Sopenharmony_ciconstexpr auto CallTrampolineDescriptor::registers() { 1351cb0ef41Sopenharmony_ci // r2 : number of arguments 1361cb0ef41Sopenharmony_ci // r3 : the target to call 1371cb0ef41Sopenharmony_ci return RegisterArray(r3, r2); 1381cb0ef41Sopenharmony_ci} 1391cb0ef41Sopenharmony_ci 1401cb0ef41Sopenharmony_ci// static 1411cb0ef41Sopenharmony_ciconstexpr auto CopyDataPropertiesWithExcludedPropertiesDescriptor::registers() { 1421cb0ef41Sopenharmony_ci // r3 : the source 1431cb0ef41Sopenharmony_ci // r2 : the excluded property count 1441cb0ef41Sopenharmony_ci return RegisterArray(r3, r2); 1451cb0ef41Sopenharmony_ci} 1461cb0ef41Sopenharmony_ci 1471cb0ef41Sopenharmony_ci// static 1481cb0ef41Sopenharmony_ciconstexpr auto 1491cb0ef41Sopenharmony_ciCopyDataPropertiesWithExcludedPropertiesOnStackDescriptor::registers() { 1501cb0ef41Sopenharmony_ci // r3 : the source 1511cb0ef41Sopenharmony_ci // r2 : the excluded property count 1521cb0ef41Sopenharmony_ci // r4 : the excluded property base 1531cb0ef41Sopenharmony_ci return RegisterArray(r3, r2, r4); 1541cb0ef41Sopenharmony_ci} 1551cb0ef41Sopenharmony_ci 1561cb0ef41Sopenharmony_ci// static 1571cb0ef41Sopenharmony_ciconstexpr auto CallVarargsDescriptor::registers() { 1581cb0ef41Sopenharmony_ci // r2 : number of arguments (on the stack) 1591cb0ef41Sopenharmony_ci // r3 : the target to call 1601cb0ef41Sopenharmony_ci // r6 : arguments list length (untagged) 1611cb0ef41Sopenharmony_ci // r4 : arguments list (FixedArray) 1621cb0ef41Sopenharmony_ci return RegisterArray(r3, r2, r6, r4); 1631cb0ef41Sopenharmony_ci} 1641cb0ef41Sopenharmony_ci 1651cb0ef41Sopenharmony_ci// static 1661cb0ef41Sopenharmony_ciconstexpr auto CallForwardVarargsDescriptor::registers() { 1671cb0ef41Sopenharmony_ci // r2 : number of arguments 1681cb0ef41Sopenharmony_ci // r4 : start index (to support rest parameters) 1691cb0ef41Sopenharmony_ci // r3 : the target to call 1701cb0ef41Sopenharmony_ci return RegisterArray(r3, r2, r4); 1711cb0ef41Sopenharmony_ci} 1721cb0ef41Sopenharmony_ci 1731cb0ef41Sopenharmony_ci// static 1741cb0ef41Sopenharmony_ciconstexpr auto CallFunctionTemplateDescriptor::registers() { 1751cb0ef41Sopenharmony_ci // r3 : function template info 1761cb0ef41Sopenharmony_ci // r4 : number of arguments (on the stack) 1771cb0ef41Sopenharmony_ci return RegisterArray(r3, r4); 1781cb0ef41Sopenharmony_ci} 1791cb0ef41Sopenharmony_ci 1801cb0ef41Sopenharmony_ci// static 1811cb0ef41Sopenharmony_ciconstexpr auto CallWithSpreadDescriptor::registers() { 1821cb0ef41Sopenharmony_ci // r2: number of arguments (on the stack) 1831cb0ef41Sopenharmony_ci // r3 : the target to call 1841cb0ef41Sopenharmony_ci // r4 : the object to spread 1851cb0ef41Sopenharmony_ci return RegisterArray(r3, r2, r4); 1861cb0ef41Sopenharmony_ci} 1871cb0ef41Sopenharmony_ci 1881cb0ef41Sopenharmony_ci// static 1891cb0ef41Sopenharmony_ciconstexpr auto CallWithArrayLikeDescriptor::registers() { 1901cb0ef41Sopenharmony_ci // r3 : the target to call 1911cb0ef41Sopenharmony_ci // r4 : the arguments list 1921cb0ef41Sopenharmony_ci return RegisterArray(r3, r4); 1931cb0ef41Sopenharmony_ci} 1941cb0ef41Sopenharmony_ci 1951cb0ef41Sopenharmony_ci// static 1961cb0ef41Sopenharmony_ciconstexpr auto ConstructVarargsDescriptor::registers() { 1971cb0ef41Sopenharmony_ci // r2 : number of arguments (on the stack) 1981cb0ef41Sopenharmony_ci // r3 : the target to call 1991cb0ef41Sopenharmony_ci // r5 : the new target 2001cb0ef41Sopenharmony_ci // r6 : arguments list length (untagged) 2011cb0ef41Sopenharmony_ci // r4 : arguments list (FixedArray) 2021cb0ef41Sopenharmony_ci return RegisterArray(r3, r5, r2, r6, r4); 2031cb0ef41Sopenharmony_ci} 2041cb0ef41Sopenharmony_ci 2051cb0ef41Sopenharmony_ci// static 2061cb0ef41Sopenharmony_ciconstexpr auto ConstructForwardVarargsDescriptor::registers() { 2071cb0ef41Sopenharmony_ci // r2 : number of arguments 2081cb0ef41Sopenharmony_ci // r5 : the new target 2091cb0ef41Sopenharmony_ci // r4 : start index (to support rest parameters) 2101cb0ef41Sopenharmony_ci // r3 : the target to call 2111cb0ef41Sopenharmony_ci return RegisterArray(r3, r5, r2, r4); 2121cb0ef41Sopenharmony_ci} 2131cb0ef41Sopenharmony_ci 2141cb0ef41Sopenharmony_ci// static 2151cb0ef41Sopenharmony_ciconstexpr auto ConstructWithSpreadDescriptor::registers() { 2161cb0ef41Sopenharmony_ci // r2 : number of arguments (on the stack) 2171cb0ef41Sopenharmony_ci // r3 : the target to call 2181cb0ef41Sopenharmony_ci // r5 : the new target 2191cb0ef41Sopenharmony_ci // r4 : the object to spread 2201cb0ef41Sopenharmony_ci return RegisterArray(r3, r5, r2, r4); 2211cb0ef41Sopenharmony_ci} 2221cb0ef41Sopenharmony_ci 2231cb0ef41Sopenharmony_ci// static 2241cb0ef41Sopenharmony_ciconstexpr auto ConstructWithArrayLikeDescriptor::registers() { 2251cb0ef41Sopenharmony_ci // r3 : the target to call 2261cb0ef41Sopenharmony_ci // r5 : the new target 2271cb0ef41Sopenharmony_ci // r4 : the arguments list 2281cb0ef41Sopenharmony_ci return RegisterArray(r3, r5, r4); 2291cb0ef41Sopenharmony_ci} 2301cb0ef41Sopenharmony_ci 2311cb0ef41Sopenharmony_ci// static 2321cb0ef41Sopenharmony_ciconstexpr auto ConstructStubDescriptor::registers() { 2331cb0ef41Sopenharmony_ci // r2 : number of arguments 2341cb0ef41Sopenharmony_ci // r3 : the target to call 2351cb0ef41Sopenharmony_ci // r5 : the new target 2361cb0ef41Sopenharmony_ci // r4 : allocation site or undefined 2371cb0ef41Sopenharmony_ci return RegisterArray(r3, r5, r2, r4); 2381cb0ef41Sopenharmony_ci} 2391cb0ef41Sopenharmony_ci 2401cb0ef41Sopenharmony_ci// static 2411cb0ef41Sopenharmony_ciconstexpr auto AbortDescriptor::registers() { return RegisterArray(r3); } 2421cb0ef41Sopenharmony_ci 2431cb0ef41Sopenharmony_ci// static 2441cb0ef41Sopenharmony_ciconstexpr auto CompareDescriptor::registers() { return RegisterArray(r3, r2); } 2451cb0ef41Sopenharmony_ci 2461cb0ef41Sopenharmony_ci// static 2471cb0ef41Sopenharmony_ciconstexpr auto Compare_BaselineDescriptor::registers() { 2481cb0ef41Sopenharmony_ci return RegisterArray(r3, r2, r4); 2491cb0ef41Sopenharmony_ci} 2501cb0ef41Sopenharmony_ci 2511cb0ef41Sopenharmony_ci// static 2521cb0ef41Sopenharmony_ciconstexpr auto BinaryOpDescriptor::registers() { return RegisterArray(r3, r2); } 2531cb0ef41Sopenharmony_ci 2541cb0ef41Sopenharmony_ci// static 2551cb0ef41Sopenharmony_ciconstexpr auto BinaryOp_BaselineDescriptor::registers() { 2561cb0ef41Sopenharmony_ci return RegisterArray(r3, r2, r4); 2571cb0ef41Sopenharmony_ci} 2581cb0ef41Sopenharmony_ci 2591cb0ef41Sopenharmony_ci// static 2601cb0ef41Sopenharmony_ciconstexpr auto BinarySmiOp_BaselineDescriptor::registers() { 2611cb0ef41Sopenharmony_ci return RegisterArray(r2, r3, r4); 2621cb0ef41Sopenharmony_ci} 2631cb0ef41Sopenharmony_ci 2641cb0ef41Sopenharmony_ci// static 2651cb0ef41Sopenharmony_ciconstexpr auto ApiCallbackDescriptor::registers() { 2661cb0ef41Sopenharmony_ci return RegisterArray(r3, // kApiFunctionAddress 2671cb0ef41Sopenharmony_ci r4, // kArgc 2681cb0ef41Sopenharmony_ci r5, // kCallData 2691cb0ef41Sopenharmony_ci r2); // kHolder 2701cb0ef41Sopenharmony_ci} 2711cb0ef41Sopenharmony_ci 2721cb0ef41Sopenharmony_ci// static 2731cb0ef41Sopenharmony_ciconstexpr auto InterpreterDispatchDescriptor::registers() { 2741cb0ef41Sopenharmony_ci return RegisterArray( 2751cb0ef41Sopenharmony_ci kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister, 2761cb0ef41Sopenharmony_ci kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister); 2771cb0ef41Sopenharmony_ci} 2781cb0ef41Sopenharmony_ci 2791cb0ef41Sopenharmony_ci// static 2801cb0ef41Sopenharmony_ciconstexpr auto InterpreterPushArgsThenCallDescriptor::registers() { 2811cb0ef41Sopenharmony_ci return RegisterArray(r2, // argument count 2821cb0ef41Sopenharmony_ci r4, // address of first argument 2831cb0ef41Sopenharmony_ci r3); // the target callable to be call 2841cb0ef41Sopenharmony_ci} 2851cb0ef41Sopenharmony_ci 2861cb0ef41Sopenharmony_ci// static 2871cb0ef41Sopenharmony_ciconstexpr auto InterpreterPushArgsThenConstructDescriptor::registers() { 2881cb0ef41Sopenharmony_ci return RegisterArray( 2891cb0ef41Sopenharmony_ci r2, // argument count 2901cb0ef41Sopenharmony_ci r6, // address of the first argument 2911cb0ef41Sopenharmony_ci r3, // constructor to call 2921cb0ef41Sopenharmony_ci r5, // new target 2931cb0ef41Sopenharmony_ci r4); // allocation site feedback if available, undefined otherwise 2941cb0ef41Sopenharmony_ci} 2951cb0ef41Sopenharmony_ci 2961cb0ef41Sopenharmony_ci// static 2971cb0ef41Sopenharmony_ciconstexpr auto ResumeGeneratorDescriptor::registers() { 2981cb0ef41Sopenharmony_ci return RegisterArray(r2, // the value to pass to the generator 2991cb0ef41Sopenharmony_ci r3); // the JSGeneratorObject to resume 3001cb0ef41Sopenharmony_ci} 3011cb0ef41Sopenharmony_ci 3021cb0ef41Sopenharmony_ci// static 3031cb0ef41Sopenharmony_ciconstexpr auto RunMicrotasksEntryDescriptor::registers() { 3041cb0ef41Sopenharmony_ci return RegisterArray(r2, r3); 3051cb0ef41Sopenharmony_ci} 3061cb0ef41Sopenharmony_ci 3071cb0ef41Sopenharmony_ci} // namespace internal 3081cb0ef41Sopenharmony_ci} // namespace v8 3091cb0ef41Sopenharmony_ci 3101cb0ef41Sopenharmony_ci#endif // V8_TARGET_ARCH_S390 3111cb0ef41Sopenharmony_ci 3121cb0ef41Sopenharmony_ci#endif // V8_CODEGEN_S390_INTERFACE_DESCRIPTORS_S390_INL_H_ 313