1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  * vim: set ts=8 sts=4 et sw=4 tw=99:
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 #include "jit/Disassembler.h"
8 
9 using namespace js;
10 using namespace js::jit;
11 using namespace js::jit::Disassembler;
12 
13 #ifdef DEBUG
operator ==(const ComplexAddress & other) const14 bool Disassembler::ComplexAddress::operator==(
15     const ComplexAddress& other) const {
16   return base_ == other.base_ && index_ == other.index_ &&
17          scale_ == other.scale_ && disp_ == other.disp_ &&
18          isPCRelative_ == other.isPCRelative_;
19 }
20 
operator !=(const ComplexAddress & other) const21 bool Disassembler::ComplexAddress::operator!=(
22     const ComplexAddress& other) const {
23   return !operator==(other);
24 }
25 
operator ==(const OtherOperand & other) const26 bool Disassembler::OtherOperand::operator==(const OtherOperand& other) const {
27   if (kind_ != other.kind_) return false;
28   switch (kind_) {
29     case Imm:
30       return u_.imm == other.u_.imm;
31     case GPR:
32       return u_.gpr == other.u_.gpr;
33     case FPR:
34       return u_.fpr == other.u_.fpr;
35   }
36   MOZ_CRASH("Unexpected OtherOperand kind");
37 }
38 
operator !=(const OtherOperand & other) const39 bool Disassembler::OtherOperand::operator!=(const OtherOperand& other) const {
40   return !operator==(other);
41 }
42 
operator ==(const HeapAccess & other) const43 bool Disassembler::HeapAccess::operator==(const HeapAccess& other) const {
44   return kind_ == other.kind_ && size_ == other.size_ &&
45          address_ == other.address_ && otherOperand_ == other.otherOperand_;
46 }
47 
operator !=(const HeapAccess & other) const48 bool Disassembler::HeapAccess::operator!=(const HeapAccess& other) const {
49   return !operator==(other);
50 }
51 
52 #endif
53