зеркало из https://github.com/mozilla/gecko-dev.git
Bug 654190 - Optimize calls to GetIndexFromString in CacheIR. r=jandem
This commit is contained in:
Родитель
e18fa23abc
Коммит
3f372174a6
|
@ -1522,20 +1522,29 @@ CacheIRCompiler::emitGuardAndGetIndexFromString()
|
|||
if (!addFailurePath(&failure))
|
||||
return false;
|
||||
|
||||
LiveRegisterSet save(GeneralRegisterSet::Volatile(), liveVolatileFloatRegs());
|
||||
masm.PushRegsInMask(save);
|
||||
Label vmCall, done;
|
||||
masm.loadStringIndexValue(str, output, &vmCall);
|
||||
masm.jump(&done);
|
||||
|
||||
masm.setupUnalignedABICall(output);
|
||||
masm.passABIArg(str);
|
||||
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, GetIndexFromString));
|
||||
masm.mov(ReturnReg, output);
|
||||
{
|
||||
masm.bind(&vmCall);
|
||||
LiveRegisterSet save(GeneralRegisterSet::Volatile(), liveVolatileFloatRegs());
|
||||
masm.PushRegsInMask(save);
|
||||
|
||||
LiveRegisterSet ignore;
|
||||
ignore.add(output);
|
||||
masm.PopRegsInMaskIgnore(save, ignore);
|
||||
masm.setupUnalignedABICall(output);
|
||||
masm.passABIArg(str);
|
||||
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, GetIndexFromString));
|
||||
masm.mov(ReturnReg, output);
|
||||
|
||||
// GetIndexFromString returns a negative value on failure.
|
||||
masm.branchTest32(Assembler::Signed, output, output, failure->label());
|
||||
LiveRegisterSet ignore;
|
||||
ignore.add(output);
|
||||
masm.PopRegsInMaskIgnore(save, ignore);
|
||||
|
||||
// GetIndexFromString returns a negative value on failure.
|
||||
masm.branchTest32(Assembler::Signed, output, output, failure->label());
|
||||
}
|
||||
|
||||
masm.bind(&done);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1422,6 +1422,20 @@ MacroAssembler::loadStringChar(Register str, Register index, Register output, La
|
|||
bind(&done);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::loadStringIndexValue(Register str, Register dest, Label* fail)
|
||||
{
|
||||
MOZ_ASSERT(str != dest);
|
||||
|
||||
load32(Address(str, JSString::offsetOfFlags()), dest);
|
||||
|
||||
// Does not have a cached index value.
|
||||
branchTest32(Assembler::Zero, dest, Imm32(JSString::INDEX_VALUE_BIT), fail);
|
||||
|
||||
// Extract the index.
|
||||
rshift32(Imm32(JSString::INDEX_VALUE_SHIFT), dest);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::loadJSContext(Register dest)
|
||||
{
|
||||
|
|
|
@ -1528,6 +1528,8 @@ class MacroAssembler : public MacroAssemblerSpecific
|
|||
void loadStringChars(Register str, Register dest);
|
||||
void loadStringChar(Register str, Register index, Register output, Label* fail);
|
||||
|
||||
void loadStringIndexValue(Register str, Register dest, Label* fail);
|
||||
|
||||
void loadJSContext(Register dest);
|
||||
void loadJitActivation(Register dest) {
|
||||
loadJSContext(dest);
|
||||
|
|
Загрузка…
Ссылка в новой задаче