diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2016-07-07 15:38:01 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-08-04 14:32:39 +0000 |
commit | 234e762265f0b538e65d610751b8488cb596824d (patch) | |
tree | a89a34a09de8ccc8ec87599257a11ec98da0a841 /src/qml/compiler/qv4compileddata.cpp | |
parent | 01575a22ea2d2e54ef1748733929243ca024234b (diff) |
Use on-disk compilation unit if available
If we succeeded in saving the compilation unit to disk, then attempt to use it
right away. This replaces the C++ heap usage for the compilation unit data as
well as the anonymous allocated executable memory with file-backed mmap'ed
memory. That means the memory can be discarded when overall availability is low
and paged in on-demand.
Change-Id: Ide1b1e11752d861eb049a99a26ca12cec5e2502e
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compileddata.cpp')
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index cb5c14ebc2..98eb7188cc 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -424,6 +424,7 @@ bool CompilationUnit::loadFromDisk(const QUrl &url, EvalISelFactory *iselFactory return false; } + const Unit * const oldDataPtr = (data && !(data->flags & QV4::CompiledData::Unit::StaticData)) ? data : nullptr; QScopedValueRollback<const Unit *> dataPtrChange(data, reinterpret_cast<const Unit *>(cacheData)); { @@ -448,6 +449,7 @@ bool CompilationUnit::loadFromDisk(const QUrl &url, EvalISelFactory *iselFactory return false; dataPtrChange.commit(); + free(const_cast<Unit*>(oldDataPtr)); backingFile.reset(cacheFile.take()); return true; } |