void __qmljs_llvm_construct_value(Context *context, Value *result, const Value *func, Value *args, int argc)
{
- __qmljs_construct_value(context, result, func, args, argc);
+ *result = __qmljs_construct_value(context, *func, args, argc);
}
void __qmljs_llvm_get_activation_property(Context *ctx, Value *result, String *name)
void __qmljs_llvm_construct_property(Context *context, Value *result, const Value *base, String *name, Value *args, int argc)
{
- __qmljs_construct_property(context, result, base, name, args, argc);
+ *result = __qmljs_construct_property(context, *base, name, args, argc);
}
void __qmljs_llvm_get_element(Context *ctx, Value *result, Value *object, Value *index)
void __qmljs_llvm_typeof(Context *ctx, Value *result, const Value *value)
{
- __qmljs_typeof(ctx, result, value);
+ *result = __qmljs_typeof(ctx, value);
}
void __qmljs_llvm_throw(Context *context, Value *value)
{
- __qmljs_throw(context, value);
+ __qmljs_throw(context, *value);
}
void __qmljs_llvm_rethrow(Context *context, Value *result)
{
- __qmljs_rethrow(context, result);
+ *result = __qmljs_rethrow(context);
}
void __qmljs_llvm_get_this_object(Context *ctx, Value *result)
calledAsConstructor = true;
}
-void Context::leaveConstructorContext(FunctionObject *f, Value *returnValue)
+void Context::leaveConstructorContext(FunctionObject *f)
{
assert(thisObject.is(Value::Object_Type));
result = thisObject;
thisObject.objectValue()->prototype = engine->objectPrototype;
leaveCallContext(f);
- *returnValue = result;
}
extern "C" {
context->throwReferenceError(Value::fromString(name));
return Value::undefinedValue();
}
- Value result;
- __qmljs_construct_value(context, &result, func, args, argc);
- return result;
+ return __qmljs_construct_value(context, *func, args, argc);
}
-void __qmljs_construct_value(Context *context, Value *result, const Value *func, Value *args, int argc)
+Value __qmljs_construct_value(Context *context, const Value func, Value *args, int argc)
{
- if (FunctionObject *f = func->asFunctionObject()) {
+ if (FunctionObject *f = func.asFunctionObject()) {
Context k;
Context *ctx = f->needsActivation ? context->engine->newContext() : &k;
ctx->initConstructorContext(context->engine, 0, f, args, argc);
context->hasUncaughtException = ctx->hasUncaughtException; // propagate the exception
context->result = ctx->result;
}
- ctx->leaveConstructorContext(f, result);
- } else {
- context->throwTypeError();
+ ctx->leaveConstructorContext(f);
+ return ctx->result;
}
+ context->throwTypeError();
+ return Value::undefinedValue();
}
-void __qmljs_construct_property(Context *context, Value *result, const Value *base, String *name, Value *args, int argc)
+Value __qmljs_construct_property(Context *context, const Value base, String *name, Value *args, int argc)
{
- Value thisObject = *base;
+ Value thisObject = base;
if (!thisObject.isObject())
- __qmljs_to_object(context, &thisObject, base);
+ __qmljs_to_object(context, &thisObject, &base);
assert(thisObject.isObject());
Value func = thisObject.property(context, name);
context->hasUncaughtException = ctx->hasUncaughtException; // propagate the exception
context->result = ctx->result;
}
- ctx->leaveConstructorContext(f, result);
- } else {
- context->throwTypeError();
+ ctx->leaveConstructorContext(f);
+ return ctx->result;
}
+ context->throwTypeError();
+ return Value::undefinedValue();
}
-void __qmljs_throw(Context *context, Value *value)
+void __qmljs_throw(Context *context, Value value)
{
context->hasUncaughtException = true;
- context->result = *value;
+ context->result = value;
}
-void __qmljs_rethrow(Context *context, Value *result)
+Value __qmljs_rethrow(Context *context)
{
- *result = context->result;
+ return context->result;
}
Value __qmljs_builtin_typeof(Context *context, Value *args, int argc)
{
Q_UNUSED(argc);
- Value result;
- __qmljs_typeof(context, &result, &args[0]);
- return result;
+ return __qmljs_typeof(context, &args[0]);
}
Value __qmljs_builtin_throw(Context *context, Value *args, int argc)
{
Q_UNUSED(argc);
- __qmljs_throw(context, &args[0]);
+ __qmljs_throw(context, args[0]);
// ### change to void return value
return Value::undefinedValue();
}
-void __qmljs_builtin_rethrow(Context *context, Value *result, Value *, int)
+Value __qmljs_builtin_rethrow(Context *context, Value *, int)
{
- __qmljs_rethrow(context, result);
+ return context->result;
}
} // extern "C"
Value __qmljs_call_value(Context *context, const Value thisObject, const Value *func, Value *args, int argc);
Value __qmljs_construct_activation_property(Context *, String *name, Value *args, int argc);
-void __qmljs_construct_property(Context *context, Value *result, const Value *base, String *name, Value *args, int argc);
-void __qmljs_construct_value(Context *context, Value *result, const Value *func, Value *args, int argc);
+Value __qmljs_construct_property(Context *context, const Value base, String *name, Value *args, int argc);
+Value __qmljs_construct_value(Context *context, const 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);
-void __qmljs_builtin_rethrow(Context *context, Value *result, Value *args, int argc);
+Value __qmljs_builtin_rethrow(Context *context, Value *args, int argc);
// constructors
Value __qmljs_init_string(String *string);
void __qmljs_delete_property(Context *ctx, Value *result, String *name);
void __qmljs_delete_value(Context *ctx, Value *result, Value *value);
-void __qmljs_typeof(Context *ctx, Value *result, const Value *value);
-void __qmljs_throw(Context *context, Value *value);
-void __qmljs_rethrow(Context *context, Value *result);
+Value __qmljs_typeof(Context *ctx, const Value *value);
+void __qmljs_throw(Context *context, Value value);
+Value __qmljs_rethrow(Context *context);
// binary operators
void __qmljs_instanceof(Context *ctx, Value *result, const Value *left, const Value *right);
void leaveCallContext(FunctionObject *f);
void initConstructorContext(ExecutionEngine *e, const Value *object, FunctionObject *f, Value *args, unsigned argc);
- void leaveConstructorContext(FunctionObject *f, Value *returnValue);
+ void leaveConstructorContext(FunctionObject *f);
};
// unary operators
-inline void __qmljs_typeof(Context *ctx, Value *result, const Value *value)
+inline Value __qmljs_typeof(Context *ctx, const Value *value)
{
switch (value->type()) {
case Value::Undefined_Type:
break;
case IR::Name::builtin_rethrow: {
int argc = prepareVariableArguments(call->args);
- generateFunctionCall(__qmljs_builtin_rethrow, ContextRegister, result, baseAddressForCallArguments(), TrustedImm32(argc));
+ generateFunctionCall2(result, __qmljs_builtin_rethrow, ContextRegister, baseAddressForCallArguments(), TrustedImm32(argc));
return; // we need to return to avoid checking the exceptions
}
}
assert(member->base->asTemp() != 0);
int argc = prepareVariableArguments(call->args);
- generateFunctionCall(__qmljs_construct_property, ContextRegister, result, member->base->asTemp(), identifier(*member->name), baseAddressForCallArguments(), TrustedImm32(argc));
+ generateFunctionCall2(result, __qmljs_construct_property, ContextRegister, member->base->asTemp(), identifier(*member->name), baseAddressForCallArguments(), TrustedImm32(argc));
checkExceptions();
}
assert(baseTemp != 0);
int argc = prepareVariableArguments(call->args);
- generateFunctionCall(__qmljs_construct_value, ContextRegister, result, baseTemp, baseAddressForCallArguments(), TrustedImm32(argc));
+ generateFunctionCall2(result, __qmljs_construct_value, ContextRegister, baseTemp, baseAddressForCallArguments(), TrustedImm32(argc));
checkExceptions();
}