Bug 1125202 - SpiderMonkey: Refactor a repeated assert so that it's checked in only one place r=jandem

This commit is contained in:
Dan Gohman 2015-01-30 16:05:55 -08:00
Родитель 2742e5d193
Коммит a868198b17
1 изменённых файлов: 4 добавлений и 16 удалений

Просмотреть файл

@ -5081,9 +5081,6 @@ private:
void oneByteOp8(OneByteOpcodeID opcode, RegisterID rm, GroupOpcodeID groupOp) void oneByteOp8(OneByteOpcodeID opcode, RegisterID rm, GroupOpcodeID groupOp)
{ {
#ifdef JS_CODEGEN_X86
MOZ_ASSERT(!X86Registers::ByteRegRequiresRex(rm));
#endif
m_buffer.ensureSpace(maxInstructionSize); m_buffer.ensureSpace(maxInstructionSize);
emitRexIf(X86Registers::ByteRegRequiresRex(rm), 0, 0, rm); emitRexIf(X86Registers::ByteRegRequiresRex(rm), 0, 0, rm);
m_buffer.putByteUnchecked(opcode); m_buffer.putByteUnchecked(opcode);
@ -5101,9 +5098,6 @@ private:
void oneByteOp8(OneByteOpcodeID opcode, int32_t offset, RegisterID base, RegisterID reg) 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); m_buffer.ensureSpace(maxInstructionSize);
emitRexIf(X86Registers::ByteRegRequiresRex(reg), reg, 0, base); emitRexIf(X86Registers::ByteRegRequiresRex(reg), reg, 0, base);
m_buffer.putByteUnchecked(opcode); m_buffer.putByteUnchecked(opcode);
@ -5113,9 +5107,6 @@ private:
void oneByteOp8_disp32(OneByteOpcodeID opcode, int32_t offset, RegisterID base, void oneByteOp8_disp32(OneByteOpcodeID opcode, int32_t offset, RegisterID base,
RegisterID reg) RegisterID reg)
{ {
#ifdef JS_CODEGEN_X86
MOZ_ASSERT(!X86Registers::ByteRegRequiresRex(reg));
#endif
m_buffer.ensureSpace(maxInstructionSize); m_buffer.ensureSpace(maxInstructionSize);
emitRexIf(X86Registers::ByteRegRequiresRex(reg), reg, 0, base); emitRexIf(X86Registers::ByteRegRequiresRex(reg), reg, 0, base);
m_buffer.putByteUnchecked(opcode); m_buffer.putByteUnchecked(opcode);
@ -5125,9 +5116,6 @@ private:
void oneByteOp8(OneByteOpcodeID opcode, int32_t offset, RegisterID base, void oneByteOp8(OneByteOpcodeID opcode, int32_t offset, RegisterID base,
RegisterID index, int scale, RegisterID reg) RegisterID index, int scale, RegisterID reg)
{ {
#ifdef JS_CODEGEN_X86
MOZ_ASSERT(!X86Registers::ByteRegRequiresRex(reg));
#endif
m_buffer.ensureSpace(maxInstructionSize); m_buffer.ensureSpace(maxInstructionSize);
emitRexIf(X86Registers::ByteRegRequiresRex(reg), reg, index, base); emitRexIf(X86Registers::ByteRegRequiresRex(reg), reg, index, base);
m_buffer.putByteUnchecked(opcode); m_buffer.putByteUnchecked(opcode);
@ -5136,9 +5124,6 @@ private:
void oneByteOp8(OneByteOpcodeID opcode, const void* address, RegisterID reg) void oneByteOp8(OneByteOpcodeID opcode, const void* address, RegisterID reg)
{ {
#ifdef JS_CODEGEN_X86
MOZ_ASSERT(!X86Registers::ByteRegRequiresRex(reg));
#endif
m_buffer.ensureSpace(maxInstructionSize); m_buffer.ensureSpace(maxInstructionSize);
emitRexIf(X86Registers::ByteRegRequiresRex(reg), reg, 0, 0); emitRexIf(X86Registers::ByteRegRequiresRex(reg), reg, 0, 0);
m_buffer.putByteUnchecked(opcode); m_buffer.putByteUnchecked(opcode);
@ -5348,7 +5333,10 @@ private:
#else #else
// No REX prefix bytes on 32-bit x86. // No REX prefix bytes on 32-bit x86.
inline bool regRequiresRex(int) { return false; } 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) {} inline void emitRexIfNeeded(int, int, int) {}
#endif #endif