diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-06-30 19:19:18 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-07-03 08:09:05 +0000 |
commit | 6d8dbba4624c8a453ba13ff009f011f2946422bb (patch) | |
tree | ec1aec45c122a31d7e5c1c19daa9ba5d4f824355 /src/qml/jsruntime/qv4stackframe_p.h | |
parent | deaa99f66ddedc2ea79e6902c665925b04665e68 (diff) |
Add support for super calls
Implement super call support for class constructor
functions.
Change-Id: I3c64276234689cf4f644b095e0fc8ca1c634ac53
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4stackframe_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4stackframe_p.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4stackframe_p.h b/src/qml/jsruntime/qv4stackframe_p.h index 68301eb097..4966a5637d 100644 --- a/src/qml/jsruntime/qv4stackframe_p.h +++ b/src/qml/jsruntime/qv4stackframe_p.h @@ -129,6 +129,9 @@ struct Q_QML_EXPORT CppStackFrame { } #ifndef V4_BOOTSTRAP + static uint requiredJSStackFrameSize(uint nRegisters) { + return CallData::HeaderSize() + nRegisters; + } static uint requiredJSStackFrameSize(Function *v4Function) { return CallData::HeaderSize() + v4Function->compiledFunction->nRegisters; } @@ -136,7 +139,12 @@ struct Q_QML_EXPORT CppStackFrame { return requiredJSStackFrameSize(v4Function); } void setupJSFrame(Value *stackSpace, const Value &function, const Heap::ExecutionContext *scope, - const Value &thisObject, const Value &newTarget = Primitive::undefinedValue()) + const Value &thisObject, const Value &newTarget = Primitive::undefinedValue()) { + setupJSFrame(stackSpace, function, scope, thisObject, newTarget, + v4Function->nFormals, v4Function->compiledFunction->nRegisters); + } + void setupJSFrame(Value *stackSpace, const Value &function, const Heap::ExecutionContext *scope, + const Value &thisObject, const Value &newTarget, uint nFormals, uint nRegisters) { jsFrame = reinterpret_cast<CallData *>(stackSpace); jsFrame->function = function; @@ -146,12 +154,12 @@ struct Q_QML_EXPORT CppStackFrame { jsFrame->newTarget = newTarget; uint argc = uint(originalArgumentsCount); - if (argc > v4Function->nFormals) - argc = v4Function->nFormals; + if (argc > nFormals) + argc = nFormals; jsFrame->setArgc(argc); memcpy(jsFrame->args, originalArguments, argc*sizeof(Value)); - const Value *end = jsFrame->args + v4Function->compiledFunction->nRegisters; + const Value *end = jsFrame->args + nRegisters; for (Value *v = jsFrame->args + argc; v < end; ++v) *v = Encode::undefined(); } |