RESOLVED FIXED 101331
Web Inspector: Move call stack generation out of bindings.
https://bugs.webkit.org/show_bug.cgi?id=101331
Summary Web Inspector: Move call stack generation out of bindings.
Mike West
Reported 2012-11-06 03:58:32 PST
In the console bindings, we pass in both ScriptArguments and ScriptCallStacks. Pavel noted yesterday that we can do without the latter, as the former contains all the information we need to generate the call stack sometime later on via 'createScriptCallStackForConsole(arguments->globalState())'.
Attachments
WIP: V8 works. (39.68 KB, patch)
2012-11-06 06:23 PST, Mike West
no flags
WIP: Rebased for bots. (41.59 KB, patch)
2012-11-07 04:27 PST, Mike West
no flags
'inspector/console' results. (134.52 KB, application/zip)
2012-11-08 01:25 PST, Mike West
no flags
'http/tests/inspector' results. (147.30 KB, application/zip)
2012-11-08 01:27 PST, Mike West
no flags
Patch (48.11 KB, patch)
2012-11-08 05:05 PST, Mike West
no flags
Rebased. (48.08 KB, patch)
2012-11-08 06:05 PST, Mike West
no flags
Patch for landing. (49.06 KB, patch)
2012-11-15 03:29 PST, Mike West
no flags
GTK. (48.83 KB, patch)
2012-11-15 17:37 PST, Mike West
no flags
Mike West
Comment 1 2012-11-06 06:23:01 PST
Hrm. JSC isn't behaving the way I expected it to. The patch I'll attach in a moment is a WIP that passes inspector tests in chromium-linux, but fails miserably on mac. I'm not sure why, however. It looks like it should work. :)
Mike West
Comment 2 2012-11-06 06:23:13 PST
Created attachment 172570 [details] WIP: V8 works.
Mike West
Comment 3 2012-11-07 04:27:18 PST
Created attachment 172756 [details] WIP: Rebased for bots.
Build Bot
Comment 4 2012-11-07 05:28:54 PST
Comment on attachment 172756 [details] WIP: Rebased for bots. Attachment 172756 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/14747727 New failing tests: http/tests/inspector/network/cached-resource-destroyed-too-big-discarded.html editing/pasteboard/paste-double-nested-blockquote-before-blockquote.html http/tests/inspector/change-iframe-src.html editing/execCommand/outdent-blockquote-test1.html editing/pasteboard/copy-paste-float.html http/tests/inspector/network/har-content.html editing/inserting/insert-br-quoted-007.html http/tests/inspector-enabled/dedicated-workers-list.html http/tests/inspector-enabled/injected-script-discard.html editing/execCommand/outdent-blockquote-test3.html http/tests/cookies/multiple-cookies.html editing/execCommand/indent-pre.html http/tests/inspector/network/async-xhr-json-mime-type.html http/tests/inspector/appcache/appcache-swap.html editing/pasteboard/paste-blockquote-before-blockquote.html http/tests/inspector-enabled/console-clear-arguments-on-frame-navigation.html editing/execCommand/outdent-blockquote-test4.html http/tests/cookies/single-quoted-value.html editing/execCommand/outdent-blockquote-test2.html http/tests/inspector/network/cached-resource-destroyed-moved-to-storage.html http/tests/inspector/extensions-ignore-cache.html http/tests/inspector/console-xhr-logging.html http/tests/inspector/console-xhr-logging-async.html http/tests/inspector-enabled/console-clear-arguments-on-frame-remove.html http/tests/inspector/inspect-iframe-from-different-domain.html http/tests/inspector-enabled/console-log-before-frame-navigation.html accessibility/img-alt-tag-only-whitespace.html http/tests/inspector-enabled/document-write.html http/tests/history/back-during-onload-triggered-by-back.html http/tests/appcache/interrupted-update.html
Yury Semikhatsky
Comment 5 2012-11-08 00:38:41 PST
Comment on attachment 172756 [details] WIP: Rebased for bots. View in context: https://bugs.webkit.org/attachment.cgi?id=172756&action=review > Source/WebCore/inspector/ConsoleMessage.cpp:78 > + ASSERT_NOT_REACHED(); I vaguely recall that there were some cases when the stack was empty but can't remember exact details. > Source/WebCore/page/Console.cpp:309 > + RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(state)); It looks like we can capture only top frame of the call stack here and in Console::profile.
Yury Semikhatsky
Comment 6 2012-11-08 00:49:46 PST
(In reply to comment #1) > Hrm. JSC isn't behaving the way I expected it to. The patch I'll attach in a moment is a WIP that passes inspector tests in chromium-linux, but fails miserably on mac. I'm not sure why, however. It looks like it should work. :) What is the text diff for the failing tests? At first glance there is nothing suspicious about JSC changes. I'm wondering why non-http tests are not failing.
Mike West
Comment 7 2012-11-08 00:52:31 PST
(In reply to comment #6) > (In reply to comment #1) > > Hrm. JSC isn't behaving the way I expected it to. The patch I'll attach in a moment is a WIP that passes inspector tests in chromium-linux, but fails miserably on mac. I'm not sure why, however. It looks like it should work. :) > > What is the text diff for the failing tests? At first glance there is nothing suspicious about JSC changes. I'm wondering why non-http tests are not failing. The actual results are the expected results minus line numbers. That is, instead of "CONSOLE MESSAGE: line 8: [Message goes here]", we get "CONSOLE MESSAGE: [Message goes here]". I'll generate a new result set and upload it in a moment.
Mike West
Comment 8 2012-11-08 01:25:29 PST
Created attachment 172954 [details] 'inspector/console' results. This is what I'm seeing, Yury.
Mike West
Comment 9 2012-11-08 01:27:54 PST
Created attachment 172955 [details] 'http/tests/inspector' results. More of the same, but in HTTP land. :)
Yury Semikhatsky
Comment 10 2012-11-08 02:54:39 PST
Comment on attachment 172756 [details] WIP: Rebased for bots. View in context: https://bugs.webkit.org/attachment.cgi?id=172756&action=review > Source/WebCore/page/Console.cpp:174 > + RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(arguments->globalState())); I guess I figured out what makes the test fail in JSC. You now take globalState() from the arguments which retrieves it from its field of type ScriptStateProtectedPtr. ScriptStateProtectedPtr always returns pointer to the global ExecState (see http://trac.webkit.org/browser/trunk/Source/WebCore/bindings/js/ScriptState.cpp#L55) while here we need current ExecState to collect the stack trace.
Mike West
Comment 11 2012-11-08 03:08:50 PST
(In reply to comment #10) > (From update of attachment 172756 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=172756&action=review > > > Source/WebCore/page/Console.cpp:174 > > + RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(arguments->globalState())); > > I guess I figured out what makes the test fail in JSC. You now take globalState() from the arguments which retrieves it from its field of type ScriptStateProtectedPtr. ScriptStateProtectedPtr always returns pointer to the global ExecState (see http://trac.webkit.org/browser/trunk/Source/WebCore/bindings/js/ScriptState.cpp#L55) while here we need current ExecState to collect the stack trace. Huh. Ok. That's not at all what I expected it to do. I could store the actual script state on the ScriptArguments object and create a 'currentState()' method. Would that be a bad idea for some reason?
Mike West
Comment 12 2012-11-08 03:11:49 PST
(In reply to comment #11) > (In reply to comment #10) > > (From update of attachment 172756 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=172756&action=review > > > > > Source/WebCore/page/Console.cpp:174 > > > + RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(arguments->globalState())); > > > > I guess I figured out what makes the test fail in JSC. You now take globalState() from the arguments which retrieves it from its field of type ScriptStateProtectedPtr. ScriptStateProtectedPtr always returns pointer to the global ExecState (see http://trac.webkit.org/browser/trunk/Source/WebCore/bindings/js/ScriptState.cpp#L55) while here we need current ExecState to collect the stack trace. > > Huh. Ok. That's not at all what I expected it to do. > > I could store the actual script state on the ScriptArguments object and create a 'currentState()' method. Would that be a bad idea for some reason? Or store the current state on the protected pointer and create the method there. Would that be better?
Yury Semikhatsky
Comment 13 2012-11-08 03:25:59 PST
(In reply to comment #11) > (In reply to comment #10) > > (From update of attachment 172756 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=172756&action=review > > > > > Source/WebCore/page/Console.cpp:174 > > > + RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(arguments->globalState())); > > > > I guess I figured out what makes the test fail in JSC. You now take globalState() from the arguments which retrieves it from its field of type ScriptStateProtectedPtr. ScriptStateProtectedPtr always returns pointer to the global ExecState (see http://trac.webkit.org/browser/trunk/Source/WebCore/bindings/js/ScriptState.cpp#L55) while here we need current ExecState to collect the stack trace. > > Huh. Ok. That's not at all what I expected it to do. > > I could store the actual script state on the ScriptArguments object and create a 'currentState()' method. Would that be a bad idea for some reason? ExecState is a kind of current call frame so storing it in ScriptArguments is not a good idea in general as it will become invalid once you leave current JS call frame. You should probably pass it as a parameter to the console.
Mike West
Comment 14 2012-11-08 05:05:10 PST
Mike West
Comment 15 2012-11-08 05:07:41 PST
(In reply to comment #13) > ExecState is a kind of current call frame so storing it in ScriptArguments is not a good idea in general as it will become invalid once you leave current JS call frame. You should probably pass it as a parameter to the console. Yury clarified this for me outside this bug. The original plan of simplifying the interface at the same time we moved the stacktrace generation isn't going to work. :( It's still worthwhile to move the stacktraces out, as this starts us down the road of only generating traces inside Inspector, but it's not as pretty as I'd like. :( WDYT, Yury, Pavel?
Mike West
Comment 16 2012-11-08 06:05:06 PST
Created attachment 173028 [details] Rebased.
kov's GTK+ EWS bot
Comment 17 2012-11-08 12:18:24 PST
Yury Semikhatsky
Comment 18 2012-11-13 01:19:24 PST
Comment on attachment 173028 [details] Rebased. View in context: https://bugs.webkit.org/attachment.cgi?id=173028&action=review > Source/WebCore/bindings/v8/ScriptCallStackFactory.cpp:124 > +PassRefPtr<ScriptCallStack> createScriptCallStack(ScriptState* /* state */, size_t maxStackSize) Remove commented code.
Mike West
Comment 19 2012-11-15 03:29:26 PST
Created attachment 174393 [details] Patch for landing.
kov's GTK+ EWS bot
Comment 20 2012-11-15 10:25:14 PST
Comment on attachment 174393 [details] Patch for landing. Attachment 174393 [details] did not pass gtk-ews (gtk): Output: http://queues.webkit.org/results/14845556
Zan Dobersek
Comment 21 2012-11-15 11:12:19 PST
Comment on attachment 174393 [details] Patch for landing. View in context: https://bugs.webkit.org/attachment.cgi?id=174393&action=review > Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm:225 > + $functionName ne "webkit_dom_console_time_end" && Rather than here, skip the timeEnd function by checking for the name in the signature (plenty of examples below this code).
Mike West
Comment 22 2012-11-15 17:37:50 PST
Mike West
Comment 23 2012-11-15 18:12:28 PST
(In reply to comment #21) > (From update of attachment 174393 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=174393&action=review > > > Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm:225 > > + $functionName ne "webkit_dom_console_time_end" && > > Rather than here, skip the timeEnd function by checking for the name in the signature (plenty of examples below this code). Thank you, that worked brilliantly. :)
WebKit Review Bot
Comment 24 2012-11-15 19:02:29 PST
Comment on attachment 174573 [details] GTK. Attachment 174573 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/14848613 New failing tests: platform/chromium/virtual/threaded/compositing/webgl/webgl-background-color.html
Mike West
Comment 25 2012-11-16 01:52:18 PST
Comment on attachment 174573 [details] GTK. Failure looks clearly unrelated. Trying again. :)
WebKit Review Bot
Comment 26 2012-11-16 04:33:30 PST
Comment on attachment 174573 [details] GTK. Clearing flags on attachment: 174573 Committed r134931: <http://trac.webkit.org/changeset/134931>
WebKit Review Bot
Comment 27 2012-11-16 04:33:35 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.