diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-02 14:25:15 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-02 17:27:36 +0200 |
commit | ea0ea907edbe7dd0c65f10752d7df1de6f0fd63b (patch) | |
tree | c9e0641d43cd19dfc3ad022c34e196592e22a6cb /src/qml/jsruntime/qv4engine.cpp | |
parent | 6359ab63cd9c730a168e8b8da4c275e2d03d25d5 (diff) |
Optimize String.replace and RegExp.exec
This speeds up the v8 regexp benchmark by a factor 2.5 :)
Change-Id: Ibd6b18ee28181aa712429cbec4598984e0c69820
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index af87ee2a45..ae444ab938 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -135,6 +135,8 @@ ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory) id_eval = newIdentifier(QStringLiteral("eval")); id_uintMax = newIdentifier(QStringLiteral("4294967295")); id_name = newIdentifier(QStringLiteral("name")); + id_index = newIdentifier(QStringLiteral("index")); + id_input = newIdentifier(QStringLiteral("input")); ObjectPrototype *objectPrototype = new (memoryManager) ObjectPrototype(emptyClass); objectClass = emptyClass->changePrototype(objectPrototype); @@ -171,6 +173,10 @@ ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory) RegExpPrototype *regExpPrototype = new (memoryManager) RegExpPrototype(objectClass); regExpClass = emptyClass->changePrototype(regExpPrototype); + regExpExecArrayClass = arrayClass->addMember(id_index, Attr_Data, &index); + Q_ASSERT(index == RegExpObject::Index_ArrayIndex); + regExpExecArrayClass = regExpExecArrayClass->addMember(id_input, Attr_Data, &index); + Q_ASSERT(index == RegExpObject::Index_ArrayInput); ErrorPrototype *errorPrototype = new (memoryManager) ErrorPrototype(objectClass); errorClass = emptyClass->changePrototype(errorPrototype); @@ -392,6 +398,13 @@ ArrayObject *ExecutionEngine::newArrayObject(const QStringList &list) return object; } +ArrayObject *ExecutionEngine::newArrayObject(InternalClass *ic) +{ + ArrayObject *object = new (memoryManager) ArrayObject(ic); + return object; +} + + DateObject *ExecutionEngine::newDateObject(const Value &value) { DateObject *object = new (memoryManager) DateObject(this, value); @@ -661,6 +674,8 @@ void ExecutionEngine::markObjects() id_eval->mark(); id_uintMax->mark(); id_name->mark(); + id_index->mark(); + id_input->mark(); objectCtor.mark(); stringCtor.mark(); |