From a868198b17d4dd29a2061d463c884d5dc97ce8c3 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 30 Jan 2015 16:05:55 -0800 Subject: [PATCH] Bug 1125202 - SpiderMonkey: Refactor a repeated assert so that it's checked in only one place r=jandem --- js/src/jit/shared/BaseAssembler-x86-shared.h | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/js/src/jit/shared/BaseAssembler-x86-shared.h b/js/src/jit/shared/BaseAssembler-x86-shared.h index 722d09cd7dab..c4ac5cfe34eb 100644 --- a/js/src/jit/shared/BaseAssembler-x86-shared.h +++ b/js/src/jit/shared/BaseAssembler-x86-shared.h @@ -5081,9 +5081,6 @@ private: void oneByteOp8(OneByteOpcodeID opcode, RegisterID rm, GroupOpcodeID groupOp) { -#ifdef JS_CODEGEN_X86 - MOZ_ASSERT(!X86Registers::ByteRegRequiresRex(rm)); -#endif m_buffer.ensureSpace(maxInstructionSize); emitRexIf(X86Registers::ByteRegRequiresRex(rm), 0, 0, rm); m_buffer.putByteUnchecked(opcode); @@ -5101,9 +5098,6 @@ private: void oneByteOp8(OneByteOpcodeID opcode, int32_t offset, RegisterID base, RegisterID reg) { -#ifdef JS_CODEGEN_X86 - MOZ_ASSERT(!X86Registers::ByteRegRequiresRex(reg)); -#endif m_buffer.ensureSpace(maxInstructionSize); emitRexIf(X86Registers::ByteRegRequiresRex(reg), reg, 0, base); m_buffer.putByteUnchecked(opcode); @@ -5113,9 +5107,6 @@ private: void oneByteOp8_disp32(OneByteOpcodeID opcode, int32_t offset, RegisterID base, RegisterID reg) { -#ifdef JS_CODEGEN_X86 - MOZ_ASSERT(!X86Registers::ByteRegRequiresRex(reg)); -#endif m_buffer.ensureSpace(maxInstructionSize); emitRexIf(X86Registers::ByteRegRequiresRex(reg), reg, 0, base); m_buffer.putByteUnchecked(opcode); @@ -5125,9 +5116,6 @@ private: void oneByteOp8(OneByteOpcodeID opcode, int32_t offset, RegisterID base, RegisterID index, int scale, RegisterID reg) { -#ifdef JS_CODEGEN_X86 - MOZ_ASSERT(!X86Registers::ByteRegRequiresRex(reg)); -#endif m_buffer.ensureSpace(maxInstructionSize); emitRexIf(X86Registers::ByteRegRequiresRex(reg), reg, index, base); m_buffer.putByteUnchecked(opcode); @@ -5136,9 +5124,6 @@ private: void oneByteOp8(OneByteOpcodeID opcode, const void* address, RegisterID reg) { -#ifdef JS_CODEGEN_X86 - MOZ_ASSERT(!X86Registers::ByteRegRequiresRex(reg)); -#endif m_buffer.ensureSpace(maxInstructionSize); emitRexIf(X86Registers::ByteRegRequiresRex(reg), reg, 0, 0); m_buffer.putByteUnchecked(opcode); @@ -5348,7 +5333,10 @@ private: #else // No REX prefix bytes on 32-bit x86. inline bool regRequiresRex(int) { return false; } - inline void emitRexIf(bool, int, int, int) {} + inline void emitRexIf(bool condition, int, int, int) + { + MOZ_ASSERT(!condition, "32-bit x86 should never use a REX prefix"); + } inline void emitRexIfNeeded(int, int, int) {} #endif