| 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_none_Assembler_none_h |
| 8 |
#define jit_none_Assembler_none_h |
| 9 |
|
| 10 |
#include "mozilla/Assertions.h" |
| 11 |
|
| 12 |
#include <stdint.h> |
| 13 |
|
| 14 |
#include "jit/none/Architecture-none.h" |
| 15 |
#include "jit/Registers.h" |
| 16 |
#include "jit/RegisterSets.h" |
| 17 |
#include "jit/shared/Assembler-shared.h" |
| 18 |
|
| 19 |
namespace js { |
| 20 |
namespace jit { |
| 21 |
|
| 22 |
class MacroAssembler; |
| 23 |
|
| 24 |
static constexpr Register StackPointer{Registers::invalid_reg}; |
| 25 |
static constexpr Register FramePointer{Registers::invalid_reg}; |
| 26 |
static constexpr Register ReturnReg{Registers::invalid_reg2}; |
| 27 |
static constexpr FloatRegister ReturnFloat32Reg = {FloatRegisters::invalid_reg}; |
| 28 |
static constexpr FloatRegister ReturnDoubleReg = {FloatRegisters::invalid_reg}; |
| 29 |
static constexpr FloatRegister ReturnSimd128Reg = {FloatRegisters::invalid_reg}; |
| 30 |
static constexpr FloatRegister ScratchSimd128Reg = { |
| 31 |
FloatRegisters::invalid_reg}; |
| 32 |
static constexpr FloatRegister InvalidFloatReg = {FloatRegisters::invalid_reg}; |
| 33 |
|
| 34 |
struct ScratchFloat32Scope : FloatRegister { |
| 35 |
explicit ScratchFloat32Scope(MacroAssembler& masm) {} |
| 36 |
}; |
| 37 |
|
| 38 |
struct ScratchDoubleScope : FloatRegister { |
| 39 |
explicit ScratchDoubleScope(MacroAssembler& masm) {} |
| 40 |
}; |
| 41 |
|
| 42 |
static constexpr Register OsrFrameReg{Registers::invalid_reg}; |
| 43 |
static constexpr Register PreBarrierReg{Registers::invalid_reg}; |
| 44 |
static constexpr Register InterpreterPCReg{Registers::invalid_reg}; |
| 45 |
static constexpr Register CallTempReg0{Registers::invalid_reg}; |
| 46 |
static constexpr Register CallTempReg1{Registers::invalid_reg}; |
| 47 |
static constexpr Register CallTempReg2{Registers::invalid_reg}; |
| 48 |
static constexpr Register CallTempReg3{Registers::invalid_reg}; |
| 49 |
static constexpr Register CallTempReg4{Registers::invalid_reg}; |
| 50 |
static constexpr Register CallTempReg5{Registers::invalid_reg}; |
| 51 |
static constexpr Register InvalidReg{Registers::invalid_reg}; |
| 52 |
static constexpr Register CallTempNonArgRegs[] = {InvalidReg, InvalidReg}; |
| 53 |
static const uint32_t NumCallTempNonArgRegs = std::size(CallTempNonArgRegs); |
| 54 |
|
| 55 |
static constexpr Register IntArgReg0{Registers::invalid_reg}; |
| 56 |
static constexpr Register IntArgReg1{Registers::invalid_reg}; |
| 57 |
static constexpr Register IntArgReg2{Registers::invalid_reg}; |
| 58 |
static constexpr Register IntArgReg3{Registers::invalid_reg}; |
| 59 |
static constexpr Register HeapReg{Registers::invalid_reg}; |
| 60 |
|
| 61 |
static constexpr Register RegExpMatcherRegExpReg{Registers::invalid_reg}; |
| 62 |
static constexpr Register RegExpMatcherStringReg{Registers::invalid_reg}; |
| 63 |
static constexpr Register RegExpMatcherLastIndexReg{Registers::invalid_reg}; |
| 64 |
|
| 65 |
static constexpr Register RegExpExecTestRegExpReg{Registers::invalid_reg}; |
| 66 |
static constexpr Register RegExpExecTestStringReg{Registers::invalid_reg}; |
| 67 |
|
| 68 |
static constexpr Register RegExpSearcherRegExpReg{Registers::invalid_reg}; |
| 69 |
static constexpr Register RegExpSearcherStringReg{Registers::invalid_reg}; |
| 70 |
static constexpr Register RegExpSearcherLastIndexReg{Registers::invalid_reg}; |
| 71 |
|
| 72 |
// Uses |invalid_reg2| to avoid static_assert failures. |
| 73 |
static constexpr Register JSReturnReg_Type{Registers::invalid_reg2}; |
| 74 |
static constexpr Register JSReturnReg_Data{Registers::invalid_reg2}; |
| 75 |
static constexpr Register JSReturnReg{Registers::invalid_reg2}; |
| 76 |
|
| 77 |
#if defined(JS_NUNBOX32) |
| 78 |
static constexpr ValueOperand JSReturnOperand(InvalidReg, InvalidReg); |
| 79 |
static constexpr Register64 ReturnReg64(InvalidReg, InvalidReg); |
| 80 |
#elif defined(JS_PUNBOX64) |
| 81 |
static constexpr ValueOperand JSReturnOperand(InvalidReg); |
| 82 |
static constexpr Register64 ReturnReg64(InvalidReg); |
| 83 |
#else |
| 84 |
# error "Bad architecture" |
| 85 |
#endif |
| 86 |
|
| 87 |
static constexpr Register ABINonArgReg0{Registers::invalid_reg}; |
| 88 |
static constexpr Register ABINonArgReg1{Registers::invalid_reg}; |
| 89 |
static constexpr Register ABINonArgReg2{Registers::invalid_reg}; |
| 90 |
static constexpr Register ABINonArgReg3{Registers::invalid_reg}; |
| 91 |
static constexpr Register ABINonArgReturnReg0{Registers::invalid_reg}; |
| 92 |
static constexpr Register ABINonArgReturnReg1{Registers::invalid_reg}; |
| 93 |
static constexpr Register ABINonVolatileReg{Registers::invalid_reg}; |
| 94 |
static constexpr Register ABINonArgReturnVolatileReg{Registers::invalid_reg}; |
| 95 |
|
| 96 |
static constexpr FloatRegister ABINonArgDoubleReg = { |
| 97 |
FloatRegisters::invalid_reg}; |
| 98 |
|
| 99 |
static constexpr Register WasmTableCallScratchReg0{Registers::invalid_reg}; |
| 100 |
static constexpr Register WasmTableCallScratchReg1{Registers::invalid_reg}; |
| 101 |
static constexpr Register WasmTableCallSigReg{Registers::invalid_reg}; |
| 102 |
static constexpr Register WasmTableCallIndexReg{Registers::invalid_reg}; |
| 103 |
static constexpr Register InstanceReg{Registers::invalid_reg}; |
| 104 |
static constexpr Register WasmJitEntryReturnScratch{Registers::invalid_reg}; |
| 105 |
static constexpr Register WasmCallRefCallScratchReg0{Registers::invalid_reg}; |
| 106 |
static constexpr Register WasmCallRefCallScratchReg1{Registers::invalid_reg}; |
| 107 |
static constexpr Register WasmCallRefCallScratchReg2{Registers::invalid_reg}; |
| 108 |
static constexpr Register WasmCallRefReg{Registers::invalid_reg}; |
| 109 |
static constexpr Register WasmTailCallInstanceScratchReg{ |
| 110 |
Registers::invalid_reg}; |
| 111 |
static constexpr Register WasmTailCallRAScratchReg{Registers::invalid_reg}; |
| 112 |
static constexpr Register WasmTailCallFPScratchReg{Registers::invalid_reg}; |
| 113 |
|
| 114 |
static constexpr uint32_t ABIStackAlignment = 4; |
| 115 |
static constexpr uint32_t CodeAlignment = 16; |
| 116 |
#ifdef ENABLE_PORTABLE_BASELINE_INTERP |
| 117 |
static constexpr uint32_t JitStackAlignment = sizeof(void*); |
| 118 |
static constexpr uint32_t JitStackValueAlignment = 1; |
| 119 |
#else |
| 120 |
static constexpr uint32_t JitStackAlignment = 8; |
| 121 |
static constexpr uint32_t JitStackValueAlignment = |
| 122 |
JitStackAlignment / sizeof(Value); |
| 123 |
#endif |
| 124 |
|
| 125 |
static const Scale ScalePointer = TimesOne; |
| 126 |
|
| 127 |
class Assembler : public AssemblerShared { |
| 128 |
public: |
| 129 |
enum Condition { |
| 130 |
Equal, |
| 131 |
NotEqual, |
| 132 |
Above, |
| 133 |
AboveOrEqual, |
| 134 |
Below, |
| 135 |
BelowOrEqual, |
| 136 |
GreaterThan, |
| 137 |
GreaterThanOrEqual, |
| 138 |
LessThan, |
| 139 |
LessThanOrEqual, |
| 140 |
Overflow, |
| 141 |
CarrySet, |
| 142 |
CarryClear, |
| 143 |
Signed, |
| 144 |
NotSigned, |
| 145 |
Zero, |
| 146 |
NonZero, |
| 147 |
Always, |
| 148 |
}; |
| 149 |
|
| 150 |
enum DoubleCondition { |
| 151 |
DoubleOrdered, |
| 152 |
DoubleEqual, |
| 153 |
DoubleNotEqual, |
| 154 |
DoubleGreaterThan, |
| 155 |
DoubleGreaterThanOrEqual, |
| 156 |
DoubleLessThan, |
| 157 |
DoubleLessThanOrEqual, |
| 158 |
DoubleUnordered, |
| 159 |
DoubleEqualOrUnordered, |
| 160 |
DoubleNotEqualOrUnordered, |
| 161 |
DoubleGreaterThanOrUnordered, |
| 162 |
DoubleGreaterThanOrEqualOrUnordered, |
| 163 |
DoubleLessThanOrUnordered, |
| 164 |
DoubleLessThanOrEqualOrUnordered |
| 165 |
}; |
| 166 |
|
| 167 |
static Condition InvertCondition(Condition) { MOZ_CRASH(); } |
| 168 |
|
| 169 |
static DoubleCondition InvertCondition(DoubleCondition) { MOZ_CRASH(); } |
| 170 |
|
| 171 |
template <typename T, typename S> |
| 172 |
static void PatchDataWithValueCheck(CodeLocationLabel, T, S) { |
| 173 |
MOZ_CRASH(); |
| 174 |
} |
| 175 |
static void PatchWrite_Imm32(CodeLocationLabel, Imm32) { MOZ_CRASH(); } |
| 176 |
|
| 177 |
static void PatchWrite_NearCall(CodeLocationLabel, CodeLocationLabel) { |
| 178 |
MOZ_CRASH(); |
| 179 |
} |
| 180 |
static uint32_t PatchWrite_NearCallSize() { MOZ_CRASH(); } |
| 181 |
|
| 182 |
static void ToggleToJmp(CodeLocationLabel) { MOZ_CRASH(); } |
| 183 |
static void ToggleToCmp(CodeLocationLabel) { MOZ_CRASH(); } |
| 184 |
static void ToggleCall(CodeLocationLabel, bool) { MOZ_CRASH(); } |
| 185 |
|
| 186 |
static void Bind(uint8_t*, const CodeLabel&) { MOZ_CRASH(); } |
| 187 |
|
| 188 |
static uintptr_t GetPointer(uint8_t*) { MOZ_CRASH(); } |
| 189 |
|
| 190 |
static bool HasRoundInstruction(RoundingMode) { return false; } |
| 191 |
|
| 192 |
void verifyHeapAccessDisassembly(uint32_t begin, uint32_t end, |
| 193 |
const Disassembler::HeapAccess& heapAccess) { |
| 194 |
MOZ_CRASH(); |
| 195 |
} |
| 196 |
|
| 197 |
void setUnlimitedBuffer() { MOZ_CRASH(); } |
| 198 |
}; |
| 199 |
|
| 200 |
class Operand { |
| 201 |
public: |
| 202 |
explicit Operand(const Address&) { MOZ_CRASH(); } |
| 203 |
explicit Operand(const Register) { MOZ_CRASH(); } |
| 204 |
explicit Operand(const FloatRegister) { MOZ_CRASH(); } |
| 205 |
explicit Operand(Register, Imm32) { MOZ_CRASH(); } |
| 206 |
explicit Operand(Register, int32_t) { MOZ_CRASH(); } |
| 207 |
}; |
| 208 |
|
| 209 |
class ABIArgGenerator { |
| 210 |
public: |
| 211 |
ABIArgGenerator() { MOZ_CRASH(); } |
| 212 |
ABIArg next(MIRType) { MOZ_CRASH(); } |
| 213 |
ABIArg& current() { MOZ_CRASH(); } |
| 214 |
uint32_t stackBytesConsumedSoFar() const { MOZ_CRASH(); } |
| 215 |
void increaseStackOffset(uint32_t) { MOZ_CRASH(); } |
| 216 |
}; |
| 217 |
|
| 218 |
} // namespace jit |
| 219 |
} // namespace js |
| 220 |
|
| 221 |
#endif /* jit_none_Assembler_none_h */ |