- modify exception checks to jump ahead if the exception is to be thrown as it limits static misprediction

This commit is contained in:
Magnus Norddahl 2018-11-10 22:48:20 +01:00
commit e6023c55a8
5 changed files with 77 additions and 93 deletions

View file

@ -678,11 +678,9 @@ void JitCompiler::EmitPopFrame()
void JitCompiler::EmitNullPointerThrow(int index, EVMAbortException reason)
{
auto label = cc.newLabel();
auto label = EmitThrowExceptionLabel(reason);
cc.test(regA[index], regA[index]);
cc.jne(label);
EmitThrowException(reason);
cc.bind(label);
cc.je(label);
}
void JitCompiler::ThrowException(VMScriptFunction *func, VMOP *line, int reason)
@ -705,6 +703,16 @@ void JitCompiler::EmitThrowException(EVMAbortException reason)
call->setArg(2, asmjit::imm(reason));
}
asmjit::Label JitCompiler::EmitThrowExceptionLabel(EVMAbortException reason)
{
auto label = cc.newLabel();
auto cursor = cc.getCursor();
cc.bind(label);
EmitThrowException(reason);
cc.setCursor(cursor);
return label;
}
asmjit::X86Gp JitCompiler::CheckRegD(int r0, int r1)
{
if (r0 != r1)