Bug 1177016 - IonMonkey: MIPS: Fix a unaligned access caused by bug 1169731. r=jandem

This commit is contained in:
Heiher 2015-06-24 17:48:00 +02:00
Родитель aaa261a733
Коммит e61b7a0c4b
1 изменённых файлов: 10 добавлений и 4 удалений

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

@ -955,10 +955,16 @@ class MacroAssembler : public MacroAssemblerSpecific
void branchFunctionKind(Condition cond, JSFunction::FunctionKind kind, Register fun, void branchFunctionKind(Condition cond, JSFunction::FunctionKind kind, Register fun,
Register scratch, Label* label) Register scratch, Label* label)
{ {
Address flags(fun, JSFunction::offsetOfFlags()); // 16-bit loads are slow and unaligned 32-bit loads may be too so
load32(flags, scratch); // perform an aligned 32-bit load and adjust the bitmask accordingly.
and32(Imm32(JSFunction::FUNCTION_KIND_MASK), scratch); MOZ_ASSERT(JSFunction::offsetOfNargs() % sizeof(uint32_t) == 0);
branch32(cond, scratch, Imm32(kind << JSFunction::FUNCTION_KIND_SHIFT), label); MOZ_ASSERT(JSFunction::offsetOfFlags() == JSFunction::offsetOfNargs() + 2);
Address address(fun, JSFunction::offsetOfNargs());
int32_t mask = IMM32_16ADJ(JSFunction::FUNCTION_KIND_MASK);
int32_t bit = IMM32_16ADJ(kind << JSFunction::FUNCTION_KIND_SHIFT);
load32(address, scratch);
and32(Imm32(mask), scratch);
branch32(cond, scratch, Imm32(bit), label);
} }
public: public: