From 9162f48ddb1a4f280b17bf40c32068dcc6f4dd89 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Sun, 3 Feb 2013 12:19:15 +0100 Subject: [PATCH] MOTH: have the VM::Function hold on to regexps. When regexps were created, they were not added to the VM::Function's generatedValues, resulting in premature collection. Change-Id: Idac2202e3040c6311c6f1ceead641e51a8de9729 Reviewed-by: Lars Knoll --- src/v4/moth/qv4isel_moth.cpp | 10 ++++++---- src/v4/moth/qv4vme_moth.cpp | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/v4/moth/qv4isel_moth.cpp b/src/v4/moth/qv4isel_moth.cpp index f3c5b6b..f31153a 100644 --- a/src/v4/moth/qv4isel_moth.cpp +++ b/src/v4/moth/qv4isel_moth.cpp @@ -400,11 +400,13 @@ void InstructionSelection::loadString(const QString &str, IR::Temp *targetTemp) void InstructionSelection::loadRegexp(IR::RegExp *sourceRegexp, IR::Temp *targetTemp) { + VM::Value v = VM::Value::fromObject(engine()->newRegExpObject( + *sourceRegexp->value, + sourceRegexp->flags)); + _vmFunction->generatedValues.append(v); + Instruction::LoadValue load; - load.value = Instr::Param::createValue( - VM::Value::fromObject(engine()->newRegExpObject( - *sourceRegexp->value, - sourceRegexp->flags))); + load.value = Instr::Param::createValue(v); load.result = getResultParam(targetTemp); addInstruction(load); } diff --git a/src/v4/moth/qv4vme_moth.cpp b/src/v4/moth/qv4vme_moth.cpp index a3ab1de..e9889fc 100644 --- a/src/v4/moth/qv4vme_moth.cpp +++ b/src/v4/moth/qv4vme_moth.cpp @@ -225,7 +225,7 @@ VM::Value VME::operator()(QQmlJS::VM::ExecutionContext *context, const uchar *co MOTH_END_INSTR(CallValue) MOTH_BEGIN_INSTR(CallProperty) - TRACE(property name, "%s", qPrintable(instr.name->toQString())); + TRACE(property name, "%s, args=%u, argc=%u", qPrintable(instr.name->toQString()), instr.args, instr.argc); Q_ASSERT(instr.args + instr.argc < stackSize); VM::Value *args = stack + instr.args; VALUE(instr.result) = __qmljs_call_property(context, VALUE(instr.base), instr.name, args, instr.argc); -- 2.7.4