LIR-mips-shared.h (1332B)
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_mips_shared_LIR_mips_shared_h 8 #define jit_mips_shared_LIR_mips_shared_h 9 10 namespace js { 11 namespace jit { 12 13 class LUDivOrMod : public LBinaryMath<0> { 14 public: 15 LIR_HEADER(UDivOrMod); 16 17 LUDivOrMod() : LBinaryMath(classOpcode) {} 18 19 MBinaryArithInstruction* mir() const { 20 MOZ_ASSERT(mir_->isDiv() || mir_->isMod()); 21 return static_cast<MBinaryArithInstruction*>(mir_); 22 } 23 24 bool canBeDivideByZero() const { 25 if (mir_->isMod()) { 26 return mir_->toMod()->canBeDivideByZero(); 27 } 28 return mir_->toDiv()->canBeDivideByZero(); 29 } 30 31 bool trapOnError() const { 32 if (mir_->isMod()) { 33 return mir_->toMod()->trapOnError(); 34 } 35 return mir_->toDiv()->trapOnError(); 36 } 37 38 wasm::TrapSiteDesc trapSiteDesc() const { 39 MOZ_ASSERT(mir_->isDiv() || mir_->isMod()); 40 if (mir_->isMod()) { 41 return mir_->toMod()->trapSiteDesc(); 42 } 43 return mir_->toDiv()->trapSiteDesc(); 44 } 45 }; 46 47 } // namespace jit 48 } // namespace js 49 50 #endif /* jit_mips_shared_LIR_mips_shared_h */