Force V8 debugger load on startup instead of on demand.
authorGlenn Watson <glenn.watson@nokia.com>
Thu, 27 Oct 2011 03:13:23 +0000 (13:13 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 1 Nov 2011 02:58:20 +0000 (03:58 +0100)
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 <aaron.kennedy@nokia.com>

src/declarative/debugger/qv8debugservice.cpp

index 4909152..e36c4bd 100644 (file)
@@ -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) {