tor-browser

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

LIR-mips64.h (2736B)


      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_mips64_LIR_mips64_h
      8 #define jit_mips64_LIR_mips64_h
      9 
     10 namespace js {
     11 namespace jit {
     12 
     13 class LUnbox : public LInstructionHelper<1, BOX_PIECES, 0> {
     14 public:
     15  LIR_HEADER(Unbox);
     16 
     17  explicit LUnbox(const LAllocation& input) : LInstructionHelper(classOpcode) {
     18    setOperand(0, input);
     19  }
     20 
     21  static const size_t Input = 0;
     22 
     23  LBoxAllocation input() const { return getBoxOperand(Input); }
     24 
     25  MUnbox* mir() const { return mir_->toUnbox(); }
     26  const char* extraName() const { return StringFromMIRType(mir()->type()); }
     27 };
     28 
     29 class LDivOrModI64 : public LBinaryMath<0> {
     30 public:
     31  LIR_HEADER(DivOrModI64);
     32 
     33  LDivOrModI64(const LAllocation& lhs, const LAllocation& rhs)
     34      : LBinaryMath(classOpcode) {
     35    setOperand(0, lhs);
     36    setOperand(1, rhs);
     37  }
     38 
     39  MBinaryArithInstruction* mir() const {
     40    MOZ_ASSERT(mir_->isDiv() || mir_->isMod());
     41    return static_cast<MBinaryArithInstruction*>(mir_);
     42  }
     43 
     44  bool canBeDivideByZero() const {
     45    if (mir_->isMod()) {
     46      return mir_->toMod()->canBeDivideByZero();
     47    }
     48    return mir_->toDiv()->canBeDivideByZero();
     49  }
     50  bool canBeNegativeOverflow() const {
     51    if (mir_->isMod()) {
     52      return mir_->toMod()->canBeNegativeDividend();
     53    }
     54    return mir_->toDiv()->canBeNegativeOverflow();
     55  }
     56  wasm::TrapSiteDesc trapSiteDesc() const {
     57    MOZ_ASSERT(mir_->isDiv() || mir_->isMod());
     58    if (mir_->isMod()) {
     59      return mir_->toMod()->trapSiteDesc();
     60    }
     61    return mir_->toDiv()->trapSiteDesc();
     62  }
     63 };
     64 
     65 class LUDivOrModI64 : public LBinaryMath<0> {
     66 public:
     67  LIR_HEADER(UDivOrModI64);
     68 
     69  LUDivOrModI64(const LAllocation& lhs, const LAllocation& rhs)
     70      : LBinaryMath(classOpcode) {
     71    setOperand(0, lhs);
     72    setOperand(1, rhs);
     73  }
     74 
     75  const char* extraName() const {
     76    return mir()->isTruncated() ? "Truncated" : nullptr;
     77  }
     78 
     79  MBinaryArithInstruction* mir() const {
     80    MOZ_ASSERT(mir_->isDiv() || mir_->isMod());
     81    return static_cast<MBinaryArithInstruction*>(mir_);
     82  }
     83  bool canBeDivideByZero() const {
     84    if (mir_->isMod()) {
     85      return mir_->toMod()->canBeDivideByZero();
     86    }
     87    return mir_->toDiv()->canBeDivideByZero();
     88  }
     89  wasm::TrapSiteDesc trapSiteDesc() const {
     90    MOZ_ASSERT(mir_->isDiv() || mir_->isMod());
     91    if (mir_->isMod()) {
     92      return mir_->toMod()->trapSiteDesc();
     93    }
     94    return mir_->toDiv()->trapSiteDesc();
     95  }
     96 };
     97 
     98 }  // namespace jit
     99 }  // namespace js
    100 
    101 #endif /* jit_mips64_LIR_mips64_h */