diff options
author | Erik Verbruggen <erik.verbruggen@qt.io> | 2018-08-24 15:41:53 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2018-10-04 11:35:54 +0000 |
commit | 1c61e70a0c0f1718c538c04dcc80dd3039ccd384 (patch) | |
tree | 9be7d80be0bb8d00ee6b8f9500c7e4805ef3662e /src/qml/compiler/qv4codegen_p.h | |
parent | b2610d9d04c2a65d60b36ebf43e3a8d469c0397a (diff) |
ES7: Detect Tail Position Calls and pass that to the runtime
Doing the tail call in the runtime will come in a follow-up patch
Change-Id: I8224aac0edbdc765ee9b97703948edd52fd33f3e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen_p.h')
-rw-r--r-- | src/qml/compiler/qv4codegen_p.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h index ae3e074e07..aaf8baef34 100644 --- a/src/qml/compiler/qv4codegen_p.h +++ b/src/qml/compiler/qv4codegen_p.h @@ -733,12 +733,38 @@ protected: bool insideSwitch = false; bool inFormalParameterList = false; bool functionEndsWithReturn = false; + bool _tailCallsAreAllowed = true; + ControlFlow *controlFlow = nullptr; bool _fileNameIsUrl; bool hasError; QList<QQmlJS::DiagnosticMessage> _errors; + class TailCallBlocker + { + public: + TailCallBlocker(Codegen *cg, bool onoff = false) + : _cg(cg) + , _saved(_cg->_tailCallsAreAllowed) + , _onoff(onoff) + { _cg->_tailCallsAreAllowed = onoff; } + + ~TailCallBlocker() + { _cg->_tailCallsAreAllowed = _saved; } + + void unblock() const + { _cg->_tailCallsAreAllowed = _saved; } + + void reblock() const + { _cg->_tailCallsAreAllowed = _onoff; } + + private: + Codegen *_cg; + bool _saved; + bool _onoff; + }; + private: VolatileMemoryLocations scanVolatileMemoryLocations(AST::Node *ast) const; void handleConstruct(const Reference &base, AST::ArgumentList *args); |