From 64b8ce5f60d0595fcc511ca860066f2d946db8f3 Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Thu, 27 Oct 2011 13:13:23 +1000 Subject: [PATCH] Force V8 debugger load on startup instead of on demand. The V8 debugger code can take several hundred milliseconds to start. This is by default loaded and unloaded on demand, for example whenever a script is compiled. This has a significant effect on the timing reported by the QML profiler in Qt Creator. This change forces the debugger context to be loaded when the v8 context is created, so that this cost is paid once on startup and no longer affects the QML profiling times. Task-number: QTBUG-22170 Change-Id: I5533b53908b3c53e18b0eb870ed6166d109429df Reviewed-by: Aaron Kennedy --- src/declarative/debugger/qv8debugservice.cpp | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/declarative/debugger/qv8debugservice.cpp b/src/declarative/debugger/qv8debugservice.cpp index 4909152..e36c4bd 100644 --- a/src/declarative/debugger/qv8debugservice.cpp +++ b/src/declarative/debugger/qv8debugservice.cpp @@ -124,6 +124,13 @@ QV8DebugService::QV8DebugService(QObject *parent) { Q_D(QV8DebugService); v8::Debug::SetMessageHandler2(DebugMessageHandler); + + // This call forces the debugger context to be loaded and made resident. + // Without this the debugger is loaded/unloaded whenever required, which + // has a very significant effect on the timing reported in the QML + // profiler in Qt Creator. + v8::Debug::GetDebugContext(); + if (status() == Enabled) { // ,block mode, client attached while (!d->initialized) { -- 1.7.2.5