aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4isel_moth.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2016-07-07 15:38:01 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2016-08-04 14:32:39 +0000
commit234e762265f0b538e65d610751b8488cb596824d (patch)
treea89a34a09de8ccc8ec87599257a11ec98da0a841 /src/qml/compiler/qv4isel_moth.cpp
parent01575a22ea2d2e54ef1748733929243ca024234b (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/qv4isel_moth.cpp')
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index 41790c04a9..c9143b6857 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -1665,8 +1665,7 @@ bool CompilationUnit::saveCodeToDisk(QIODevice *device, const CompiledData::Unit
bool CompilationUnit::memoryMapCode(QString *errorString)
{
Q_UNUSED(errorString);
- Q_ASSERT(codeRefs.isEmpty());
- codeRefs.reserve(data->functionTableSize);
+ codeRefs.resize(data->functionTableSize);
const char *basePtr = reinterpret_cast<const char *>(data);
@@ -1680,7 +1679,7 @@ bool CompilationUnit::memoryMapCode(QString *errorString)
#else
QByteArray code = QByteArray::fromRawData(codePtr, compiledFunction->codeSize);
#endif
- codeRefs.append(code);
+ codeRefs[i] = code;
}
return true;