diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-08-15 15:54:36 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2013-08-16 10:14:13 +0200 |
commit | b88626a3a59f7dcd01be6fe2a8236b14ca1176f5 (patch) | |
tree | f3a1f6db220f2d6a7d71f2ddc7b466e205658f40 /src/qml/compiler/qv4compileddata.cpp | |
parent | 214680abec598bc01c4f90b3cecc60c7968c0c41 (diff) |
Ported regular expressions over to be run-time generated data
Change-Id: I04e693d4923c97c3d869a5beb17011f6aad85f03
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler/qv4compileddata.cpp')
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index 38461af88c..08c4d80b4e 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -44,6 +44,7 @@ #include <private/qv4engine_p.h> #include <private/qv4function_p.h> #include <private/qv4lookup_p.h> +#include <private/qv4regexpobject_p.h> namespace QV4 { @@ -60,6 +61,7 @@ CompilationUnit::~CompilationUnit() free(data); free(runtimeStrings); delete [] runtimeLookups; + delete [] runtimeRegularExpressions; } QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) @@ -73,6 +75,20 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) for (int i = 0; i < data->stringTableSize; ++i) runtimeStrings[i] = engine->newIdentifier(data->stringAt(i)->qString()); + runtimeRegularExpressions = new QV4::Value[data->regexpTableSize]; + for (int i = 0; i < data->regexpTableSize; ++i) { + const CompiledData::RegExp *re = data->regexpAt(i); + int flags = 0; + if (re->flags & CompiledData::RegExp::RegExp_Global) + flags |= QQmlJS::V4IR::RegExp::RegExp_Global; + if (re->flags & CompiledData::RegExp::RegExp_IgnoreCase) + flags |= QQmlJS::V4IR::RegExp::RegExp_IgnoreCase; + if (re->flags & CompiledData::RegExp::RegExp_Multiline) + flags |= QQmlJS::V4IR::RegExp::RegExp_Multiline; + QV4::RegExpObject *obj = engine->newRegExpObject(data->stringAt(re->stringIndex)->qString(), flags); + runtimeRegularExpressions[i] = QV4::Value::fromObject(obj); + } + if (data->lookupTableSize) { runtimeLookups = new QV4::Lookup[data->lookupTableSize]; const CompiledData::Lookup *compiledLookups = data->lookupTable(); @@ -101,6 +117,8 @@ void CompilationUnit::markObjects() { for (int i = 0; i < data->stringTableSize; ++i) runtimeStrings[i]->mark(); + for (int i = 0; i < data->regexpTableSize; ++i) + runtimeRegularExpressions[i].mark(); } } |