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_ARM_INTERFACE_DESCRIPTORS_ARM_INL_H_ 61cb0ef41Sopenharmony_ci#define V8_CODEGEN_ARM_INTERFACE_DESCRIPTORS_ARM_INL_H_ 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci#if V8_TARGET_ARCH_ARM 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(r0, r1, r2, r3, r4); 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(r0)); 281cb0ef41Sopenharmony_ci if (argc >= 2) DCHECK(allocatable_regs.has(r1)); 291cb0ef41Sopenharmony_ci if (argc >= 3) DCHECK(allocatable_regs.has(r2)); 301cb0ef41Sopenharmony_ci if (argc >= 4) DCHECK(allocatable_regs.has(r3)); 311cb0ef41Sopenharmony_ci if (argc >= 5) DCHECK(allocatable_regs.has(r4)); 321cb0ef41Sopenharmony_ci if (argc >= 6) DCHECK(allocatable_regs.has(r5)); 331cb0ef41Sopenharmony_ci if (argc >= 7) DCHECK(allocatable_regs.has(r6)); 341cb0ef41Sopenharmony_ci if (argc >= 8) DCHECK(allocatable_regs.has(r7)); 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(r1, r5, r4, r2, r0, r3, kContextRegister); 421cb0ef41Sopenharmony_ci} 431cb0ef41Sopenharmony_ci 441cb0ef41Sopenharmony_ci// static 451cb0ef41Sopenharmony_ciconstexpr Register LoadDescriptor::ReceiverRegister() { return r1; } 461cb0ef41Sopenharmony_ci// static 471cb0ef41Sopenharmony_ciconstexpr Register LoadDescriptor::NameRegister() { return r2; } 481cb0ef41Sopenharmony_ci// static 491cb0ef41Sopenharmony_ciconstexpr Register LoadDescriptor::SlotRegister() { return r0; } 501cb0ef41Sopenharmony_ci 511cb0ef41Sopenharmony_ci// static 521cb0ef41Sopenharmony_ciconstexpr Register LoadWithVectorDescriptor::VectorRegister() { return r3; } 531cb0ef41Sopenharmony_ci 541cb0ef41Sopenharmony_ci// static 551cb0ef41Sopenharmony_ciconstexpr Register KeyedLoadBaselineDescriptor::ReceiverRegister() { 561cb0ef41Sopenharmony_ci return r1; 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 r2; } 641cb0ef41Sopenharmony_ci 651cb0ef41Sopenharmony_ci// static 661cb0ef41Sopenharmony_ciconstexpr Register KeyedLoadWithVectorDescriptor::VectorRegister() { 671cb0ef41Sopenharmony_ci return r3; 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 r1; } 761cb0ef41Sopenharmony_ci// static 771cb0ef41Sopenharmony_ciconstexpr Register KeyedHasICBaselineDescriptor::SlotRegister() { return r2; } 781cb0ef41Sopenharmony_ci 791cb0ef41Sopenharmony_ci// static 801cb0ef41Sopenharmony_ciconstexpr Register KeyedHasICWithVectorDescriptor::VectorRegister() { 811cb0ef41Sopenharmony_ci return r3; 821cb0ef41Sopenharmony_ci} 831cb0ef41Sopenharmony_ci 841cb0ef41Sopenharmony_ci// static 851cb0ef41Sopenharmony_ciconstexpr Register 861cb0ef41Sopenharmony_ciLoadWithReceiverAndVectorDescriptor::LookupStartObjectRegister() { 871cb0ef41Sopenharmony_ci return r4; 881cb0ef41Sopenharmony_ci} 891cb0ef41Sopenharmony_ci 901cb0ef41Sopenharmony_ci// static 911cb0ef41Sopenharmony_ciconstexpr Register StoreDescriptor::ReceiverRegister() { return r1; } 921cb0ef41Sopenharmony_ci// static 931cb0ef41Sopenharmony_ciconstexpr Register StoreDescriptor::NameRegister() { return r2; } 941cb0ef41Sopenharmony_ci// static 951cb0ef41Sopenharmony_ciconstexpr Register StoreDescriptor::ValueRegister() { return r0; } 961cb0ef41Sopenharmony_ci// static 971cb0ef41Sopenharmony_ciconstexpr Register StoreDescriptor::SlotRegister() { return r4; } 981cb0ef41Sopenharmony_ci 991cb0ef41Sopenharmony_ci// static 1001cb0ef41Sopenharmony_ciconstexpr Register StoreWithVectorDescriptor::VectorRegister() { return r3; } 1011cb0ef41Sopenharmony_ci 1021cb0ef41Sopenharmony_ci// static 1031cb0ef41Sopenharmony_ciconstexpr Register StoreTransitionDescriptor::MapRegister() { return r5; } 1041cb0ef41Sopenharmony_ci 1051cb0ef41Sopenharmony_ci// static 1061cb0ef41Sopenharmony_ciconstexpr Register ApiGetterDescriptor::HolderRegister() { return r0; } 1071cb0ef41Sopenharmony_ci// static 1081cb0ef41Sopenharmony_ciconstexpr Register ApiGetterDescriptor::CallbackRegister() { return r3; } 1091cb0ef41Sopenharmony_ci 1101cb0ef41Sopenharmony_ci// static 1111cb0ef41Sopenharmony_ciconstexpr Register GrowArrayElementsDescriptor::ObjectRegister() { return r0; } 1121cb0ef41Sopenharmony_ci// static 1131cb0ef41Sopenharmony_ciconstexpr Register GrowArrayElementsDescriptor::KeyRegister() { return r3; } 1141cb0ef41Sopenharmony_ci 1151cb0ef41Sopenharmony_ci// static 1161cb0ef41Sopenharmony_ciconstexpr Register BaselineLeaveFrameDescriptor::ParamsSizeRegister() { 1171cb0ef41Sopenharmony_ci return r3; 1181cb0ef41Sopenharmony_ci} 1191cb0ef41Sopenharmony_ci// static 1201cb0ef41Sopenharmony_ciconstexpr Register BaselineLeaveFrameDescriptor::WeightRegister() { return r4; } 1211cb0ef41Sopenharmony_ci 1221cb0ef41Sopenharmony_ci// static 1231cb0ef41Sopenharmony_ci// static 1241cb0ef41Sopenharmony_ciconstexpr Register TypeConversionDescriptor::ArgumentRegister() { return r0; } 1251cb0ef41Sopenharmony_ci 1261cb0ef41Sopenharmony_ci// static 1271cb0ef41Sopenharmony_ciconstexpr auto TypeofDescriptor::registers() { return RegisterArray(r0); } 1281cb0ef41Sopenharmony_ci 1291cb0ef41Sopenharmony_ci// static 1301cb0ef41Sopenharmony_ciconstexpr auto CallTrampolineDescriptor::registers() { 1311cb0ef41Sopenharmony_ci // r0 : number of arguments 1321cb0ef41Sopenharmony_ci // r1 : the target to call 1331cb0ef41Sopenharmony_ci return RegisterArray(r1, r0); 1341cb0ef41Sopenharmony_ci} 1351cb0ef41Sopenharmony_ci 1361cb0ef41Sopenharmony_ci// static 1371cb0ef41Sopenharmony_ciconstexpr auto CopyDataPropertiesWithExcludedPropertiesDescriptor::registers() { 1381cb0ef41Sopenharmony_ci // r0 : the source 1391cb0ef41Sopenharmony_ci // r1 : the excluded property count 1401cb0ef41Sopenharmony_ci return RegisterArray(r1, r0); 1411cb0ef41Sopenharmony_ci} 1421cb0ef41Sopenharmony_ci 1431cb0ef41Sopenharmony_ci// static 1441cb0ef41Sopenharmony_ciconstexpr auto 1451cb0ef41Sopenharmony_ciCopyDataPropertiesWithExcludedPropertiesOnStackDescriptor::registers() { 1461cb0ef41Sopenharmony_ci // r0 : the source 1471cb0ef41Sopenharmony_ci // r1 : the excluded property count 1481cb0ef41Sopenharmony_ci // r2 : the excluded property base 1491cb0ef41Sopenharmony_ci return RegisterArray(r1, r0, r2); 1501cb0ef41Sopenharmony_ci} 1511cb0ef41Sopenharmony_ci 1521cb0ef41Sopenharmony_ci// static 1531cb0ef41Sopenharmony_ciconstexpr auto CallVarargsDescriptor::registers() { 1541cb0ef41Sopenharmony_ci // r0 : number of arguments (on the stack) 1551cb0ef41Sopenharmony_ci // r1 : the target to call 1561cb0ef41Sopenharmony_ci // r4 : arguments list length (untagged) 1571cb0ef41Sopenharmony_ci // r2 : arguments list (FixedArray) 1581cb0ef41Sopenharmony_ci return RegisterArray(r1, r0, r4, r2); 1591cb0ef41Sopenharmony_ci} 1601cb0ef41Sopenharmony_ci 1611cb0ef41Sopenharmony_ci// static 1621cb0ef41Sopenharmony_ciconstexpr auto CallForwardVarargsDescriptor::registers() { 1631cb0ef41Sopenharmony_ci // r0 : number of arguments 1641cb0ef41Sopenharmony_ci // r2 : start index (to support rest parameters) 1651cb0ef41Sopenharmony_ci // r1 : the target to call 1661cb0ef41Sopenharmony_ci return RegisterArray(r1, r0, r2); 1671cb0ef41Sopenharmony_ci} 1681cb0ef41Sopenharmony_ci 1691cb0ef41Sopenharmony_ci// static 1701cb0ef41Sopenharmony_ciconstexpr auto CallFunctionTemplateDescriptor::registers() { 1711cb0ef41Sopenharmony_ci // r1 : function template info 1721cb0ef41Sopenharmony_ci // r2 : number of arguments (on the stack) 1731cb0ef41Sopenharmony_ci return RegisterArray(r1, r2); 1741cb0ef41Sopenharmony_ci} 1751cb0ef41Sopenharmony_ci 1761cb0ef41Sopenharmony_ci// static 1771cb0ef41Sopenharmony_ciconstexpr auto CallWithSpreadDescriptor::registers() { 1781cb0ef41Sopenharmony_ci // r0 : number of arguments (on the stack) 1791cb0ef41Sopenharmony_ci // r1 : the target to call 1801cb0ef41Sopenharmony_ci // r2 : the object to spread 1811cb0ef41Sopenharmony_ci return RegisterArray(r1, r0, r2); 1821cb0ef41Sopenharmony_ci} 1831cb0ef41Sopenharmony_ci 1841cb0ef41Sopenharmony_ci// static 1851cb0ef41Sopenharmony_ciconstexpr auto CallWithArrayLikeDescriptor::registers() { 1861cb0ef41Sopenharmony_ci // r1 : the target to call 1871cb0ef41Sopenharmony_ci // r2 : the arguments list 1881cb0ef41Sopenharmony_ci return RegisterArray(r1, r2); 1891cb0ef41Sopenharmony_ci} 1901cb0ef41Sopenharmony_ci 1911cb0ef41Sopenharmony_ci// static 1921cb0ef41Sopenharmony_ciconstexpr auto ConstructVarargsDescriptor::registers() { 1931cb0ef41Sopenharmony_ci // r0 : number of arguments (on the stack) 1941cb0ef41Sopenharmony_ci // r1 : the target to call 1951cb0ef41Sopenharmony_ci // r3 : the new target 1961cb0ef41Sopenharmony_ci // r4 : arguments list length (untagged) 1971cb0ef41Sopenharmony_ci // r2 : arguments list (FixedArray) 1981cb0ef41Sopenharmony_ci return RegisterArray(r1, r3, r0, r4, r2); 1991cb0ef41Sopenharmony_ci} 2001cb0ef41Sopenharmony_ci 2011cb0ef41Sopenharmony_ci// static 2021cb0ef41Sopenharmony_ciconstexpr auto ConstructForwardVarargsDescriptor::registers() { 2031cb0ef41Sopenharmony_ci // r0 : number of arguments 2041cb0ef41Sopenharmony_ci // r3 : the new target 2051cb0ef41Sopenharmony_ci // r2 : start index (to support rest parameters) 2061cb0ef41Sopenharmony_ci // r1 : the target to call 2071cb0ef41Sopenharmony_ci return RegisterArray(r1, r3, r0, r2); 2081cb0ef41Sopenharmony_ci} 2091cb0ef41Sopenharmony_ci 2101cb0ef41Sopenharmony_ci// static 2111cb0ef41Sopenharmony_ciconstexpr auto ConstructWithSpreadDescriptor::registers() { 2121cb0ef41Sopenharmony_ci // r0 : number of arguments (on the stack) 2131cb0ef41Sopenharmony_ci // r1 : the target to call 2141cb0ef41Sopenharmony_ci // r3 : the new target 2151cb0ef41Sopenharmony_ci // r2 : the object to spread 2161cb0ef41Sopenharmony_ci return RegisterArray(r1, r3, r0, r2); 2171cb0ef41Sopenharmony_ci} 2181cb0ef41Sopenharmony_ci 2191cb0ef41Sopenharmony_ci// static 2201cb0ef41Sopenharmony_ciconstexpr auto ConstructWithArrayLikeDescriptor::registers() { 2211cb0ef41Sopenharmony_ci // r1 : the target to call 2221cb0ef41Sopenharmony_ci // r3 : the new target 2231cb0ef41Sopenharmony_ci // r2 : the arguments list 2241cb0ef41Sopenharmony_ci return RegisterArray(r1, r3, r2); 2251cb0ef41Sopenharmony_ci} 2261cb0ef41Sopenharmony_ci 2271cb0ef41Sopenharmony_ci// static 2281cb0ef41Sopenharmony_ciconstexpr auto ConstructStubDescriptor::registers() { 2291cb0ef41Sopenharmony_ci // r0 : number of arguments 2301cb0ef41Sopenharmony_ci // r1 : the target to call 2311cb0ef41Sopenharmony_ci // r3 : the new target 2321cb0ef41Sopenharmony_ci // r2 : allocation site or undefined 2331cb0ef41Sopenharmony_ci return RegisterArray(r1, r3, r0, r2); 2341cb0ef41Sopenharmony_ci} 2351cb0ef41Sopenharmony_ci 2361cb0ef41Sopenharmony_ci// static 2371cb0ef41Sopenharmony_ciconstexpr auto AbortDescriptor::registers() { return RegisterArray(r1); } 2381cb0ef41Sopenharmony_ci 2391cb0ef41Sopenharmony_ci// static 2401cb0ef41Sopenharmony_ciconstexpr auto CompareDescriptor::registers() { return RegisterArray(r1, r0); } 2411cb0ef41Sopenharmony_ci 2421cb0ef41Sopenharmony_ci// static 2431cb0ef41Sopenharmony_ciconstexpr auto Compare_BaselineDescriptor::registers() { 2441cb0ef41Sopenharmony_ci // r1: left operand 2451cb0ef41Sopenharmony_ci // r0: right operand 2461cb0ef41Sopenharmony_ci // r2: feedback slot 2471cb0ef41Sopenharmony_ci return RegisterArray(r1, r0, r2); 2481cb0ef41Sopenharmony_ci} 2491cb0ef41Sopenharmony_ci 2501cb0ef41Sopenharmony_ci// static 2511cb0ef41Sopenharmony_ciconstexpr auto BinaryOpDescriptor::registers() { return RegisterArray(r1, r0); } 2521cb0ef41Sopenharmony_ci 2531cb0ef41Sopenharmony_ci// static 2541cb0ef41Sopenharmony_ciconstexpr auto BinaryOp_BaselineDescriptor::registers() { 2551cb0ef41Sopenharmony_ci // r1: left operand 2561cb0ef41Sopenharmony_ci // r0: right operand 2571cb0ef41Sopenharmony_ci // r2: feedback slot 2581cb0ef41Sopenharmony_ci return RegisterArray(r1, r0, r2); 2591cb0ef41Sopenharmony_ci} 2601cb0ef41Sopenharmony_ci 2611cb0ef41Sopenharmony_ci// static 2621cb0ef41Sopenharmony_ciconstexpr auto BinarySmiOp_BaselineDescriptor::registers() { 2631cb0ef41Sopenharmony_ci // r0: left operand 2641cb0ef41Sopenharmony_ci // r1: right operand 2651cb0ef41Sopenharmony_ci // r2: feedback slot 2661cb0ef41Sopenharmony_ci return RegisterArray(r0, r1, r2); 2671cb0ef41Sopenharmony_ci} 2681cb0ef41Sopenharmony_ci 2691cb0ef41Sopenharmony_ci// static 2701cb0ef41Sopenharmony_ciconstexpr auto ApiCallbackDescriptor::registers() { 2711cb0ef41Sopenharmony_ci return RegisterArray(r1, // kApiFunctionAddress 2721cb0ef41Sopenharmony_ci r2, // kArgc 2731cb0ef41Sopenharmony_ci r3, // kCallData 2741cb0ef41Sopenharmony_ci r0); // kHolder 2751cb0ef41Sopenharmony_ci} 2761cb0ef41Sopenharmony_ci 2771cb0ef41Sopenharmony_ci// static 2781cb0ef41Sopenharmony_ciconstexpr auto InterpreterDispatchDescriptor::registers() { 2791cb0ef41Sopenharmony_ci return RegisterArray( 2801cb0ef41Sopenharmony_ci kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister, 2811cb0ef41Sopenharmony_ci kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister); 2821cb0ef41Sopenharmony_ci} 2831cb0ef41Sopenharmony_ci 2841cb0ef41Sopenharmony_ci// static 2851cb0ef41Sopenharmony_ciconstexpr auto InterpreterPushArgsThenCallDescriptor::registers() { 2861cb0ef41Sopenharmony_ci return RegisterArray(r0, // argument count 2871cb0ef41Sopenharmony_ci r2, // address of first argument 2881cb0ef41Sopenharmony_ci r1); // the target callable to be call 2891cb0ef41Sopenharmony_ci} 2901cb0ef41Sopenharmony_ci 2911cb0ef41Sopenharmony_ci// static 2921cb0ef41Sopenharmony_ciconstexpr auto InterpreterPushArgsThenConstructDescriptor::registers() { 2931cb0ef41Sopenharmony_ci return RegisterArray( 2941cb0ef41Sopenharmony_ci r0, // argument count 2951cb0ef41Sopenharmony_ci r4, // address of the first argument 2961cb0ef41Sopenharmony_ci r1, // constructor to call 2971cb0ef41Sopenharmony_ci r3, // new target 2981cb0ef41Sopenharmony_ci r2); // allocation site feedback if available, undefined otherwise 2991cb0ef41Sopenharmony_ci} 3001cb0ef41Sopenharmony_ci 3011cb0ef41Sopenharmony_ci// static 3021cb0ef41Sopenharmony_ciconstexpr auto ResumeGeneratorDescriptor::registers() { 3031cb0ef41Sopenharmony_ci return RegisterArray(r0, // the value to pass to the generator 3041cb0ef41Sopenharmony_ci r1); // the JSGeneratorObject to resume 3051cb0ef41Sopenharmony_ci} 3061cb0ef41Sopenharmony_ci 3071cb0ef41Sopenharmony_ci// static 3081cb0ef41Sopenharmony_ciconstexpr auto RunMicrotasksEntryDescriptor::registers() { 3091cb0ef41Sopenharmony_ci return RegisterArray(r0, r1); 3101cb0ef41Sopenharmony_ci} 3111cb0ef41Sopenharmony_ci 3121cb0ef41Sopenharmony_ci} // namespace internal 3131cb0ef41Sopenharmony_ci} // namespace v8 3141cb0ef41Sopenharmony_ci 3151cb0ef41Sopenharmony_ci#endif // V8_TARGET_ARCH_ARM 3161cb0ef41Sopenharmony_ci 3171cb0ef41Sopenharmony_ci#endif // V8_CODEGEN_ARM_INTERFACE_DESCRIPTORS_ARM_INL_H_ 318