return context->result;
}
-Value __qmljs_builtin_typeof(Context *context, Value *args, int argc)
+Value __qmljs_builtin_typeof(Value val, Context *context)
{
- Q_UNUSED(argc);
- return __qmljs_typeof(args[0], context);
+ return __qmljs_typeof(val, context);
}
-Value __qmljs_builtin_throw(Context *context, Value *args, int argc)
+void __qmljs_builtin_throw(Value val, Context *context)
{
- Q_UNUSED(argc);
- __qmljs_throw(args[0], context);
- // ### change to void return value
- return Value::undefinedValue();
+ __qmljs_throw(val, context);
}
-Value __qmljs_builtin_rethrow(Context *context, Value *, int)
+Value __qmljs_builtin_rethrow(Context *context)
{
return context->result;
}
Value __qmljs_construct_property(Context *context, Value base, String *name, Value *args, int argc);
Value __qmljs_construct_value(Context *context, Value func, Value *args, int argc);
-Value __qmljs_builtin_typeof(Context *context, Value *args, int argc);
-Value __qmljs_builtin_throw(Context *context, Value *args, int argc);
-Value __qmljs_builtin_rethrow(Context *context, Value *args, int argc);
+Value __qmljs_builtin_typeof(Value val, Context *context);
+void __qmljs_builtin_throw(Value val, Context *context);
+Value __qmljs_builtin_rethrow(Context *context);
// constructors
Value __qmljs_init_string(String *string);
case IR::Name::builtin_invalid:
Q_UNREACHABLE();
break;
- case IR::Name::builtin_typeof:
- callRuntimeMethod(result, __qmljs_builtin_typeof, call->args);
+ case IR::Name::builtin_typeof: {
+ IR::Temp *arg = call->args->expr->asTemp();
+ assert(arg != 0);
+ generateFunctionCall(result, __qmljs_builtin_typeof, arg, ContextRegister);
+ checkExceptions();
+ }
break;
case IR::Name::builtin_delete:
Q_UNREACHABLE();
break;
- case IR::Name::builtin_throw:
- callRuntimeMethod(result, __qmljs_builtin_throw, call->args);
- break;
- case IR::Name::builtin_rethrow: {
- int argc = prepareVariableArguments(call->args);
- generateFunctionCall(result, __qmljs_builtin_rethrow, ContextRegister, baseAddressForCallArguments(), TrustedImm32(argc));
- return; // we need to return to avoid checking the exceptions
+ case IR::Name::builtin_throw: {
+ IR::Temp *arg = call->args->expr->asTemp();
+ assert(arg != 0);
+ generateFunctionCall(Void, __qmljs_builtin_throw, arg, ContextRegister);
+ checkExceptions();
}
+ break;
+ case IR::Name::builtin_rethrow:
+ // don't use callRuntimeMethod, as we need to return to avoid checking the exceptions
+ generateFunctionCall(result, __qmljs_builtin_rethrow, ContextRegister);
+ return;
}
}
}
void InstructionSelection::checkExceptions()
{
Address addr(ContextRegister, offsetof(Context, hasUncaughtException));
- Jump jmp = branch8(Equal, addr, TrustedImm32(1));
+ Jump jmp = branch8(NotEqual, addr, TrustedImm32(0));
_patches[_function->handlersBlock].append(jmp);
}