tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

CodeGenerator-arm.h (4147B)


      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_arm_CodeGenerator_arm_h
      8 #define jit_arm_CodeGenerator_arm_h
      9 
     10 #include "jit/arm/Assembler-arm.h"
     11 #include "jit/shared/CodeGenerator-shared.h"
     12 #include "js/ScalarType.h"  // js::Scalar::Type
     13 
     14 namespace js {
     15 namespace jit {
     16 
     17 class CodeGeneratorARM;
     18 class OutOfLineTableSwitch;
     19 
     20 using OutOfLineWasmTruncateCheck =
     21    OutOfLineWasmTruncateCheckBase<CodeGeneratorARM>;
     22 
     23 class CodeGeneratorARM : public CodeGeneratorShared {
     24  friend class MoveResolverARM;
     25 
     26 protected:
     27  CodeGeneratorARM(MIRGenerator* gen, LIRGraph* graph, MacroAssembler* masm,
     28                   const wasm::CodeMetadata* wasmCodeMeta);
     29 
     30  NonAssertingLabel deoptLabel_;
     31 
     32  MoveOperand toMoveOperand(LAllocation a) const;
     33 
     34  void bailoutIf(Assembler::Condition condition, LSnapshot* snapshot);
     35  void bailoutFrom(Label* label, LSnapshot* snapshot);
     36  void bailout(LSnapshot* snapshot);
     37 
     38  template <typename T1, typename T2>
     39  void bailoutCmpPtr(Assembler::Condition c, T1 lhs, T2 rhs,
     40                     LSnapshot* snapshot) {
     41    masm.cmpPtr(lhs, rhs);
     42    bailoutIf(c, snapshot);
     43  }
     44  template <typename T1, typename T2>
     45  void bailoutCmp32(Assembler::Condition c, T1 lhs, T2 rhs,
     46                    LSnapshot* snapshot) {
     47    masm.cmp32(lhs, rhs);
     48    bailoutIf(c, snapshot);
     49  }
     50  template <typename T1, typename T2>
     51  void bailoutTest32(Assembler::Condition c, T1 lhs, T2 rhs,
     52                     LSnapshot* snapshot) {
     53    masm.test32(lhs, rhs);
     54    bailoutIf(c, snapshot);
     55  }
     56  void bailoutIfFalseBool(Register reg, LSnapshot* snapshot) {
     57    masm.test32(reg, Imm32(0xFF));
     58    bailoutIf(Assembler::Zero, snapshot);
     59  }
     60 
     61  template <class T>
     62  void generateUDivModZeroCheck(Register rhs, Register output, Label* done,
     63                                LSnapshot* snapshot, T* mir);
     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  template <typename T>
     81  void emitWasmLoad(T* ins);
     82  template <typename T>
     83  void emitWasmUnalignedLoad(T* ins);
     84  template <typename T>
     85  void emitWasmStore(T* ins);
     86  template <typename T>
     87  void emitWasmUnalignedStore(T* ins);
     88 
     89  void divICommon(MDiv* mir, Register lhs, Register rhs, Register output,
     90                  LSnapshot* snapshot, Label& done);
     91  void modICommon(MMod* mir, Register lhs, Register rhs, Register output,
     92                  LSnapshot* snapshot, Label& done);
     93 
     94  void generateInvalidateEpilogue();
     95 
     96  // Generating a result.
     97  template <typename S, typename T>
     98  void atomicBinopToTypedIntArray(AtomicOp op, Scalar::Type arrayType,
     99                                  const S& value, const T& mem,
    100                                  Register flagTemp, Register outTemp,
    101                                  AnyRegister output);
    102 
    103  // Generating no result.
    104  template <typename S, typename T>
    105  void atomicBinopToTypedIntArray(AtomicOp op, Scalar::Type arrayType,
    106                                  const S& value, const T& mem,
    107                                  Register flagTemp);
    108 
    109 public:
    110  void emitBailoutOOL(LSnapshot* snapshot);
    111 
    112  void visitOutOfLineTableSwitch(OutOfLineTableSwitch* ool);
    113  void visitOutOfLineWasmTruncateCheck(OutOfLineWasmTruncateCheck* ool);
    114 };
    115 
    116 using CodeGeneratorSpecific = CodeGeneratorARM;
    117 
    118 }  // namespace jit
    119 }  // namespace js
    120 
    121 #endif /* jit_arm_CodeGenerator_arm_h */