Debian Codegraph @

js/src/jit/arm64/CodeGenerator-arm64.h

raw
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_arm64_CodeGenerator_arm64_h
8 #define jit_arm64_CodeGenerator_arm64_h
9
10 #include "jit/arm64/Assembler-arm64.h"
11 #include "jit/shared/CodeGenerator-shared.h"
12
13 namespace js {
14 namespace jit {
15
16 class CodeGeneratorARM64;
17 class OutOfLineTableSwitch;
18
19 using OutOfLineWasmTruncateCheck =
20 OutOfLineWasmTruncateCheckBase<CodeGeneratorARM64>;
21
22 class CodeGeneratorARM64 : public CodeGeneratorShared {
23 friend class MoveResolverARM64;
24
25 protected:
26 CodeGeneratorARM64(MIRGenerator* gen, LIRGraph* graph, MacroAssembler* masm,
27 const wasm::CodeMetadata* wasmCodeMeta);
28
29 NonAssertingLabel deoptLabel_;
30
31 MoveOperand toMoveOperand(const LAllocation a) const;
32
33 void bailoutIf(Assembler::Condition condition, LSnapshot* snapshot);
34 void bailoutFrom(Label* label, LSnapshot* snapshot);
35 void bailout(LSnapshot* snapshot);
36
37 template <typename T1, typename T2>
38 void bailoutCmpPtr(Assembler::Condition c, T1 lhs, T2 rhs,
39 LSnapshot* snapshot) {
40 masm.cmpPtr(lhs, rhs);
41 return bailoutIf(c, snapshot);
42 }
43 void bailoutTestPtr(Assembler::Condition c, Register lhs, Register rhs,
44 LSnapshot* snapshot) {
45 masm.testPtr(lhs, rhs);
46 return bailoutIf(c, snapshot);
47 }
48 template <typename T1, typename T2>
49 void bailoutCmp32(Assembler::Condition c, T1 lhs, T2 rhs,
50 LSnapshot* snapshot) {
51 masm.cmp32(lhs, rhs);
52 return bailoutIf(c, snapshot);
53 }
54 template <typename T1, typename T2>
55 void bailoutTest32(Assembler::Condition c, T1 lhs, T2 rhs,
56 LSnapshot* snapshot) {
57 masm.test32(lhs, rhs);
58 return bailoutIf(c, snapshot);
59 }
60 void bailoutIfFalseBool(Register reg, LSnapshot* snapshot) {
61 masm.test32(reg, Imm32(0xFF));
62 return bailoutIf(Assembler::Zero, snapshot);
63 }
64
65 bool generateOutOfLineCode();
66
67 // Emits a branch that directs control flow to the true block if |cond| is
68 // true, and the false block if |cond| is false.
69 void emitBranch(Assembler::Condition cond, MBasicBlock* ifTrue,
70 MBasicBlock* ifFalse);
71
72 void emitTableSwitchDispatch(MTableSwitch* mir, Register index,
73 Register base);
74
75 void emitBigIntPtrDiv(LBigIntPtrDiv* ins, Register dividend, Register divisor,
76 Register output);
77 void emitBigIntPtrMod(LBigIntPtrMod* ins, Register dividend, Register divisor,
78 Register output);
79
80 void generateInvalidateEpilogue();
81
82 public:
83 void emitBailoutOOL(LSnapshot* snapshot);
84
85 void visitOutOfLineTableSwitch(OutOfLineTableSwitch* ool);
86 void visitOutOfLineWasmTruncateCheck(OutOfLineWasmTruncateCheck* ool);
87 };
88
89 using CodeGeneratorSpecific = CodeGeneratorARM64;
90
91 } // namespace jit
92 } // namespace js
93
94 #endif /* jit_arm64_CodeGenerator_arm64_h */