The return value of setjmp is an int, which we interpret as a boolean later. We
cannot put it directly into a VM::Value, because it isn't one. Instead we have
to store it properly with value and tag.
This worked by "accident" on x86-64 where the return value is in eax and not
clobbered until we do the type test. But on ia32 we do rely on a proper value
representation.
Change-Id: Id54072c31baf6ad4607626dad939c715d2092d3d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
void InstructionSelection::callBuiltinCreateExceptionHandler(IR::Temp *result)
{
generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_create_exception_handler, Assembler::ContextRegister);
- generateFunctionCall(result, setjmp, Assembler::ReturnValueRegister);
+ generateFunctionCall(Assembler::ReturnValueRegister, setjmp, Assembler::ReturnValueRegister);
+ Address addr = _asm->loadTempAddress(Assembler::ScratchRegister, result);
+ _asm->store32(Assembler::ReturnValueRegister, addr);
+ addr.offset += 4;
+ _asm->store32(Assembler::TrustedImm32(Value::Boolean_Type), addr);
}
void InstructionSelection::callBuiltinDeleteExceptionHandler()