diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-10-20 15:26:24 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-11-07 09:00:33 +0000 |
commit | 98271afabd409defee3b1f09158e64fabbc35070 (patch) | |
tree | fe62cfa9c05d86473350766f599ef662bac8b4f7 /src/qml/jsruntime | |
parent | f7cc4b4acd97871f99d146da3bbeed951ff4670c (diff) |
Get rid of JSCallData::callAsConstructor()
Change-Id: I7c7a69791e98ba0ce82b4d23785fc12a510c449e
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r-- | src/qml/jsruntime/qv4arraybuffer.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4jscall_p.h | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4regexpobject.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4stringobject.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4typedarray.cpp | 10 |
5 files changed, 14 insertions, 18 deletions
diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp index ffa19b8964..3bbec7957a 100644 --- a/src/qml/jsruntime/qv4arraybuffer.cpp +++ b/src/qml/jsruntime/qv4arraybuffer.cpp @@ -187,10 +187,10 @@ ReturnedValue ArrayBufferPrototype::method_slice(const BuiltinFunction *b, CallD if (!constructor) return v4->throwTypeError(); - JSCallData jsCall(scope, constructor, 1); + JSCallData jsCallData(scope, constructor, 1); double newLen = qMax(final - first, 0.); - jsCall->args[0] = QV4::Encode(newLen); - QV4::Scoped<ArrayBuffer> newBuffer(scope, jsCall.callAsConstructor()); + jsCallData->args[0] = QV4::Encode(newLen); + QV4::Scoped<ArrayBuffer> newBuffer(scope, constructor->callAsConstructor(jsCallData)); if (!newBuffer || newBuffer->d()->data->size < (int)newLen) return v4->throwTypeError(); diff --git a/src/qml/jsruntime/qv4jscall_p.h b/src/qml/jsruntime/qv4jscall_p.h index 291e108853..a71d14ad6c 100644 --- a/src/qml/jsruntime/qv4jscall_p.h +++ b/src/qml/jsruntime/qv4jscall_p.h @@ -118,10 +118,6 @@ struct JSCallData { return static_cast<FunctionObject &>(ptr->function).call(*this); } - ReturnedValue callAsConstructor() const { - return static_cast<FunctionObject &>(ptr->function).callAsConstructor(*this); - } - CallData *ptr; }; diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index ae2ee7e3eb..556a2a5339 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -436,10 +436,10 @@ ReturnedValue RegExpPrototype::method_compile(const BuiltinFunction *b, CallData if (!r) return scope.engine->throwTypeError(); - JSCallData jsCall(scope, scope.engine->regExpCtor(), callData->argc()); - memcpy(jsCall->args, callData->args, callData->argc()*sizeof(Value)); + JSCallData jsCallData(scope, scope.engine->regExpCtor(), callData->argc()); + memcpy(jsCallData->args, callData->args, callData->argc()*sizeof(Value)); - Scoped<RegExpObject> re(scope, jsCall.callAsConstructor()); + Scoped<RegExpObject> re(scope, scope.engine->regExpCtor()->callAsConstructor(jsCallData)); r->d()->value.set(scope.engine, re->value()); return Encode::undefined(); diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 0168e09763..b7aefd3742 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -644,9 +644,9 @@ ReturnedValue StringPrototype::method_search(const BuiltinFunction *b, CallData RegExpObject *regExp = regExpObj->as<RegExpObject>(); if (!regExp) { - JSCallData jsCall(scope, scope.engine->regExpCtor(), 1); - jsCall->args[0] = regExpObj; - regExpObj = jsCall.callAsConstructor(); + JSCallData jsCallData(scope, scope.engine->regExpCtor(), 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 3f147acf4b..8583d5da06 100644 --- a/src/qml/jsruntime/qv4typedarray.cpp +++ b/src/qml/jsruntime/qv4typedarray.cpp @@ -572,9 +572,9 @@ ReturnedValue TypedArrayPrototype::method_subarray(const BuiltinFunction *builti if (!constructor) return scope.engine->throwTypeError(); - 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); - return jsCall.callAsConstructor(); + JSCallData jsCallData(scope, constructor, 3); + jsCallData->args[0] = buffer; + jsCallData->args[1] = Encode(a->d()->byteOffset + begin*a->d()->type->bytesPerElement); + jsCallData->args[2] = Encode(newLen); + return constructor->callAsConstructor(jsCallData); } |