tor-browser

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

Lowering-x86.h (3396B)


      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_x86_Lowering_x86_h
      8 #define jit_x86_Lowering_x86_h
      9 
     10 #include "jit/x86-shared/Lowering-x86-shared.h"
     11 
     12 namespace js {
     13 namespace jit {
     14 
     15 class LIRGeneratorX86 : public LIRGeneratorX86Shared {
     16 protected:
     17  LIRGeneratorX86(MIRGenerator* gen, MIRGraph& graph, LIRGraph& lirGraph)
     18      : LIRGeneratorX86Shared(gen, graph, lirGraph) {}
     19 
     20  // Returns a box allocation with type set to reg1 and payload set to reg2.
     21  LBoxAllocation useBoxFixed(MDefinition* mir, Register reg1, Register reg2,
     22                             bool useAtStart = false);
     23 
     24  // It's a trap! On x86, the 1-byte store can only use one of
     25  // {al,bl,cl,dl,ah,bh,ch,dh}. That means if the register allocator
     26  // gives us one of {edi,esi,ebp,esp}, we're out of luck. (The formatter
     27  // will assert on us.) Ideally, we'd just ask the register allocator to
     28  // give us one of {al,bl,cl,dl}. For now, just useFixed(al).
     29  LAllocation useByteOpRegister(MDefinition* mir);
     30  LAllocation useByteOpRegisterAtStart(MDefinition* mir);
     31  LAllocation useByteOpRegisterOrNonDoubleConstant(MDefinition* mir);
     32  LDefinition tempByteOpRegister();
     33 
     34  inline LDefinition tempToUnbox() { return LDefinition::BogusTemp(); }
     35 
     36  bool needTempForPostBarrier() { return true; }
     37 
     38  void lowerUntypedPhiInput(MPhi* phi, uint32_t inputPosition, LBlock* block,
     39                            size_t lirIndex);
     40 
     41  void lowerInt64PhiInput(MPhi* phi, uint32_t inputPosition, LBlock* block,
     42                          size_t lirIndex);
     43  void defineInt64Phi(MPhi* phi, size_t lirIndex);
     44 
     45  void lowerForALUInt64(LInstructionHelper<INT64_PIECES, INT64_PIECES, 0>* ins,
     46                        MDefinition* mir, MDefinition* input);
     47  void lowerForALUInt64(
     48      LInstructionHelper<INT64_PIECES, 2 * INT64_PIECES, 0>* ins,
     49      MDefinition* mir, MDefinition* lhs, MDefinition* rhs);
     50  void lowerForMulInt64(LMulI64* ins, MMul* mir, MDefinition* lhs,
     51                        MDefinition* rhs);
     52 
     53  template <class LInstr>
     54  void lowerForShiftInt64(LInstr* ins, MDefinition* mir, MDefinition* lhs,
     55                          MDefinition* rhs);
     56 
     57  void lowerTruncateDToInt32(MTruncateToInt32* ins);
     58  void lowerTruncateFToInt32(MTruncateToInt32* ins);
     59  void lowerBuiltinInt64ToFloatingPoint(MBuiltinInt64ToFloatingPoint* ins);
     60  void lowerWasmBuiltinTruncateToInt32(MWasmBuiltinTruncateToInt32* ins);
     61  void lowerWasmBuiltinTruncateToInt64(MWasmBuiltinTruncateToInt64* ins);
     62  void lowerDivI64(MDiv* div);
     63  void lowerWasmBuiltinDivI64(MWasmBuiltinDivI64* div);
     64  void lowerModI64(MMod* mod);
     65  void lowerWasmBuiltinModI64(MWasmBuiltinModI64* mod);
     66  void lowerUDivI64(MDiv* div);
     67  void lowerUModI64(MMod* mod);
     68 
     69  void lowerBigIntPtrDiv(MBigIntPtrDiv* ins);
     70  void lowerBigIntPtrMod(MBigIntPtrMod* ins);
     71 
     72  void lowerAtomicLoad64(MLoadUnboxedScalar* ins);
     73  void lowerAtomicStore64(MStoreUnboxedScalar* ins);
     74 
     75  void lowerPhi(MPhi* phi);
     76 
     77 public:
     78  static bool allowTypedElementHoleCheck() { return true; }
     79 };
     80 
     81 using LIRGeneratorSpecific = LIRGeneratorX86;
     82 
     83 }  // namespace jit
     84 }  // namespace js
     85 
     86 #endif /* jit_x86_Lowering_x86_h */