aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-03-17 12:45:41 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-18 09:05:57 +0100
commitc3fbec3ab955eb2b771a6a54d2910d25a1c7277c (patch)
treebdbf3537617da5761bef9e6dbf829a212e780ec8 /src/qml/jsruntime
parent09f3cfee8d5e34b5f7058586c52c3fc36d295d93 (diff)
Small optimization to RegExp
Also add markObjects() calls to all the identifiers we keep around in the engine. It's probably pure luck this hasn't caused any issues until now. Change-Id: Ie31d19793efa53867e4e240ba548070dcde32ec1 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp12
-rw-r--r--src/qml/jsruntime/qv4engine_p.h1
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp2
3 files changed, 14 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 5c7caca477..1ffb3344bc 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -219,6 +219,7 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
stringClass = InternalClass::create(this, String::staticVTable(), 0);
regExpValueClass = InternalClass::create(this, RegExp::staticVTable(), 0);
+ id_empty = newIdentifier(QString());
id_undefined = newIdentifier(QStringLiteral("undefined"));
id_null = newIdentifier(QStringLiteral("null"));
id_true = newIdentifier(QStringLiteral("true"));
@@ -830,11 +831,22 @@ void ExecutionEngine::markObjects()
c = c->parent;
}
+ id_empty->mark(this);
+ id_undefined->mark(this);
+ id_null->mark(this);
+ id_true->mark(this);
+ id_false->mark(this);
+ id_boolean->mark(this);
+ id_number->mark(this);
+ id_string->mark(this);
+ id_object->mark(this);
+ id_function->mark(this);
id_length->mark(this);
id_prototype->mark(this);
id_constructor->mark(this);
id_arguments->mark(this);
id_caller->mark(this);
+ id_callee->mark(this);
id_this->mark(this);
id___proto__->mark(this);
id_enumerable->mark(this);
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index 6bfdf1f5a1..6ad822d3b4 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -234,6 +234,7 @@ public:
Property *argumentsAccessors;
int nArgumentsAccessors;
+ StringValue id_empty;
StringValue id_undefined;
StringValue id_null;
StringValue id_true;
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index daf85c0f7d..956d1c594e 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -243,7 +243,7 @@ RegExpCtor::RegExpCtor(ExecutionContext *scope)
void RegExpCtor::clearLastMatch()
{
lastMatch = Primitive::nullValue();
- lastInput = engine()->newIdentifier(QString());
+ lastInput = engine()->id_empty;
lastMatchStart = 0;
lastMatchEnd = 0;
}