addInstruction(call);
}
-void InstructionSelection::callBuiltinCreateExceptionHandler(IR::Temp *result)
+void InstructionSelection::callBuiltinCreateExceptionHandler(IR::Temp *result, IR::Temp *)
{
Instruction::CallBuiltinCreateExceptionHandler call;
call.result = getResultParam(result);
virtual void callBuiltinPostIncrementName(const QString &name, IR::Temp *result);
virtual void callBuiltinPostIncrementValue(IR::Temp *value, IR::Temp *result);
virtual void callBuiltinThrow(IR::Temp *arg);
- virtual void callBuiltinCreateExceptionHandler(IR::Temp *result);
+ virtual void callBuiltinCreateExceptionHandler(IR::Temp *result, IR::Temp *contextTemp);
virtual void callBuiltinDeleteExceptionHandler();
virtual void callBuiltinGetException(IR::Temp *result);
virtual void callBuiltinForeachIteratorObject(IR::Temp *arg, IR::Temp *result);
, stackSize
#endif
);
+ VM::ExecutionContext *oldContext = context;
int didThrow = setjmp(* static_cast<jmp_buf *>(buf));
+ context = oldContext;
// Two ways to come here: after a create, or after a throw.
if (didThrow)
// At this point, the interpreter state can be anything but
}
int hasException = _block->newTemp();
- move(_block->TEMP(hasException), _block->CALL(_block->NAME(IR::Name::builtin_create_exception_handler, 0, 0), 0));
+ int contextTemp = _block->newTemp();
+ IR::ExprList *createExceptionArgs = _function->New<IR::ExprList>();
+ createExceptionArgs->init(_block->TEMP(contextTemp));
+ move(_block->TEMP(hasException), _block->CALL(_block->NAME(IR::Name::builtin_create_exception_handler, 0, 0), createExceptionArgs));
// Pass the hidden "inCatch" and "hasException" TEMPs to the
// builtin_delete_exception_handler, in order to have those TEMPs alive for
Q_UNREACHABLE();
}
-void InstructionSelection::callBuiltinCreateExceptionHandler(IR::Temp *result)
+void InstructionSelection::callBuiltinCreateExceptionHandler(IR::Temp *result, IR::Temp *contextTemp)
{
// TODO
assert(!"TODO!");
virtual void callBuiltinPostIncrementName(const QString &name, IR::Temp *result);
virtual void callBuiltinPostIncrementValue(IR::Temp *value, IR::Temp *result);
virtual void callBuiltinThrow(IR::Temp *arg);
- virtual void callBuiltinCreateExceptionHandler(IR::Temp *result);
+ virtual void callBuiltinCreateExceptionHandler(IR::Temp *result, IR::Temp *contextTemp);
virtual void callBuiltinDeleteExceptionHandler();
virtual void callBuiltinGetException(IR::Temp *result);
virtual void callBuiltinForeachIteratorObject(IR::Temp *arg, IR::Temp *result);
generateFunctionCall(Assembler::Void, __qmljs_builtin_throw, arg, Assembler::ContextRegister);
}
-void InstructionSelection::callBuiltinCreateExceptionHandler(IR::Temp *result)
+void InstructionSelection::callBuiltinCreateExceptionHandler(IR::Temp *result, IR::Temp *contextTemp)
{
+ Address contextAddr = _asm->loadTempAddress(Assembler::ScratchRegister, contextTemp);
+ _asm->storePtr(Assembler::ContextRegister, contextAddr);
generateFunctionCall(Assembler::ReturnValueRegister, __qmljs_create_exception_handler, Assembler::ContextRegister);
generateFunctionCall(Assembler::ReturnValueRegister, setjmp, Assembler::ReturnValueRegister);
+ _asm->loadPtr(contextAddr, Assembler::ContextRegister);
Address addr = _asm->loadTempAddress(Assembler::ScratchRegister, result);
_asm->store32(Assembler::ReturnValueRegister, addr);
addr.offset += 4;
virtual void callBuiltinPostIncrementName(const QString &name, IR::Temp *result);
virtual void callBuiltinPostIncrementValue(IR::Temp *value, IR::Temp *result);
virtual void callBuiltinThrow(IR::Temp *arg);
- virtual void callBuiltinCreateExceptionHandler(IR::Temp *result);
+ virtual void callBuiltinCreateExceptionHandler(IR::Temp *result, IR::Temp *contextTemp);
virtual void callBuiltinDeleteExceptionHandler();
virtual void callBuiltinGetException(IR::Temp *result);
virtual void callBuiltinForeachIteratorObject(IR::Temp *arg, IR::Temp *result);
callBuiltinThrow(arg);
} return;
- case IR::Name::builtin_create_exception_handler:
- callBuiltinCreateExceptionHandler(result);
+ case IR::Name::builtin_create_exception_handler: {
+ IR::Temp *arg = call->args->expr->asTemp();
+ callBuiltinCreateExceptionHandler(result, arg);
return;
+ }
case IR::Name::builtin_delete_exception_handler:
callBuiltinDeleteExceptionHandler();
virtual void callBuiltinPostIncrementName(const QString &name, IR::Temp *result) = 0;
virtual void callBuiltinPostIncrementValue(IR::Temp *value, IR::Temp *result) = 0;
virtual void callBuiltinThrow(IR::Temp *arg) = 0;
- virtual void callBuiltinCreateExceptionHandler(IR::Temp *result) = 0;
+ virtual void callBuiltinCreateExceptionHandler(IR::Temp *result, IR::Temp *contextTemp) = 0;
virtual void callBuiltinDeleteExceptionHandler() = 0;
virtual void callBuiltinGetException(IR::Temp *result) = 0;
virtual void callBuiltinForeachIteratorObject(IR::Temp *arg, IR::Temp *result) = 0;