diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-10-20 15:14:41 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-11-07 09:00:26 +0000 |
commit | c6c79644dc869259482a011f8b737f709af02fb2 (patch) | |
tree | 6f3c3a721f7bbd1b1a76189b537faffc4de24c1a | |
parent | 7287690a41ab762c0c4efe02632efeaf3e0187b4 (diff) |
Rename JSCall to JSCallData
As, this is going to change in a simple stack based structure
to keep pointers to the data to pass to calls.
Change-Id: Ia9aa3f81ee3eeba36affd16aac7b2fe97d59aea9
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
33 files changed, 82 insertions, 81 deletions
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index 3781a776a1..4de4a9520f 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -414,7 +414,7 @@ static ReturnedValue qmlsqldatabase_changeVersion(const QV4::BuiltinFunction *b, ok = false; db.transaction(); - JSCall jsCall(scope, callback, 1); + JSCallData jsCall(scope, callback, 1); jsCall->thisObject = scope.engine->globalObject; jsCall->args[0] = w; @@ -464,7 +464,7 @@ static ReturnedValue qmlsqldatabase_transaction_shared(const QV4::BuiltinFunctio db.transaction(); if (callback) { - JSCall jsCall(scope, callback, 1); + JSCallData jsCall(scope, callback, 1); jsCall->thisObject = scope.engine->globalObject; jsCall->args[0] = w; TransactionRollback rollbackOnException(&db, &w->d()->inTransaction); @@ -763,7 +763,7 @@ void QQuickLocalStorage::openDatabaseSync(QQmlV4Function *args) *db->d()->version = version; if (created && dbcreationCallback) { - JSCall jsCall(scope, dbcreationCallback, 1); + JSCallData jsCall(scope, dbcreationCallback, 1); jsCall->thisObject = scope.engine->globalObject; jsCall->args[0] = db; jsCall.call(); diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp index afd2b1560f..0bd7b0a62b 100644 --- a/src/qml/jsapi/qjsvalue.cpp +++ b/src/qml/jsapi/qjsvalue.cpp @@ -657,7 +657,7 @@ QJSValue QJSValue::call(const QJSValueList &args) Q_ASSERT(engine); Scope scope(engine); - JSCall jsCall(scope, f, args.length()); + JSCallData jsCall(scope, f, args.length()); jsCall->thisObject = engine->globalObject; for (int i = 0; i < args.size(); ++i) { if (!QJSValuePrivate::checkEngine(engine, args.at(i))) { @@ -713,7 +713,7 @@ QJSValue QJSValue::callWithInstance(const QJSValue &instance, const QJSValueList return QJSValue(); } - JSCall jsCall(scope, f, args.size()); + JSCallData jsCall(scope, f, args.size()); jsCall->thisObject = QJSValuePrivate::convertedToValue(engine, instance); for (int i = 0; i < args.size(); ++i) { if (!QJSValuePrivate::checkEngine(engine, args.at(i))) { @@ -762,7 +762,7 @@ QJSValue QJSValue::callAsConstructor(const QJSValueList &args) Q_ASSERT(engine); Scope scope(engine); - JSCall jsCall(scope, f, args.size()); + JSCallData jsCall(scope, f, args.size()); for (int i = 0; i < args.size(); ++i) { if (!QJSValuePrivate::checkEngine(engine, args.at(i))) { qWarning("QJSValue::callAsConstructor() failed: cannot construct function with argument created in a different engine"); diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp index b86b616178..787194cf86 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()); - JSCall jsCall(scope, setter, 1); + JSCallData jsCall(scope, setter, 1); jsCall->thisObject = this->asReturnedValue(); jsCall->args[0] = desc->value; jsCall.call(); diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp index e5388e714c..ffa19b8964 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(); - JSCall jsCall(scope, constructor, 1); + JSCallData jsCall(scope, constructor, 1); double newLen = qMax(final - first, 0.); jsCall->args[0] = QV4::Encode(newLen); QV4::Scoped<ArrayBuffer> newBuffer(scope, jsCall.callAsConstructor()); diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp index 55b6370b42..1155dc46e5 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); - JSCall jsCall(scope, o, 2); + JSCallData jsCall(scope, o, 2); jsCall->args[0] = v1; jsCall->args[1] = v2; result = jsCall.call(); diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp index 5a68a8cef6..164aa7b5c5 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(); - JSCall jsCall(scope, callback, 3); + JSCallData jsCall(scope, callback, 3); jsCall->thisObject = callData->argument(1); ScopedValue v(scope); @@ -234,7 +234,7 @@ ReturnedValue ArrayPrototype::method_findIndex(const BuiltinFunction *b, CallDat if (!callback) THROW_TYPE_ERROR(); - JSCall jsCall(scope, callback, 3); + JSCallData jsCall(scope, callback, 3); jsCall->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); - JSCall jsCall(scope, callback, 3); + JSCallData jsCall(scope, callback, 3); jsCall->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); - JSCall jsCall(scope, callback, 3); + JSCallData jsCall(scope, callback, 3); jsCall->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); - JSCall jsCall(scope, callback, 3); + JSCallData jsCall(scope, callback, 3); jsCall->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); - JSCall jsCall(scope, callback, 3); + JSCallData jsCall(scope, callback, 3); jsCall->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); - JSCall jsCall(scope, callback, 3); + JSCallData jsCall(scope, callback, 3); jsCall->thisObject = callData->argument(1); uint to = 0; @@ -985,7 +985,7 @@ ReturnedValue ArrayPrototype::method_reduce(const BuiltinFunction *b, CallData * THROW_TYPE_ERROR(); } - JSCall jsCall(scope, callback, 4); + JSCallData jsCall(scope, callback, 4); while (k < len) { bool kPresent; @@ -1038,7 +1038,7 @@ ReturnedValue ArrayPrototype::method_reduceRight(const BuiltinFunction *b, CallD THROW_TYPE_ERROR(); } - JSCall jsCall(scope, callback, 4); + JSCallData jsCall(scope, callback, 4); jsCall->thisObject = Primitive::undefinedValue(); while (k > 0) { diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp index 36ba36f2d3..6c971195f6 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(); - JSCall jsCall(scope, toIso); + JSCallData jsCall(scope, toIso); jsCall->thisObject = callData->thisObject; return jsCall.call(); } diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp index af420471ea..c1724f84ca 100644 --- a/src/qml/jsruntime/qv4errorobject.cpp +++ b/src/qml/jsruntime/qv4errorobject.cpp @@ -241,7 +241,7 @@ ReturnedValue ErrorCtor::construct(const Managed *that, CallData *callData) ReturnedValue ErrorCtor::call(const Managed *that, CallData *callData) { - return static_cast<const Object *>(that)->construct(callData); + return static_cast<const FunctionObject *>(that)->callAsConstructor(callData->args, callData->argc()); } void Heap::EvalErrorCtor::init(QV4::ExecutionContext *scope) diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 2ae2cc57e9..e7bd4f7c06 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -56,6 +56,7 @@ #include <qv4runtimecodegen_p.h> #include "private/qlocale_tools_p.h" #include "private/qqmlbuiltinfunctions_p.h" +#include <private/qv4jscall_p.h> #include <QtCore/QDebug> #include <algorithm> @@ -72,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()); - JSCall callData(scope, f->asReturnedValue(), argv, argc, thisObject); + JSCallData callData(scope, f->asReturnedValue(), argv, argc, thisObject); return f->vtable()->call(f, callData); } ReturnedValue jsConstructWrapper(const QV4::FunctionObject *f, const Value *argv, int argc) { Scope scope(f->engine()); - JSCall callData(scope, f->asReturnedValue(), argv, argc); + JSCallData callData(scope, f->asReturnedValue(), argv, argc); return f->vtable()->construct(f, callData); } @@ -332,7 +333,7 @@ ReturnedValue FunctionPrototype::method_apply(const BuiltinFunction *b, CallData v4->jsStackTop = callData->args; } - return o->call(callData); + return o->call(&callData->thisObject, callData->args, callData->argc()); } ReturnedValue FunctionPrototype::method_call(const BuiltinFunction *b, CallData *callData) @@ -513,7 +514,7 @@ ReturnedValue BoundFunction::call(const Managed *that, CallData *callData) callData->thisObject = f->boundThis(); callData->function = f->target(); - return static_cast<FunctionObject &>(callData->function).call(callData); + return static_cast<FunctionObject &>(callData->function).call(&callData->thisObject, callData->args, callData->argc()); } ReturnedValue BoundFunction::construct(const Managed *that, CallData *callData) @@ -531,5 +532,5 @@ ReturnedValue BoundFunction::construct(const Managed *that, CallData *callData) callData->thisObject = f->boundThis(); callData->function = f->target(); - return static_cast<FunctionObject &>(callData->function).construct(callData); + return static_cast<FunctionObject &>(callData->function).callAsConstructor(callData->args, callData->argc()); } diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index f5354aed08..92ec40fe87 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -155,7 +155,7 @@ struct Q_QML_EXPORT FunctionObject: Object { void init(String *name, bool createProto); - ReturnedValue construct(const Value *argv, int argc) const { + ReturnedValue callAsConstructor(const Value *argv, int argc) const { return d()->jsConstruct(this, argv, argc); } ReturnedValue call(const Value *thisObject, const Value *argv, int argc) const { diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index 668fea25e7..6f74ee4456 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)); - JSCall jsCall(scope, e, 0); + JSCallData jsCall(scope, e, 0); if (directCall) jsCall->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; - JSCall jsCall(scope, nullptr); + JSCallData jsCall(scope, nullptr); jsCall->thisObject = scope.engine->currentStackFrame->thisObject(); jsCall->context = *ctx; return function->call(jsCall); diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp index 8122f61a5e..35a271527a 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::JSCall jsCall(scope, f, 1); + QV4::JSCallData jsCall(scope, f, 1); jsCall->thisObject = v4->globalObject->asReturnedValue(); jsCall->args[0] = status; jsCall.call(); diff --git a/src/qml/jsruntime/qv4jscall_p.h b/src/qml/jsruntime/qv4jscall_p.h index 75f866706b..f356f29ca2 100644 --- a/src/qml/jsruntime/qv4jscall_p.h +++ b/src/qml/jsruntime/qv4jscall_p.h @@ -60,28 +60,28 @@ QT_BEGIN_NAMESPACE namespace QV4 { -struct JSCall { - JSCall(const Scope &scope, std::nullptr_t, int argc = 0) +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); } - JSCall(const Scope &scope, const FunctionObject *function, int argc = 0) + 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; } - JSCall(const Scope &scope, Heap::FunctionObject *function, int argc = 0) + JSCallData(const Scope &scope, Heap::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; } - JSCall(const Scope &scope, Value *argv, int argc, Value *thisObject = 0) + JSCallData(const Scope &scope, Value *argv, int argc, Value *thisObject = 0) { int size = int(offsetof(QV4::CallData, args)/sizeof(QV4::Value)) + argc; ptr = reinterpret_cast<CallData *>(scope.engine->jsStackTop); @@ -93,7 +93,7 @@ struct JSCall { ptr->setArgc(argc); memcpy(ptr->args, argv, argc*sizeof(Value)); } - JSCall(const Scope &scope, ReturnedValue function, const Value *argv, int argc, const Value *thisObject = 0) + 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); @@ -119,7 +119,7 @@ struct JSCall { } ReturnedValue callAsConstructor() const { - return static_cast<FunctionObject &>(ptr->function).construct(ptr->args, ptr->argc()); + return static_cast<FunctionObject &>(ptr->function).callAsConstructor(ptr->args, ptr->argc()); } CallData *ptr; diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index fb1f4abbfc..cd365a1be9 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) { - JSCall jsCall(scope, toJSON, 1); + JSCallData jsCall(scope, toJSON, 1); jsCall->thisObject = value; jsCall->args[0] = v4->newString(key); value = jsCall.call(); @@ -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); - JSCall jsCall(scope, replacerFunction, 2); + JSCallData jsCall(scope, replacerFunction, 2); jsCall->args[0] = v4->newString(key); jsCall->args[1] = value; jsCall->thisObject = holder; diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp index c612e8450c..780885869b 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(); - JSCall jsCall(scope, getter, 0); + JSCallData jsCall(scope, getter, 0); jsCall->thisObject = object; return jsCall.call(); } @@ -422,7 +422,7 @@ ReturnedValue Lookup::getterAccessor1(Lookup *l, ExecutionEngine *engine, const if (!getter) return Encode::undefined(); - JSCall jsCall(scope, getter, 0); + JSCallData jsCall(scope, getter, 0); jsCall->thisObject = object; return jsCall.call(); } @@ -447,7 +447,7 @@ ReturnedValue Lookup::getterAccessor2(Lookup *l, ExecutionEngine *engine, const if (!getter) return Encode::undefined(); - JSCall jsCall(scope, getter, 0); + JSCallData jsCall(scope, getter, 0); jsCall->thisObject = object; return jsCall.call(); } @@ -502,7 +502,7 @@ ReturnedValue Lookup::primitiveGetterAccessor0(Lookup *l, ExecutionEngine *engin if (!getter) return Encode::undefined(); - JSCall jsCall(scope, getter, 0); + JSCallData jsCall(scope, getter, 0); jsCall->thisObject = object; return jsCall.call(); } @@ -522,7 +522,7 @@ ReturnedValue Lookup::primitiveGetterAccessor1(Lookup *l, ExecutionEngine *engin if (!getter) return Encode::undefined(); - JSCall jsCall(scope, getter, 0); + JSCallData jsCall(scope, getter, 0); jsCall->thisObject = object; return jsCall.call(); } @@ -641,7 +641,7 @@ ReturnedValue Lookup::globalGetterAccessor0(Lookup *l, ExecutionEngine *engine) if (!getter) return Encode::undefined(); - JSCall jsCall(scope, getter, 0); + JSCallData jsCall(scope, getter, 0); return jsCall.call(); } l->globalGetter = globalGetterGeneric; @@ -658,7 +658,7 @@ ReturnedValue Lookup::globalGetterAccessor1(Lookup *l, ExecutionEngine *engine) if (!getter) return Encode::undefined(); - JSCall jsCall(scope, getter, 0); + JSCallData jsCall(scope, getter, 0); return jsCall.call(); } l->globalGetter = globalGetterGeneric; @@ -678,7 +678,7 @@ ReturnedValue Lookup::globalGetterAccessor2(Lookup *l, ExecutionEngine *engine) if (!getter) return Encode::undefined(); - JSCall jsCall(scope, getter, 0); + JSCallData jsCall(scope, getter, 0); return jsCall.call(); } } diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index d310c4b114..e22b1dbe51 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()); - JSCall jsCall(scope, f); + JSCallData jsCall(scope, f); jsCall->thisObject = thisObject; return jsCall.call(); } @@ -125,7 +125,7 @@ bool Object::putValue(uint memberIndex, const Value &value) if (set) { Scope scope(ic->engine); ScopedFunctionObject setter(scope, set); - JSCall jsCall(scope, setter, 1); + JSCallData jsCall(scope, setter, 1); jsCall->args[0] = value; jsCall->thisObject = this; jsCall.call(); @@ -764,7 +764,7 @@ bool Object::internalPut(String *name, const Value &value) Scope scope(engine); ScopedFunctionObject setter(scope, *memberIndex); - JSCall jsCall(scope, setter, 1); + JSCallData jsCall(scope, setter, 1); jsCall->args[0] = value; jsCall->thisObject = this; jsCall.call(); @@ -829,7 +829,7 @@ bool Object::internalPutIndexed(uint index, const Value &value) Scope scope(engine); ScopedFunctionObject setter(scope, *arrayIndex); - JSCall jsCall(scope, setter, 1); + JSCallData jsCall(scope, setter, 1); jsCall->args[0] = value; jsCall->thisObject = this; jsCall.call(); diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp index 9010faf0b2..73bcd76edf 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(); - JSCall jsCall(scope, f); + JSCallData jsCall(scope, f); jsCall->thisObject = o; return jsCall.call(); } diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 5bd3bcb439..8ac31cdfd0 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::JSCall jsCall(scope, f, argCount); + QV4::JSCallData jsCall(scope, f, argCount); jsCall->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 c42c018f9d..ae2ee7e3eb 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(); - JSCall jsCall(scope, scope.engine->regExpCtor(), callData->argc()); + JSCallData jsCall(scope, scope.engine->regExpCtor(), callData->argc()); memcpy(jsCall->args, callData->args, callData->argc()*sizeof(Value)); Scoped<RegExpObject> re(scope, jsCall.callAsConstructor()); diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 9077be7bfe..2a046da346 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -428,7 +428,7 @@ ReturnedValue RuntimeHelpers::objectDefaultValue(const Object *object, int typeH Scope scope(engine); ScopedValue conv(scope, object->get(meth1)); - JSCall jsCall(scope, nullptr, 0); + JSCallData jsCall(scope, nullptr, 0); jsCall->thisObject = *object; if (FunctionObject *o = conv->as<FunctionObject>()) { @@ -981,7 +981,7 @@ ReturnedValue Runtime::method_callGlobalLookup(ExecutionEngine *engine, uint ind ReturnedValue Runtime::method_callPossiblyDirectEval(ExecutionEngine *engine, Value *argv, int argc) { Scope scope(engine); - JSCall callData(scope, argv, argc); + JSCallData callData(scope, argv, argc); Q_ASSERT(callData->args + callData->argc() == engine->jsStackTop); ExecutionContext &ctx = static_cast<ExecutionContext &>(engine->currentStackFrame->jsFrame->context); @@ -1008,7 +1008,7 @@ ReturnedValue Runtime::method_callPossiblyDirectEval(ExecutionEngine *engine, Va ReturnedValue Runtime::method_callName(ExecutionEngine *engine, int nameIndex, Value *argv, int argc) { Scope scope(engine); - JSCall callData(scope, argv, argc); + JSCallData callData(scope, argv, argc); Q_ASSERT(callData->args + callData->argc() == engine->jsStackTop); callData->function = engine->currentStackFrame->v4Function->compilationUnit->runtimeStrings[nameIndex]; @@ -1035,7 +1035,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); - JSCall callData(scope, argv, argc, base); + JSCallData callData(scope, argv, argc, base); Q_ASSERT(callData->args + callData->argc() == engine->jsStackTop); if (!callData->thisObject.isObject()) { @@ -1069,7 +1069,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); - JSCall callData(scope, argv, argc, base); + JSCallData callData(scope, argv, argc, base); Q_ASSERT(callData->args + callData->argc() == engine->jsStackTop); Q_ASSERT(engine->jsStackTop >= callData->args + callData->argc()); @@ -1086,7 +1086,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); - JSCall callData(scope, argv, argc, base); + JSCallData callData(scope, argv, argc, base); Q_ASSERT(callData->args + callData->argc() == engine->jsStackTop); callData->thisObject = callData->thisObject.toObject(engine); @@ -1107,7 +1107,7 @@ ReturnedValue Runtime::method_callValue(ExecutionEngine *engine, const Value &fu return engine->throwTypeError(QStringLiteral("%1 is not a function").arg(func.toQStringNoThrow())); Scope scope(engine); - JSCall callData(scope, func.asReturnedValue(), argv, argc); + JSCallData callData(scope, func.asReturnedValue(), argv, argc); Q_ASSERT(callData->args + callData->argc() == engine->jsStackTop); return static_cast<FunctionObject &>(callData->function).call(&callData->thisObject, callData->args, callData->argc()); @@ -1119,7 +1119,7 @@ ReturnedValue Runtime::method_construct(ExecutionEngine *engine, const Value &fu if (!function.isFunctionObject()) return engine->throwTypeError(); - return static_cast<const FunctionObject &>(function).construct(argv, argc); + return static_cast<const FunctionObject &>(function).callAsConstructor(argv, argc); } void Runtime::method_throwException(ExecutionEngine *engine, const Value &value) diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index 9850734aa1..917145c4d2 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::JSCall jsCall(valueScope, nullptr); + QV4::JSCallData jsCall(valueScope, nullptr); jsCall->thisObject = engine->globalObject; jsCall->context = *context; return vmFunction->call(jsCall); } else { Scoped<QmlContext> qml(valueScope, qmlContext.value()); - JSCall jsCall(valueScope, nullptr); + JSCallData jsCall(valueScope, nullptr); jsCall->thisObject = Primitive::undefinedValue(); jsCall->context = *qml; return vmFunction->call(jsCall); diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp index 7373e07340..eb6eabed6d 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(); - JSCall jsCall(scope, compare, 2); + JSCallData jsCall(scope, compare, 2); jsCall->args[0] = convertElementToValue(m_v4, lhs); jsCall->args[1] = convertElementToValue(m_v4, rhs); jsCall->thisObject = m_v4->globalObject; diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index b1ce0b0115..0168e09763 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); - JSCall jsCall(scope, searchCallback, numCaptures + 2); + JSCallData jsCall(scope, searchCallback, numCaptures + 2); jsCall->thisObject = Primitive::undefinedValue(); int lastEnd = 0; for (int i = 0; i < numStringMatches; ++i) { @@ -644,7 +644,7 @@ ReturnedValue StringPrototype::method_search(const BuiltinFunction *b, CallData RegExpObject *regExp = regExpObj->as<RegExpObject>(); if (!regExp) { - JSCall jsCall(scope, scope.engine->regExpCtor(), 1); + JSCallData jsCall(scope, scope.engine->regExpCtor(), 1); jsCall->args[0] = regExpObj; regExpObj = jsCall.callAsConstructor(); if (scope.engine->hasException) diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp index 247e04f5f5..3f147acf4b 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(); - JSCall jsCall(scope, constructor, 3); + JSCallData jsCall(scope, constructor, 3); jsCall->args[0] = buffer; jsCall->args[1] = Encode(a->d()->byteOffset + begin*a->d()->type->bytesPerElement); jsCall->args[2] = Encode(newLen); diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index ba2f37eb2d..d3b9f3886f 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -193,7 +193,7 @@ void QQmlBoundSignalExpression::evaluate(void **a) int *argsTypes = QQmlMetaObject(m_target).methodParameterTypes(methodIndex, &storage, 0); int argCount = argsTypes ? *argsTypes : 0; - QV4::JSCall jsCall(scope, nullptr, argCount); + QV4::JSCallData jsCall(scope, nullptr, argCount); for (int ii = 0; ii < argCount; ++ii) { int type = argsTypes[ii + 1]; //### ideally we would use metaTypeToJS, however it currently gives different results @@ -238,7 +238,7 @@ void QQmlBoundSignalExpression::evaluate(const QList<QVariant> &args) ep->referenceScarceResources(); // "hold" scarce resources in memory during evaluation. - QV4::JSCall jsCall(scope, nullptr, args.count()); + QV4::JSCallData jsCall(scope, nullptr, args.count()); for (int ii = 0; ii < args.count(); ++ii) { jsCall->args[ii] = scope.engine->fromVariant(args[ii]); } diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 945629899c..5611bed2c3 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1547,7 +1547,7 @@ void QV4::QmlIncubatorObject::statusChanged(QQmlIncubator::Status s) QV4::ScopedFunctionObject f(scope, d()->statusChanged); if (f) { - QV4::JSCall jsCall(scope, f, 1); + QV4::JSCallData jsCall(scope, f, 1); jsCall->thisObject = this; jsCall->args[0] = QV4::Primitive::fromUInt32(s); jsCall.call(); diff --git a/src/qml/qml/qqmldelayedcallqueue.cpp b/src/qml/qml/qqmldelayedcallqueue.cpp index 738f87247f..e8e13ee352 100644 --- a/src/qml/qml/qqmldelayedcallqueue.cpp +++ b/src/qml/qml/qqmldelayedcallqueue.cpp @@ -67,7 +67,7 @@ void QQmlDelayedCallQueue::DelayedFunctionCall::execute(QV4::ExecutionEngine *en const QV4::FunctionObject *callback = m_function.as<QV4::FunctionObject>(); Q_ASSERT(callback); const int argCount = array ? array->getLength() : 0; - QV4::JSCall jsCall(scope, callback, argCount); + QV4::JSCallData jsCall(scope, callback, argCount); jsCall->thisObject = QV4::Encode::undefined(); for (int i = 0; i < argCount; i++) { diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index 01ac808b9f..7081342af9 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -185,7 +185,7 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(bool *isUndefined) { QV4::ExecutionEngine *v4 = QV8Engine::getV4(m_context->engine); QV4::Scope scope(v4); - QV4::JSCall jsCall(scope, nullptr); + QV4::JSCallData jsCall(scope, nullptr); return evaluate(jsCall, isUndefined); } diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index bb70d88470..d6f7b18744 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -950,7 +950,7 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void * } const unsigned int parameterCount = function->formalParameterCount(); - QV4::JSCall jsCall(scope, function, parameterCount); + QV4::JSCallData jsCall(scope, function, parameterCount); jsCall->thisObject = ep->v8engine()->global(); for (uint ii = 0; ii < parameterCount; ++ii) diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 98a37ca5ee..b22fe7b5ea 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -1576,7 +1576,7 @@ void QQmlXMLHttpRequest::dispatchCallback(Object *thisObj, QQmlContextData *cont return; } - QV4::JSCall(scope, callback).call(); + QV4::JSCallData(scope, callback).call(); if (scope.engine->hasException) { QQmlError error = scope.engine->catchExceptionAsQmlError(); diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp index c0f49c3885..8cabf062df 100644 --- a/src/qml/types/qquickworkerscript.cpp +++ b/src/qml/types/qquickworkerscript.cpp @@ -248,7 +248,7 @@ void QQuickWorkerScriptEnginePrivate::WorkerEngine::init() QV4::ScopedString name(scope, m_v4Engine->newString(QStringLiteral("sendMessage"))); QV4::ScopedValue function(scope, QV4::BuiltinFunction::create(globalContext, name, QQuickWorkerScriptEnginePrivate::method_sendMessage)); - QV4::JSCall jsCall(scope, createsendconstructor, 1); + QV4::JSCallData jsCall(scope, createsendconstructor, 1); jsCall->args[0] = function; jsCall->thisObject = global(); createsend.set(scope.engine, jsCall.call()); @@ -265,7 +265,7 @@ QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::WorkerEngine::sendFunction(i QV4::ScopedFunctionObject f(scope, createsend.value()); QV4::ScopedValue v(scope); - QV4::JSCall jsCall(scope, f, 1); + QV4::JSCallData jsCall(scope, f, 1); jsCall->args[0] = QV4::Primitive::fromInt32(id); jsCall->thisObject = global(); v = jsCall.call(); @@ -366,7 +366,7 @@ void QQuickWorkerScriptEnginePrivate::processMessage(int id, const QByteArray &d QV4::Scoped<QV4::QmlContext> qmlContext(scope, script->qmlContext.value()); Q_ASSERT(!!qmlContext); - QV4::JSCall jsCall(scope, f, 2); + QV4::JSCallData jsCall(scope, f, 2); jsCall->thisObject = workerEngine->global(); jsCall->args[0] = qmlContext->d()->qml(); // ### jsCall->args[1] = value; diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index 7349f45444..5d5d785f7d 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -729,7 +729,7 @@ void QQuickCanvasItem::updatePolish() QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(qmlEngine(this)); QV4::Scope scope(v4); - QV4::JSCall jsCall(scope, nullptr, 1); + QV4::JSCallData jsCall(scope, nullptr, 1); jsCall->thisObject = QV4::QObjectWrapper::wrap(v4, this); for (auto it = animationCallbacks.cbegin(), end = animationCallbacks.cend(); it != end; ++it) { diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index faab61cd3d..14bf328f5a 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -2349,7 +2349,7 @@ static inline bool evaluate_error(QV8Engine *engine, const QV4::Value &o, const scope.engine->catchException(); return true; } - QV4::JSCall jsCall(scope, function, 1); + QV4::JSCallData jsCall(scope, function, 1); jsCall->args[0] = o; jsCall->thisObject = engine->global(); jsCall.call(); @@ -2379,7 +2379,7 @@ static inline bool evaluate_value(QV8Engine *engine, const QV4::Value &o, return false; QV4::ScopedValue value(scope); - QV4::JSCall jsCall(scope, function, 1); + QV4::JSCallData jsCall(scope, function, 1); jsCall->args[0] = o; jsCall->thisObject = engine->global(); value = jsCall.call(); @@ -2408,7 +2408,7 @@ static inline QV4::ReturnedValue evaluate(QV8Engine *engine, const QV4::Value &o } if (!function) return QV4::Encode::undefined(); - QV4::JSCall jsCall(scope, function, 1); + QV4::JSCallData jsCall(scope, function, 1); jsCall->args[0] = o; jsCall->thisObject = engine->global(); QV4::ScopedValue result(scope, jsCall.call()); |