aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2012-10-17 09:05:56 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-17 09:35:39 +0200
commitf5b98f63862d4f36774d6baea5d3789350844e04 (patch)
tree50a59c6cceea4f154a9c83365b5f10f167606769
parent951990255e4a6909a5b2f652ac1c651848d2877c (diff)
Generate correct code when calling values
__qmljs_call_value was still using a pointer to a Value. In addition, qcv4isel_masm.cpp was using a wrong order of the arguments. Change-Id: I0414aa732ae8074420e4f11525f5b04712cc1bab Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--llvm_runtime.cpp2
-rw-r--r--moth/qv4vme_moth.cpp2
-rw-r--r--qmljs_runtime.cpp10
-rw-r--r--qmljs_runtime.h2
-rw-r--r--qv4array.cpp2
-rw-r--r--qv4ecmaobjects.cpp18
-rw-r--r--qv4isel_masm.cpp2
7 files changed, 19 insertions, 19 deletions
diff --git a/llvm_runtime.cpp b/llvm_runtime.cpp
index 96d5e36a08..f8770bbfa6 100644
--- a/llvm_runtime.cpp
+++ b/llvm_runtime.cpp
@@ -229,7 +229,7 @@ void __qmljs_llvm_call_activation_property(Context *context, Value *result, Stri
void __qmljs_llvm_call_value(Context *context, Value *result, const Value *thisObject, const Value *func, Value *args, int argc)
{
Value that = thisObject ? *thisObject : Value::undefinedValue();
- *result = __qmljs_call_value(context, that, func, args, argc);
+ *result = __qmljs_call_value(context, that, *func, args, argc);
}
void __qmljs_llvm_construct_activation_property(Context *context, Value *result, String *name, Value *args, int argc)
diff --git a/moth/qv4vme_moth.cpp b/moth/qv4vme_moth.cpp
index 4bc2304967..f31fb0a858 100644
--- a/moth/qv4vme_moth.cpp
+++ b/moth/qv4vme_moth.cpp
@@ -133,7 +133,7 @@ void VME::operator()(QQmlJS::VM::Context *context, const uchar *code
MOTH_BEGIN_INSTR(Call)
VM::Value *args = stack.data() + instr.args;
- tempRegister = __qmljs_call_value(context, VM::Value::undefinedValue(), &tempRegister, args, instr.argc);
+ tempRegister = __qmljs_call_value(context, VM::Value::undefinedValue(), tempRegister, args, instr.argc);
MOTH_END_INSTR(Call)
MOTH_BEGIN_INSTR(Jump)
diff --git a/qmljs_runtime.cpp b/qmljs_runtime.cpp
index 94c2bc299c..73391159f2 100644
--- a/qmljs_runtime.cpp
+++ b/qmljs_runtime.cpp
@@ -809,14 +809,14 @@ Value __qmljs_object_default_value(Context *ctx, const Value object, int typeHin
Value conv = oo->getProperty(ctx, meth1);
if (!conv.isUndefined() && conv.isFunctionObject()) {
- Value r = __qmljs_call_value(ctx, object, &conv, 0, 0);
+ Value r = __qmljs_call_value(ctx, object, conv, 0, 0);
if (r.isPrimitive())
return r;
}
conv = oo->getProperty(ctx, meth2);
if (!conv.isUndefined() && conv.isFunctionObject()) {
- Value r = __qmljs_call_value(ctx, object, &conv, 0, 0);
+ Value r = __qmljs_call_value(ctx, object, conv, 0, 0);
if (r.isPrimitive())
return r;
}
@@ -1074,7 +1074,7 @@ Value __qmljs_call_activation_property(Context *context, String *name, Value *ar
context->throwReferenceError(Value::fromString(name));
return Value::undefinedValue();
}
- Value result = __qmljs_call_value(context, Value::undefinedValue(), func, args, argc);
+ Value result = __qmljs_call_value(context, Value::undefinedValue(), *func, args, argc);
return result;
}
@@ -1111,10 +1111,10 @@ Value __qmljs_call_property(Context *context, const Value base, String *name, Va
return result;
}
-Value __qmljs_call_value(Context *context, const Value thisObject, const Value *func, Value *args, int argc)
+Value __qmljs_call_value(Context *context, const Value thisObject, const Value func, Value *args, int argc)
{
Value result;
- if (FunctionObject *f = func->asFunctionObject()) {
+ if (FunctionObject *f = func.asFunctionObject()) {
Context k;
Context *ctx = f->needsActivation ? context->engine->newContext() : &k;
const Value *that = thisObject.isUndefined() ? 0 : &thisObject;
diff --git a/qmljs_runtime.h b/qmljs_runtime.h
index 3b931641ac..82becb1467 100644
--- a/qmljs_runtime.h
+++ b/qmljs_runtime.h
@@ -93,7 +93,7 @@ extern "C" {
// context
Value __qmljs_call_activation_property(Context *, String *name, Value *args, int argc);
Value __qmljs_call_property(Context *context, const Value base, String *name, Value *args, int argc);
-Value __qmljs_call_value(Context *context, const Value thisObject, const Value *func, Value *args, int argc);
+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);
Value __qmljs_construct_property(Context *context, const Value base, String *name, Value *args, int argc);
diff --git a/qv4array.cpp b/qv4array.cpp
index 7923b1e3a9..7f05d018fa 100644
--- a/qv4array.cpp
+++ b/qv4array.cpp
@@ -53,7 +53,7 @@ bool ArrayElementLessThan::operator()(const Value &v1, const Value &v2) const
return true;
if (!m_comparefn.isUndefined()) {
Value args[] = { v1, v2 };
- Value result = __qmljs_call_value(m_context, Value::undefinedValue(), &m_comparefn, args, 2);
+ Value result = __qmljs_call_value(m_context, Value::undefinedValue(), m_comparefn, args, 2);
return result.toNumber(m_context) <= 0;
}
return v1.toString(m_context)->toQString() < v2.toString(m_context)->toQString();
diff --git a/qv4ecmaobjects.cpp b/qv4ecmaobjects.cpp
index 426ab0fedd..54985facf7 100644
--- a/qv4ecmaobjects.cpp
+++ b/qv4ecmaobjects.cpp
@@ -1548,7 +1548,7 @@ void ArrayPrototype::method_every(Context *ctx)
args[0] = v;
args[1] = Value::fromDouble(k);
args[2] = ctx->thisObject;
- Value r = __qmljs_call_value(ctx, thisArg, &callback, args, 3);
+ Value r = __qmljs_call_value(ctx, thisArg, callback, args, 3);
ok = __qmljs_to_boolean(r, ctx);
}
ctx->result = Value::fromBoolean(ok);
@@ -1577,7 +1577,7 @@ void ArrayPrototype::method_some(Context *ctx)
args[0] = v;
args[1] = Value::fromDouble(k);
args[2] = ctx->thisObject;
- Value r = __qmljs_call_value(ctx, thisArg, &callback, args, 3);
+ Value r = __qmljs_call_value(ctx, thisArg, callback, args, 3);
ok = __qmljs_to_boolean(r, ctx);
}
ctx->result = Value::fromBoolean(ok);
@@ -1606,7 +1606,7 @@ void ArrayPrototype::method_forEach(Context *ctx)
args[0] = v;
args[1] = Value::fromDouble(k);
args[2] = ctx->thisObject;
- Value r = __qmljs_call_value(ctx, thisArg, &callback, args, 3);
+ Value r = __qmljs_call_value(ctx, thisArg, callback, args, 3);
}
}
} else {
@@ -1633,7 +1633,7 @@ void ArrayPrototype::method_map(Context *ctx)
args[0] = v;
args[1] = Value::fromDouble(k);
args[2] = ctx->thisObject;
- Value r = __qmljs_call_value(ctx, thisArg, &callback, args, 3);
+ Value r = __qmljs_call_value(ctx, thisArg, callback, args, 3);
a->value.assign(k, r);
}
ctx->result = Value::fromObject(a);
@@ -1661,7 +1661,7 @@ void ArrayPrototype::method_filter(Context *ctx)
args[0] = v;
args[1] = Value::fromDouble(k);
args[2] = ctx->thisObject;
- Value r = __qmljs_call_value(ctx, thisArg, &callback, args, 3);
+ Value r = __qmljs_call_value(ctx, thisArg, callback, args, 3);
if (__qmljs_to_boolean(r, ctx)) {
const uint index = a->value.size();
a->value.resize(index + 1);
@@ -1697,7 +1697,7 @@ void ArrayPrototype::method_reduce(Context *ctx)
args[1] = v;
args[2] = Value::fromDouble(k);
args[3] = ctx->thisObject;
- Value r = __qmljs_call_value(ctx, Value::undefinedValue(), &callback, args, 4);
+ Value r = __qmljs_call_value(ctx, Value::undefinedValue(), callback, args, 4);
acc = r;
}
ctx->result = acc;
@@ -1728,7 +1728,7 @@ void ArrayPrototype::method_reduceRight(Context *ctx)
args[1] = v;
args[2] = Value::fromDouble(k);
args[3] = ctx->thisObject;
- Value r = __qmljs_call_value(ctx, Value::undefinedValue(), &callback, args, 4);
+ Value r = __qmljs_call_value(ctx, Value::undefinedValue(), callback, args, 4);
acc = r;
}
ctx->result = acc;
@@ -1798,7 +1798,7 @@ void FunctionPrototype::method_apply(Context *ctx)
return;
}
- ctx->result = __qmljs_call_value(ctx, thisObject, &ctx->thisObject, args.data(), args.size());
+ ctx->result = __qmljs_call_value(ctx, thisObject, ctx->thisObject, args.data(), args.size());
} else {
ctx->throwTypeError();
}
@@ -1812,7 +1812,7 @@ void FunctionPrototype::method_call(Context *ctx)
QVector<Value> args(ctx->argumentCount ? ctx->argumentCount - 1 : 0);
if (ctx->argumentCount)
qCopy(ctx->arguments + 1, ctx->arguments + ctx->argumentCount, args.begin());
- ctx->result = __qmljs_call_value(ctx, thisArg, &ctx->thisObject, args.data(), args.size());
+ ctx->result = __qmljs_call_value(ctx, thisArg, ctx->thisObject, args.data(), args.size());
} else {
ctx->throwTypeError();
}
diff --git a/qv4isel_masm.cpp b/qv4isel_masm.cpp
index c187613b33..c2f09afe41 100644
--- a/qv4isel_masm.cpp
+++ b/qv4isel_masm.cpp
@@ -228,7 +228,7 @@ void InstructionSelection::callValue(IR::Call *call, IR::Temp *result)
int argc = prepareVariableArguments(call->args);
IR::Temp* thisObject = 0;
- generateFunctionCall2(result, __qmljs_call_value, ContextRegister, baseTemp, thisObject, baseAddressForCallArguments(), TrustedImm32(argc));
+ generateFunctionCall2(result, __qmljs_call_value, ContextRegister, thisObject, baseTemp, baseAddressForCallArguments(), TrustedImm32(argc));
checkExceptions();
}