IonGenericCallStub.h (1423B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * vim: set ts=8 sts=2 et sw=2 tw=80: 3 * This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef jit_IonGenericCallStub_h 8 #define jit_IonGenericCallStub_h 9 10 #include "jit/Registers.h" 11 12 namespace js::jit { 13 14 #ifndef JS_USE_LINK_REGISTER 15 static constexpr Register IonGenericCallReturnAddrReg = CallTempReg0; 16 #endif 17 18 static constexpr Register IonGenericCallCalleeReg = CallTempReg1; 19 static constexpr Register IonGenericCallArgcReg = CallTempReg2; 20 21 #ifdef JS_CODEGEN_ARM 22 // We need a second scratch register that does not alias `lr` or 23 // any of the registers the ABI uses to pass arguments. 24 static_assert(CallTempReg0 == CallTempNonArgRegs[0]); 25 static constexpr Register IonGenericSecondScratchReg = CallTempReg0; 26 #endif 27 28 inline AllocatableGeneralRegisterSet IonGenericCallScratchRegs() { 29 AllocatableGeneralRegisterSet regs(GeneralRegisterSet::All()); 30 MOZ_ASSERT(!regs.has(FramePointer)); 31 regs.take(IonGenericCallCalleeReg); 32 regs.take(IonGenericCallArgcReg); 33 #ifndef JS_USE_LINK_REGISTER 34 regs.take(IonGenericCallReturnAddrReg); 35 #endif 36 #ifdef JS_CODEGEN_ARM 37 regs.take(IonGenericSecondScratchReg); 38 #endif 39 return regs; 40 } 41 42 } // namespace js::jit 43 44 #endif /* jit_IonGenericCallStub_h */