Skip to content

Commit

Permalink
Bug 1480575: Implement cmp32 with Address operands for ARM MacroAssem…
Browse files Browse the repository at this point in the history
…bler and use it in LIsPackedArray. r=mgaudet

--HG--
extra : rebase_source : f564e6187b568ed32604ba0f974bfd2a938c3f92
  • Loading branch information
anba committed Aug 2, 2018
1 parent 6ce3ba7 commit 90eb5c8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
11 changes: 1 addition & 10 deletions js/src/jit/CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13589,22 +13589,13 @@ CodeGenerator::visitIsPackedArray(LIsPackedArray* lir)
Register output = ToRegister(lir->output());
Register elementsTemp = ToRegister(lir->temp());

Label notPacked, done;

// Load elements and length.
masm.loadPtr(Address(array, NativeObject::offsetOfElements()), elementsTemp);
masm.load32(Address(elementsTemp, ObjectElements::offsetOfLength()), output);

// Test length == initializedLength.
Address initLength(elementsTemp, ObjectElements::offsetOfInitializedLength());
masm.branch32(Assembler::NotEqual, initLength, output, &notPacked);

masm.move32(Imm32(1), output);
masm.jump(&done);
masm.bind(&notPacked);
masm.move32(Imm32(0), output);

masm.bind(&done);
masm.cmp32Set(Assembler::Equal, initLength, output, output);
}

typedef bool (*GetPrototypeOfFn)(JSContext*, HandleObject, MutableHandleValue);
Expand Down
18 changes: 18 additions & 0 deletions js/src/jit/arm/MacroAssembler-arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2425,6 +2425,24 @@ MacroAssemblerARMCompat::cmp32(Register lhs, Register rhs)
ma_cmp(lhs, rhs);
}

void
MacroAssemblerARMCompat::cmp32(const Address& lhs, Imm32 rhs)
{
ScratchRegisterScope scratch(asMasm());
SecondScratchRegisterScope scratch2(asMasm());
ma_ldr(lhs, scratch, scratch2);
ma_cmp(scratch, rhs, scratch2);
}

void
MacroAssemblerARMCompat::cmp32(const Address& lhs, Register rhs)
{
ScratchRegisterScope scratch(asMasm());
SecondScratchRegisterScope scratch2(asMasm());
ma_ldr(lhs, scratch, scratch2);
ma_cmp(scratch, rhs);
}

void
MacroAssemblerARMCompat::cmpPtr(Register lhs, ImmWord rhs)
{
Expand Down
8 changes: 2 additions & 6 deletions js/src/jit/arm/MacroAssembler-arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1116,12 +1116,8 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM

void cmp32(Register lhs, Imm32 rhs);
void cmp32(Register lhs, Register rhs);
void cmp32(const Address& lhs, Imm32 rhs) {
MOZ_CRASH("NYI");
}
void cmp32(const Address& lhs, Register rhs) {
MOZ_CRASH("NYI");
}
void cmp32(const Address& lhs, Imm32 rhs);
void cmp32(const Address& lhs, Register rhs);

void cmpPtr(Register lhs, Register rhs);
void cmpPtr(Register lhs, ImmWord rhs);
Expand Down

0 comments on commit 90eb5c8

Please sign in to comment.