From: Simon Hausmann Date: Fri, 24 Jan 2014 15:37:45 +0000 (+0100) Subject: Merge remote-tracking branch 'origin/stable' into dev X-Git-Tag: upstream/5.2.90+alpha~340^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=22041acdfe85c9a9b814e11cd86e8ee5a55be82d;p=platform%2Fupstream%2Fqtdeclarative.git Merge remote-tracking branch 'origin/stable' into dev Conflicts: src/imports/dialogs/qquickmessagedialog.cpp src/imports/dialogs/qquickmessagedialog_p.h src/qml/debugger/qqmlprofilerservice_p.h src/qml/jsruntime/qv4regexpobject.cpp tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro Change-Id: Ic8a43366b44d6970966acbf03b206d0dee00c28d --- 22041acdfe85c9a9b814e11cd86e8ee5a55be82d diff --cc src/qml/debugger/qqmlprofilerservice_p.h index 6d7c0dc,32b88e3..c3329db --- a/src/qml/debugger/qqmlprofilerservice_p.h +++ b/src/qml/debugger/qqmlprofilerservice_p.h @@@ -55,8 -55,7 +55,9 @@@ #include #include +// this contains QUnifiedTimer +#include + #include #include #include @@@ -401,8 -254,22 +402,20 @@@ struct QQmlBindingProfiler struct QQmlHandlingSignalProfiler { QQmlHandlingSignalProfiler(QQmlBoundSignalExpression *expression) { - Q_QML_PROFILE(startHandlingSignal(expression->sourceFile(), expression->lineNumber(), - expression->columnNumber())); + if (QQmlProfilerService::enabled) { - QQmlProfilerService *service = QQmlProfilerService::instance; - service->startRange(QQmlProfilerService::HandlingSignal); + if (expression->sourceFile().isEmpty()) { + QV4::Function *function = expression->function(); + if (function) { - service->rangeLocation(QQmlProfilerService::HandlingSignal, ++ Q_QML_PROFILE(startHandlingSignal( + function->sourceFile(), function->compiledFunction->location.line, - function->compiledFunction->location.column); ++ function->compiledFunction->location.column)); + } + } else { - service->rangeLocation(QQmlProfilerService::HandlingSignal, ++ Q_QML_PROFILE(startHandlingSignal( + expression->sourceFile(), expression->lineNumber(), - expression->columnNumber()); ++ expression->columnNumber())); + } + } } ~QQmlHandlingSignalProfiler() diff --cc src/qml/jsruntime/qv4regexpobject.cpp index aafecb5,0ebad2f..95b6569 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@@ -236,7 -237,16 +236,16 @@@ DEFINE_OBJECT_VTABLE(RegExpCtor) RegExpCtor::RegExpCtor(ExecutionContext *scope) : FunctionObject(scope, QStringLiteral("RegExp")) { - setVTable(&static_vtbl); + setVTable(staticVTable()); + clearLastMatch(); + } + + void RegExpCtor::clearLastMatch() + { + lastMatch = Primitive::nullValue(); + lastInput = engine()->newIdentifier(QString()); + lastMatchStart = 0; + lastMatchEnd = 0; } ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData) @@@ -347,11 -390,10 +390,10 @@@ ReturnedValue RegExpPrototype::method_e for (int i = 0; i < len; ++i) { int start = matchOffsets[i * 2]; int end = matchOffsets[i * 2 + 1]; - array->arrayData[i].value = (start != -1 && end != -1) ? ctx->engine->newString(s.mid(start, end - start))->asReturnedValue() : Encode::undefined(); - array->arrayDataLen = i + 1; + v = (start != -1 && end != -1) ? ctx->engine->newString(s.mid(start, end - start))->asReturnedValue() : Encode::undefined(); + array->arrayData->put(i, v); } array->setArrayLengthUnchecked(len); - array->memberData[Index_ArrayIndex].value = Primitive::fromInt32(result); array->memberData[Index_ArrayInput].value = arg.asReturnedValue(); @@@ -395,4 -442,46 +442,46 @@@ ReturnedValue RegExpPrototype::method_c return Encode::undefined(); } + template + ReturnedValue RegExpPrototype::method_get_lastMatch_n(CallContext *ctx) + { + Scope scope(ctx); + ScopedArrayObject lastMatch(scope, static_cast(ctx->engine->regExpCtor.objectValue())->lastMatch); + ScopedValue result(scope, lastMatch ? lastMatch->getIndexed(index) : Encode::undefined()); + if (result->isUndefined()) + return ctx->engine->newString(QString())->asReturnedValue(); + return result.asReturnedValue(); + } + + ReturnedValue RegExpPrototype::method_get_lastParen(CallContext *ctx) + { + Scope scope(ctx); + ScopedArrayObject lastMatch(scope, static_cast(ctx->engine->regExpCtor.objectValue())->lastMatch); - ScopedValue result(scope, lastMatch ? lastMatch->getIndexed(lastMatch->arrayLength() - 1) : Encode::undefined()); ++ ScopedValue result(scope, lastMatch ? lastMatch->getIndexed(lastMatch->getLength() - 1) : Encode::undefined()); + if (result->isUndefined()) + return ctx->engine->newString(QString())->asReturnedValue(); + return result.asReturnedValue(); + } + + ReturnedValue RegExpPrototype::method_get_input(CallContext *ctx) + { + return static_cast(ctx->engine->regExpCtor.objectValue())->lastInput.asReturnedValue(); + } + + ReturnedValue RegExpPrototype::method_get_leftContext(CallContext *ctx) + { + Scope scope(ctx); + Scoped regExpCtor(scope, ctx->engine->regExpCtor); + QString lastInput = regExpCtor->lastInput->toQString(); + return ctx->engine->newString(lastInput.left(regExpCtor->lastMatchStart))->asReturnedValue(); + } + + ReturnedValue RegExpPrototype::method_get_rightContext(CallContext *ctx) + { + Scope scope(ctx); + Scoped regExpCtor(scope, ctx->engine->regExpCtor); + QString lastInput = regExpCtor->lastInput->toQString(); + return ctx->engine->newString(lastInput.mid(regExpCtor->lastMatchEnd))->asReturnedValue(); + } + QT_END_NAMESPACE diff --cc src/qml/jsruntime/qv4regexpobject_p.h index d306efb,f112ad8..a4cb4b9 --- a/src/qml/jsruntime/qv4regexpobject_p.h +++ b/src/qml/jsruntime/qv4regexpobject_p.h @@@ -104,11 -103,18 +104,18 @@@ protected struct RegExpCtor: FunctionObject { - Q_MANAGED + V4_OBJECT RegExpCtor(ExecutionContext *scope); + SafeValue lastMatch; + SafeString lastInput; + int lastMatchStart; + int lastMatchEnd; + void clearLastMatch(); + static ReturnedValue construct(Managed *m, CallData *callData); static ReturnedValue call(Managed *that, CallData *callData); + static void markObjects(Managed *that, ExecutionEngine *e); }; struct RegExpPrototype: RegExpObject diff --cc tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro index 87d8b64,d08ed31..647d761 --- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro +++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro @@@ -16,7 -16,4 +16,8 @@@ DEFINES += QT_DISABLE_DEPRECATED_BEFORE OTHER_FILES += \ data/pixmapCacheTest.qml \ data/controlFromJS.qml \ + data/test.qml \ + data/exit.qml \ + data/scenegraphTest.qml \ - data/TestImage_2x2.png ++ data/TestImage_2x2.png \ + data/signalSourceLocation.qml