diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2016-04-06 11:23:11 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-05-04 08:31:00 +0000 |
commit | 9a7cf067a178c7a08a7ed9f2c6253e1feade5569 (patch) | |
tree | 2151b6e6e8ce00a76cef15a28c08b99f60fa0bf9 /src/qml/qml/qqmlengine.cpp | |
parent | 6bead0e730ebf89a6c83de9bf03fad5f9aa56fe3 (diff) |
V4: make QQmlEnginePrivate::dereferenceScarceResources inlinable.
Done by giving the "expensive" part its own function, that's even
unlikely to be called anyway.
Change-Id: I35621fb0a764879f9339b9e23f210c66971ff5b7
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/qml/qml/qqmlengine.cpp')
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 55053c8733..4b718e2c95 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -1894,28 +1894,16 @@ void QQmlEnginePrivate::warning(QQmlEnginePrivate *engine, const QList<QQmlError dumpwarning(error); } -/* - This function should be called after evaluation of the js expression is - complete, and so the scarce resources may be freed safely. - */ -void QQmlEnginePrivate::dereferenceScarceResources() -{ - Q_ASSERT(scarceResourcesRefCount > 0); - scarceResourcesRefCount -= 1; - - // if the refcount is zero, then evaluation of the "top level" - // expression must have completed. We can safely release the - // scarce resources. - if (Q_UNLIKELY(scarceResourcesRefCount == 0)) { - // iterate through the list and release them all. - // note that the actual SRD is owned by the JS engine, - // so we cannot delete the SRD; but we can free the - // memory used by the variant in the SRD. - QV4::ExecutionEngine *engine = QV8Engine::getV4(v8engine()); - while (QV4::ExecutionEngine::ScarceResourceData *sr = engine->scarceResources.first()) { - sr->data = QVariant(); - engine->scarceResources.remove(sr); - } +void QQmlEnginePrivate::cleanupScarceResources() +{ + // iterate through the list and release them all. + // note that the actual SRD is owned by the JS engine, + // so we cannot delete the SRD; but we can free the + // memory used by the variant in the SRD. + QV4::ExecutionEngine *engine = QV8Engine::getV4(v8engine()); + while (QV4::ExecutionEngine::ScarceResourceData *sr = engine->scarceResources.first()) { + sr->data = QVariant(); + engine->scarceResources.remove(sr); } } |