diff options
author | Simon Hausmann <[email protected]> | 2013-08-16 16:40:21 +0200 |
---|---|---|
committer | Lars Knoll <[email protected]> | 2013-08-16 19:15:30 +0200 |
commit | fb3d8993e83a3a35d4406d46fd5f918555a6947b (patch) | |
tree | fc284c32f85444adca5cfda3fe17f3208826808e /src/qml | |
parent | 5ef4dd00f93d12a59cb01fa6ff44e2f01e3f71a1 (diff) |
Get rid of QV4::Function::generatedValues by porting moths' regexps to runtime expressions
Change-Id: Iaae3c4855016948952159596d2528fca73341b72
Reviewed-by: Lars Knoll <[email protected]>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/compiler/qv4instr_moth_p.h | 7 | ||||
-rw-r--r-- | src/qml/compiler/qv4isel_moth.cpp | 9 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4function.cpp | 3 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4function_p.h | 1 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4vme_moth.cpp | 5 |
5 files changed, 14 insertions, 11 deletions
diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h index 6e167e267b..642e6f4849 100644 --- a/src/qml/compiler/qv4instr_moth_p.h +++ b/src/qml/compiler/qv4instr_moth_p.h @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE F(Ret, ret) \ F(LoadValue, loadValue) \ F(LoadString, loadString) \ + F(LoadRegExp, loadRegExp) \ F(LoadClosure, loadClosure) \ F(MoveTemp, moveTemp) \ F(LoadName, loadName) \ @@ -224,6 +225,11 @@ union Instr int stringId; Param result; }; + struct instr_loadRegExp { + MOTH_INSTR_HEADER + int regExpId; + Param result; + }; struct instr_moveTemp { MOTH_INSTR_HEADER Param source; @@ -544,6 +550,7 @@ union Instr instr_ret ret; instr_loadValue loadValue; instr_loadString loadString; + instr_loadRegExp loadRegExp; instr_moveTemp moveTemp; instr_loadClosure loadClosure; instr_loadName loadName; diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp index 7325ef020c..fb4c780c6b 100644 --- a/src/qml/compiler/qv4isel_moth.cpp +++ b/src/qml/compiler/qv4isel_moth.cpp @@ -408,13 +408,8 @@ void InstructionSelection::loadString(const QString &str, V4IR::Temp *targetTemp void InstructionSelection::loadRegexp(V4IR::RegExp *sourceRegexp, V4IR::Temp *targetTemp) { - QV4::Value v = QV4::Value::fromObject(engine()->newRegExpObject( - *sourceRegexp->value, - sourceRegexp->flags)); - _vmFunction->generatedValues.append(v); - - Instruction::LoadValue load; - load.value = Instr::Param::createValue(v); + Instruction::LoadRegExp load; + load.regExpId = jsUnitGenerator.registerRegExp(sourceRegexp); load.result = getResultParam(targetTemp); addInstruction(load); } diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp index 3f7be84057..32fd9c3946 100644 --- a/src/qml/jsruntime/qv4function.cpp +++ b/src/qml/jsruntime/qv4function.cpp @@ -94,9 +94,6 @@ void Function::mark() formals.at(i)->mark(); for (int i = 0; i < locals.size(); ++i) locals.at(i)->mark(); - for (int i = 0; i < generatedValues.size(); ++i) - if (Managed *m = generatedValues.at(i).asManaged()) - m->mark(); } namespace QV4 { diff --git a/src/qml/jsruntime/qv4function_p.h b/src/qml/jsruntime/qv4function_p.h index 948729e933..4263e3964c 100644 --- a/src/qml/jsruntime/qv4function_p.h +++ b/src/qml/jsruntime/qv4function_p.h @@ -98,7 +98,6 @@ struct Function { QVector<String *> formals; QVector<String *> locals; - QVector<Value> generatedValues; QVector<Function *> nestedFunctions; QVector<LineNumberMapping> lineNumberMappings; diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index 746a7be722..133d72db22 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -265,6 +265,11 @@ QV4::Value VME::run(QV4::ExecutionContext *context, const uchar *&code, VALUE(instr.result) = QV4::Value::fromString(runtimeStrings[instr.stringId]); MOTH_END_INSTR(LoadString) + MOTH_BEGIN_INSTR(LoadRegExp) +// TRACE(value, "%s", instr.value.toString(context)->toQString().toUtf8().constData()); + VALUE(instr.result) = context->runtimeFunction()->compilationUnit->runtimeRegularExpressions[instr.regExpId]; + MOTH_END_INSTR(LoadRegExp) + MOTH_BEGIN_INSTR(LoadClosure) __qmljs_init_closure(context, VALUEPTR(instr.result), instr.value); MOTH_END_INSTR(LoadClosure) |