diff options
| author | Lars Knoll <lars.knoll@qt.io> | 2017-02-15 15:40:27 +0100 |
|---|---|---|
| committer | Lars Knoll <lars.knoll@qt.io> | 2017-03-09 08:59:23 +0000 |
| commit | e772081db104e09e95ed09e8d1f0076e07fc53f6 (patch) | |
| tree | 1261b71d754b8de8520335ee545707e6d64b544e /src/qml/compiler/qv4compileddata.cpp | |
| parent | 2a554434a571dcefd26cf10ef8c5ae8b3b7d66db (diff) | |
Incremental garbage collection
Add an incremental mode to the garbage collector, that will
get used for many collections. This should significantly
reduce average stop times for GC.
Make sure that manual calls to gc() still do a full collection,
to ensure consistency and keep tests that rely on gc() working.
Change-Id: I87b13529377b7639ce993dbd99e85ff0a555acd8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compileddata.cpp')
| -rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index c25a139379..d0dfb81f80 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -132,8 +132,10 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) runtimeStrings = (QV4::Heap::String **)malloc(data->stringTableSize * sizeof(QV4::Heap::String*)); // memset the strings to 0 in case a GC run happens while we're within the loop below memset(runtimeStrings, 0, data->stringTableSize * sizeof(QV4::Heap::String*)); - for (uint i = 0; i < data->stringTableSize; ++i) + for (uint i = 0; i < data->stringTableSize; ++i) { runtimeStrings[i] = engine->newIdentifier(data->stringAt(i)); + runtimeStrings[i]->setMarkBit(); + } runtimeRegularExpressions = new QV4::Value[data->regexpTableSize]; // memset the regexps to 0 in case a GC run happens while we're within the loop below @@ -147,7 +149,14 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) flags |= IR::RegExp::RegExp_IgnoreCase; if (re->flags & CompiledData::RegExp::RegExp_Multiline) flags |= IR::RegExp::RegExp_Multiline; - runtimeRegularExpressions[i] = engine->newRegExpObject(data->stringAt(re->stringIndex), flags); + QV4::Heap::RegExpObject *ro = engine->newRegExpObject(data->stringAt(re->stringIndex), flags); + runtimeRegularExpressions[i] = ro; +#if WRITEBARRIER(steele) + if (engine->memoryManager->nextGCIsIncremental) { + ro->setMarkBit(); + ro->setGrayBit(); + } +#endif } if (data->lookupTableSize) { |
