aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-10-20 16:54:10 +0200
committerLars Knoll <lars.knoll@qt.io>2017-11-07 09:00:44 +0000
commitbc5ff76e5afe6356bebb344c9a5d8b304e852f3c (patch)
tree436e4cfdcad3ec2e882c300c85395fdeee3a4d48 /src/qml/jsruntime
parent9b25000cb41b97c9c9f49a542c9b82cf25c032db (diff)
Simplify JSCallData construction
Change-Id: Ic53532edae9a209aa7125af6f00a9d993d74f1a3 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4argumentsobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4arraybuffer.cpp2
-rw-r--r--src/qml/jsruntime/qv4arraydata.cpp2
-rw-r--r--src/qml/jsruntime/qv4arrayobject.cpp18
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4globalobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4include.cpp2
-rw-r--r--src/qml/jsruntime/qv4jscall_p.h30
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4lookup.cpp16
-rw-r--r--src/qml/jsruntime/qv4object.cpp8
-rw-r--r--src/qml/jsruntime/qv4objectproto.cpp2
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp2
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp16
-rw-r--r--src/qml/jsruntime/qv4script.cpp4
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp8
-rw-r--r--src/qml/jsruntime/qv4typedarray.cpp2
20 files changed, 54 insertions, 78 deletions
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp
index 298c674504..db0a7db068 100644
--- a/src/qml/jsruntime/qv4argumentsobject.cpp
+++ b/src/qml/jsruntime/qv4argumentsobject.cpp
@@ -139,7 +139,7 @@ bool ArgumentsObject::defineOwnProperty(ExecutionEngine *engine, uint index, con
if (isMapped && attrs.isData()) {
Q_ASSERT(arrayData());
ScopedFunctionObject setter(scope, map->setter());
- JSCallData jsCallData(scope, setter, 1);
+ JSCallData jsCallData(scope, 1);
jsCallData->thisObject = this->asReturnedValue();
jsCallData->args[0] = desc->value;
setter->call(jsCallData);
diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp
index 3bbec7957a..dd29411b46 100644
--- a/src/qml/jsruntime/qv4arraybuffer.cpp
+++ b/src/qml/jsruntime/qv4arraybuffer.cpp
@@ -187,7 +187,7 @@ ReturnedValue ArrayBufferPrototype::method_slice(const BuiltinFunction *b, CallD
if (!constructor)
return v4->throwTypeError();
- JSCallData jsCallData(scope, constructor, 1);
+ JSCallData jsCallData(scope, 1);
double newLen = qMax(final - first, 0.);
jsCallData->args[0] = QV4::Encode(newLen);
QV4::Scoped<ArrayBuffer> newBuffer(scope, constructor->callAsConstructor(jsCallData));
diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp
index 8d048ca1d6..b77fab3305 100644
--- a/src/qml/jsruntime/qv4arraydata.cpp
+++ b/src/qml/jsruntime/qv4arraydata.cpp
@@ -677,7 +677,7 @@ bool ArrayElementLessThan::operator()(Value v1, Value v2) const
if (o) {
Scope scope(o->engine());
ScopedValue result(scope);
- JSCallData jsCallData(scope, o, 2);
+ JSCallData jsCallData(scope, 2);
jsCallData->args[0] = v1;
jsCallData->args[1] = v2;
result = o->call(jsCallData);
diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp
index 83bfe8e84c..eef9ac0820 100644
--- a/src/qml/jsruntime/qv4arrayobject.cpp
+++ b/src/qml/jsruntime/qv4arrayobject.cpp
@@ -198,7 +198,7 @@ ReturnedValue ArrayPrototype::method_find(const BuiltinFunction *b, CallData *ca
if (!callback)
THROW_TYPE_ERROR();
- JSCallData jsCallData(scope, callback, 3);
+ JSCallData jsCallData(scope, 3);
jsCallData->thisObject = callData->argument(1);
ScopedValue v(scope);
@@ -234,7 +234,7 @@ ReturnedValue ArrayPrototype::method_findIndex(const BuiltinFunction *b, CallDat
if (!callback)
THROW_TYPE_ERROR();
- JSCallData jsCallData(scope, callback, 3);
+ JSCallData jsCallData(scope, 3);
jsCallData->thisObject = callData->argument(1);
ScopedValue v(scope);
@@ -793,7 +793,7 @@ ReturnedValue ArrayPrototype::method_every(const BuiltinFunction *b, CallData *c
ScopedValue r(scope);
ScopedValue v(scope);
- JSCallData jsCallData(scope, callback, 3);
+ JSCallData jsCallData(scope, 3);
jsCallData->thisObject = callData->argument(1);
bool ok = true;
@@ -827,7 +827,7 @@ ReturnedValue ArrayPrototype::method_some(const BuiltinFunction *b, CallData *ca
ScopedValue v(scope);
ScopedValue result(scope);
- JSCallData jsCallData(scope, callback, 3);
+ JSCallData jsCallData(scope, 3);
jsCallData->thisObject = callData->argument(1);
for (uint k = 0; k < len; ++k) {
@@ -860,7 +860,7 @@ ReturnedValue ArrayPrototype::method_forEach(const BuiltinFunction *b, CallData
THROW_TYPE_ERROR();
ScopedValue v(scope);
- JSCallData jsCallData(scope, callback, 3);
+ JSCallData jsCallData(scope, 3);
jsCallData->thisObject = callData->argument(1);
for (uint k = 0; k < len; ++k) {
@@ -896,7 +896,7 @@ ReturnedValue ArrayPrototype::method_map(const BuiltinFunction *b, CallData *cal
ScopedValue v(scope);
ScopedValue mapped(scope);
- JSCallData jsCallData(scope, callback, 3);
+ JSCallData jsCallData(scope, 3);
jsCallData->thisObject = callData->argument(1);
for (uint k = 0; k < len; ++k) {
@@ -932,7 +932,7 @@ ReturnedValue ArrayPrototype::method_filter(const BuiltinFunction *b, CallData *
ScopedValue selected(scope);
ScopedValue v(scope);
- JSCallData jsCallData(scope, callback, 3);
+ JSCallData jsCallData(scope, 3);
jsCallData->thisObject = callData->argument(1);
uint to = 0;
@@ -985,7 +985,7 @@ ReturnedValue ArrayPrototype::method_reduce(const BuiltinFunction *b, CallData *
THROW_TYPE_ERROR();
}
- JSCallData jsCallData(scope, callback, 4);
+ JSCallData jsCallData(scope, 4);
while (k < len) {
bool kPresent;
@@ -1038,7 +1038,7 @@ ReturnedValue ArrayPrototype::method_reduceRight(const BuiltinFunction *b, CallD
THROW_TYPE_ERROR();
}
- JSCallData jsCallData(scope, callback, 4);
+ JSCallData jsCallData(scope, 4);
jsCallData->thisObject = Primitive::undefinedValue();
while (k > 0) {
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index 436950bf28..3397e5418b 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -1451,7 +1451,7 @@ ReturnedValue DatePrototype::method_toJSON(const BuiltinFunction *b, CallData *c
if (!toIso)
return v4->throwTypeError();
- JSCallData jsCallData(scope, toIso);
+ JSCallData jsCallData(scope);
jsCallData->thisObject = callData->thisObject;
return toIso->call(jsCallData);
}
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 208af838a7..21aacb68d6 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -73,13 +73,13 @@ Q_STATIC_ASSERT((Heap::FunctionObject::markTable & Heap::Object::markTable) == H
static ReturnedValue jsCallWrapper(const QV4::FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
{
Scope scope(f->engine());
- JSCallData callData(scope, f->asReturnedValue(), argv, argc, thisObject);
+ JSCallData callData(scope, argc, argv, thisObject);
return f->vtable()->call(f, callData.callData(f));
}
ReturnedValue jsConstructWrapper(const QV4::FunctionObject *f, const Value *argv, int argc)
{
Scope scope(f->engine());
- JSCallData callData(scope, f->asReturnedValue(), argv, argc);
+ JSCallData callData(scope, argc, argv);
return f->vtable()->construct(f, callData.callData(f));
}
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp
index 3c91417b0e..4e96b01185 100644
--- a/src/qml/jsruntime/qv4globalobject.cpp
+++ b/src/qml/jsruntime/qv4globalobject.cpp
@@ -374,7 +374,7 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall) const
if (function->isStrict() || (ctx->d()->v4Function->isStrict())) {
ScopedFunctionObject e(scope, FunctionObject::createScriptFunction(ctx, function));
- JSCallData jsCallData(scope, e, 0);
+ JSCallData jsCallData(scope, 0);
if (directCall)
jsCallData->thisObject = scope.engine->currentStackFrame->thisObject();
else
@@ -387,7 +387,7 @@ ReturnedValue EvalFunction::evalCall(CallData *callData, bool directCall) const
// set the correct v4 function for the context
ctx->d()->v4Function = function;
- JSCallData jsCall(scope, nullptr);
+ JSCallData jsCall(scope);
jsCall->thisObject = scope.engine->currentStackFrame->thisObject();
jsCall->context = *ctx;
return function->call(jsCall.callData());
diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp
index 7feea14a05..df20b2802d 100644
--- a/src/qml/jsruntime/qv4include.cpp
+++ b/src/qml/jsruntime/qv4include.cpp
@@ -119,7 +119,7 @@ void QV4Include::callback(const QV4::Value &callback, const QV4::Value &status)
if (!f)
return;
- QV4::JSCallData jsCallData(scope, f, 1);
+ QV4::JSCallData jsCallData(scope, 1);
jsCallData->thisObject = v4->globalObject->asReturnedValue();
jsCallData->args[0] = status;
f->call(jsCallData);
diff --git a/src/qml/jsruntime/qv4jscall_p.h b/src/qml/jsruntime/qv4jscall_p.h
index 0bb2d840da..0f22aa1aa7 100644
--- a/src/qml/jsruntime/qv4jscall_p.h
+++ b/src/qml/jsruntime/qv4jscall_p.h
@@ -61,20 +61,7 @@ QT_BEGIN_NAMESPACE
namespace QV4 {
struct JSCallData {
- JSCallData(const Scope &scope, std::nullptr_t, int argc = 0)
- {
- int size = int(offsetof(QV4::CallData, args)/sizeof(QV4::Value)) + argc;
- ptr = reinterpret_cast<CallData *>(scope.alloc(size));
- ptr->setArgc(argc);
- }
- JSCallData(const Scope &scope, const FunctionObject *function, int argc = 0)
- {
- int size = int(offsetof(QV4::CallData, args)/sizeof(QV4::Value)) + argc;
- ptr = reinterpret_cast<CallData *>(scope.alloc(size));
- ptr->setArgc(argc);
- ptr->function = *function;
- }
- JSCallData(const Scope &scope, Value *argv, int argc, Value *thisObject = 0)
+ JSCallData(const Scope &scope, int argc = 0, const Value *argv = 0, const Value *thisObject = 0)
{
int size = int(offsetof(QV4::CallData, args)/sizeof(QV4::Value)) + argc;
ptr = reinterpret_cast<CallData *>(scope.engine->jsStackTop);
@@ -84,19 +71,8 @@ struct JSCallData {
ptr->accumulator = Encode::undefined();
ptr->thisObject = thisObject ? thisObject->asReturnedValue() : Encode::undefined();
ptr->setArgc(argc);
- memcpy(ptr->args, argv, argc*sizeof(Value));
- }
- JSCallData(const Scope &scope, ReturnedValue function, const Value *argv, int argc, const Value *thisObject = 0)
- {
- int size = int(offsetof(QV4::CallData, args)/sizeof(QV4::Value)) + argc;
- ptr = reinterpret_cast<CallData *>(scope.engine->jsStackTop);
- scope.engine->jsStackTop += size;
- ptr->function = function;
- ptr->context = Encode::undefined();
- ptr->accumulator = Encode::undefined();
- ptr->thisObject = thisObject ? thisObject->asReturnedValue() : Encode::undefined();
- ptr->setArgc(argc);
- memcpy(ptr->args, argv, argc*sizeof(Value));
+ if (argv)
+ memcpy(ptr->args, argv, argc*sizeof(Value));
}
CallData *operator->() const {
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index 7a4ae595ae..16018722cb 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -697,7 +697,7 @@ QString Stringify::Str(const QString &key, const Value &v)
ScopedString s(scope, v4->newString(QStringLiteral("toJSON")));
ScopedFunctionObject toJSON(scope, o->get(s));
if (!!toJSON) {
- JSCallData jsCallData(scope, toJSON, 1);
+ JSCallData jsCallData(scope, 1);
jsCallData->thisObject = value;
jsCallData->args[0] = v4->newString(key);
value = toJSON->call(jsCallData);
@@ -707,7 +707,7 @@ QString Stringify::Str(const QString &key, const Value &v)
if (replacerFunction) {
ScopedObject holder(scope, v4->newObject());
holder->put(scope.engine->id_empty(), value);
- JSCallData jsCallData(scope, replacerFunction, 2);
+ JSCallData jsCallData(scope, 2);
jsCallData->args[0] = v4->newString(key);
jsCallData->args[1] = value;
jsCallData->thisObject = holder;
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp
index 17667cbae6..87c396be73 100644
--- a/src/qml/jsruntime/qv4lookup.cpp
+++ b/src/qml/jsruntime/qv4lookup.cpp
@@ -400,7 +400,7 @@ ReturnedValue Lookup::getterAccessor0(Lookup *l, ExecutionEngine *engine, const
if (!getter)
return Encode::undefined();
- JSCallData jsCallData(scope, getter, 0);
+ JSCallData jsCallData(scope);
jsCallData->thisObject = object;
return getter->call(jsCallData);
}
@@ -422,7 +422,7 @@ ReturnedValue Lookup::getterAccessor1(Lookup *l, ExecutionEngine *engine, const
if (!getter)
return Encode::undefined();
- JSCallData jsCallData(scope, getter, 0);
+ JSCallData jsCallData(scope);
jsCallData->thisObject = object;
return getter->call(jsCallData);
}
@@ -447,7 +447,7 @@ ReturnedValue Lookup::getterAccessor2(Lookup *l, ExecutionEngine *engine, const
if (!getter)
return Encode::undefined();
- JSCallData jsCallData(scope, getter, 0);
+ JSCallData jsCallData(scope);
jsCallData->thisObject = object;
return getter->call(jsCallData);
}
@@ -502,7 +502,7 @@ ReturnedValue Lookup::primitiveGetterAccessor0(Lookup *l, ExecutionEngine *engin
if (!getter)
return Encode::undefined();
- JSCallData jsCallData(scope, getter, 0);
+ JSCallData jsCallData(scope);
jsCallData->thisObject = object;
return getter->call(jsCallData);
}
@@ -522,7 +522,7 @@ ReturnedValue Lookup::primitiveGetterAccessor1(Lookup *l, ExecutionEngine *engin
if (!getter)
return Encode::undefined();
- JSCallData jsCallData(scope, getter, 0);
+ JSCallData jsCallData(scope);
jsCallData->thisObject = object;
return getter->call(jsCallData);
}
@@ -641,7 +641,7 @@ ReturnedValue Lookup::globalGetterAccessor0(Lookup *l, ExecutionEngine *engine)
if (!getter)
return Encode::undefined();
- JSCallData jsCallData(scope, getter, 0);
+ JSCallData jsCallData(scope);
return getter->call(jsCallData);
}
l->globalGetter = globalGetterGeneric;
@@ -658,7 +658,7 @@ ReturnedValue Lookup::globalGetterAccessor1(Lookup *l, ExecutionEngine *engine)
if (!getter)
return Encode::undefined();
- JSCallData jsCallData(scope, getter, 0);
+ JSCallData jsCallData(scope);
return getter->call(jsCallData);
}
l->globalGetter = globalGetterGeneric;
@@ -678,7 +678,7 @@ ReturnedValue Lookup::globalGetterAccessor2(Lookup *l, ExecutionEngine *engine)
if (!getter)
return Encode::undefined();
- JSCallData jsCallData(scope, getter, 0);
+ JSCallData jsCallData(scope);
return getter->call(jsCallData);
}
}
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index c52cad69d1..18a831a4ba 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -107,7 +107,7 @@ ReturnedValue Object::getValue(const Value &thisObject, const Value &v, Property
return Encode::undefined();
Scope scope(f->engine());
- JSCallData jsCallData(scope, f);
+ JSCallData jsCallData(scope);
jsCallData->thisObject = thisObject;
return f->call(jsCallData);
}
@@ -125,7 +125,7 @@ bool Object::putValue(uint memberIndex, const Value &value)
if (set) {
Scope scope(ic->engine);
ScopedFunctionObject setter(scope, set);
- JSCallData jsCallData(scope, setter, 1);
+ JSCallData jsCallData(scope, 1);
jsCallData->args[0] = value;
jsCallData->thisObject = this;
setter->call(jsCallData);
@@ -764,7 +764,7 @@ bool Object::internalPut(String *name, const Value &value)
Scope scope(engine);
ScopedFunctionObject setter(scope, *memberIndex);
- JSCallData jsCallData(scope, setter, 1);
+ JSCallData jsCallData(scope, 1);
jsCallData->args[0] = value;
jsCallData->thisObject = this;
setter->call(jsCallData);
@@ -829,7 +829,7 @@ bool Object::internalPutIndexed(uint index, const Value &value)
Scope scope(engine);
ScopedFunctionObject setter(scope, *arrayIndex);
- JSCallData jsCallData(scope, setter, 1);
+ JSCallData jsCallData(scope, 1);
jsCallData->args[0] = value;
jsCallData->thisObject = this;
setter->call(jsCallData);
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp
index 198d7d285e..c174cb4dcd 100644
--- a/src/qml/jsruntime/qv4objectproto.cpp
+++ b/src/qml/jsruntime/qv4objectproto.cpp
@@ -479,7 +479,7 @@ ReturnedValue ObjectPrototype::method_toLocaleString(const BuiltinFunction *b, C
ScopedFunctionObject f(scope, o->get(scope.engine->id_toString()));
if (!f)
THROW_TYPE_ERROR();
- JSCallData jsCallData(scope, f);
+ JSCallData jsCallData(scope);
jsCallData->thisObject = o;
return f->call(jsCallData);
}
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index a6c0218c2b..febcc22fa3 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -816,7 +816,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
QV4::Scope scope(v4);
QV4::ScopedFunctionObject f(scope, This->function.value());
- QV4::JSCallData jsCallData(scope, f, argCount);
+ QV4::JSCallData jsCallData(scope, argCount);
jsCallData->thisObject = This->thisObject.isUndefined() ? v4->globalObject->asReturnedValue() : This->thisObject.value();
for (int ii = 0; ii < argCount; ++ii) {
int type = argsTypes[ii + 1];
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 556a2a5339..1d1a786e61 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -436,7 +436,7 @@ ReturnedValue RegExpPrototype::method_compile(const BuiltinFunction *b, CallData
if (!r)
return scope.engine->throwTypeError();
- JSCallData jsCallData(scope, scope.engine->regExpCtor(), callData->argc());
+ JSCallData jsCallData(scope, callData->argc());
memcpy(jsCallData->args, callData->args, callData->argc()*sizeof(Value));
Scoped<RegExpObject> re(scope, scope.engine->regExpCtor()->callAsConstructor(jsCallData));
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index aecff0f629..00882d699c 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -429,7 +429,7 @@ ReturnedValue RuntimeHelpers::objectDefaultValue(const Object *object, int typeH
ScopedValue result(scope);
ScopedValue conv(scope, object->get(meth1));
- JSCallData jsCallData(scope, nullptr, 0);
+ JSCallData jsCallData(scope, 0);
jsCallData->thisObject = *object;
if (FunctionObject *o = conv->as<FunctionObject>()) {
@@ -982,7 +982,7 @@ ReturnedValue Runtime::method_callGlobalLookup(ExecutionEngine *engine, uint ind
ReturnedValue Runtime::method_callPossiblyDirectEval(ExecutionEngine *engine, Value *argv, int argc)
{
Scope scope(engine);
- JSCallData callData(scope, argv, argc);
+ JSCallData callData(scope, argc, argv);
Q_ASSERT(callData->args + callData->argc() == engine->jsStackTop);
ExecutionContext &ctx = static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context);
@@ -1009,7 +1009,7 @@ ReturnedValue Runtime::method_callPossiblyDirectEval(ExecutionEngine *engine, Va
ReturnedValue Runtime::method_callName(ExecutionEngine *engine, int nameIndex, Value *argv, int argc)
{
Scope scope(engine);
- JSCallData callData(scope, argv, argc);
+ JSCallData callData(scope, argc, argv);
Q_ASSERT(callData->args + callData->argc() == engine->jsStackTop);
callData->function = engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex];
@@ -1036,7 +1036,7 @@ ReturnedValue Runtime::method_callName(ExecutionEngine *engine, int nameIndex, V
ReturnedValue Runtime::method_callProperty(ExecutionEngine *engine, Value *base, int nameIndex, Value *argv, int argc)
{
Scope scope(engine);
- JSCallData callData(scope, argv, argc, base);
+ JSCallData callData(scope, argc, argv, base);
Q_ASSERT(callData->args + callData->argc() == engine->jsStackTop);
if (!callData->thisObject.isObject()) {
@@ -1070,7 +1070,7 @@ ReturnedValue Runtime::method_callProperty(ExecutionEngine *engine, Value *base,
ReturnedValue Runtime::method_callPropertyLookup(ExecutionEngine *engine, Value *base, uint index, Value *argv, int argc)
{
Scope scope(engine);
- JSCallData callData(scope, argv, argc, base);
+ JSCallData callData(scope, argc, argv, base);
Q_ASSERT(callData->args + callData->argc() == engine->jsStackTop);
Q_ASSERT(engine->jsStackTop >= callData->args + callData->argc());
@@ -1087,7 +1087,7 @@ ReturnedValue Runtime::method_callPropertyLookup(ExecutionEngine *engine, Value
ReturnedValue Runtime::method_callElement(ExecutionEngine *engine, Value *base, const Value &index, Value *argv, int argc)
{
Scope scope(engine);
- JSCallData callData(scope, argv, argc, base);
+ JSCallData callData(scope, argc, argv, base);
Q_ASSERT(callData->args + callData->argc() == engine->jsStackTop);
callData->thisObject = callData->thisObject.toObject(engine);
@@ -1108,10 +1108,10 @@ ReturnedValue Runtime::method_callValue(ExecutionEngine *engine, const Value &fu
return engine->throwTypeError(QStringLiteral("%1 is not a function").arg(func.toQStringNoThrow()));
Scope scope(engine);
- JSCallData callData(scope, func.asReturnedValue(), argv, argc);
+ JSCallData callData(scope, argc, argv);
Q_ASSERT(callData->args + callData->argc() == engine->jsStackTop);
- return static_cast<FunctionObject &>(callData->function).call(&callData->thisObject, callData->args, callData->argc());
+ return static_cast<const FunctionObject &>(func).call(&callData->thisObject, callData->args, callData->argc());
}
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index c0a00032dd..8ca4985b32 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -152,13 +152,13 @@ ReturnedValue Script::run()
ContextStateSaver stateSaver(valueScope, context);
context->d()->v4Function = vmFunction;
- QV4::JSCallData jsCall(valueScope, nullptr);
+ QV4::JSCallData jsCall(valueScope);
jsCall->thisObject = engine->globalObject;
jsCall->context = *context;
return vmFunction->call(jsCall.callData());
} else {
Scoped<QmlContext> qml(valueScope, qmlContext.value());
- JSCallData jsCall(valueScope, nullptr);
+ JSCallData jsCall(valueScope);
jsCall->thisObject = Primitive::undefinedValue();
jsCall->context = *qml;
return vmFunction->call(jsCall.callData());
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index 818711fc99..4dd71fe582 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -420,7 +420,7 @@ public:
ScopedFunctionObject compare(scope, m_compareFn);
if (!compare)
return m_v4->throwTypeError();
- JSCallData jsCallData(scope, compare, 2);
+ JSCallData jsCallData(scope, 2);
jsCallData->args[0] = convertElementToValue(m_v4, lhs);
jsCallData->args[1] = convertElementToValue(m_v4, rhs);
jsCallData->thisObject = m_v4->globalObject;
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index 11fdcae6f8..d8bd51ac39 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -583,7 +583,7 @@ ReturnedValue StringPrototype::method_replace(const BuiltinFunction *b, CallData
if (!!searchCallback) {
result.reserve(string.length() + 10*numStringMatches);
ScopedValue entry(scope);
- JSCallData jsCallData(scope, searchCallback, numCaptures + 2);
+ JSCallData jsCallData(scope, numCaptures + 2);
jsCallData->thisObject = Primitive::undefinedValue();
int lastEnd = 0;
for (int i = 0; i < numStringMatches; ++i) {
@@ -644,9 +644,9 @@ ReturnedValue StringPrototype::method_search(const BuiltinFunction *b, CallData
RegExpObject *regExp = regExpObj->as<RegExpObject>();
if (!regExp) {
- JSCallData jsCallDataData(scope, scope.engine->regExpCtor(), 1);
- jsCallDataData->args[0] = regExpObj;
- regExpObj = scope.engine->regExpCtor()->callAsConstructor(jsCallDataData);
+ JSCallData jsCallData(scope, 1);
+ jsCallData->args[0] = regExpObj;
+ regExpObj = scope.engine->regExpCtor()->callAsConstructor(jsCallData);
if (scope.engine->hasException)
return QV4::Encode::undefined();
diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp
index 8583d5da06..631fed426a 100644
--- a/src/qml/jsruntime/qv4typedarray.cpp
+++ b/src/qml/jsruntime/qv4typedarray.cpp
@@ -572,7 +572,7 @@ ReturnedValue TypedArrayPrototype::method_subarray(const BuiltinFunction *builti
if (!constructor)
return scope.engine->throwTypeError();
- JSCallData jsCallData(scope, constructor, 3);
+ JSCallData jsCallData(scope, 3);
jsCallData->args[0] = buffer;
jsCallData->args[1] = Encode(a->d()->byteOffset + begin*a->d()->type->bytesPerElement);
jsCallData->args[2] = Encode(newLen);