Bug 61185 - Web Inspector: [Chromium] Searching in a bottom-up view of a large CPU profile overloads system and finally stops execution of any Inspector code
Summary: Web Inspector: [Chromium] Searching in a bottom-up view of a large CPU profil...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Mikhail Naganov
URL: http://v8.googlecode.com/svn/data/ben...
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-20 05:34 PDT by Mikhail Naganov
Modified: 2011-05-20 06:51 PDT (History)
10 users (show)

See Also:


Attachments
patch (6.11 KB, patch)
2011-05-20 06:10 PDT, Mikhail Naganov
yurys: review+
mnaganov: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Naganov 2011-05-20 05:34:19 PDT
From http://code.google.com/p/chromium/issues/detail?id=28864

What steps will reproduce the problem?
1. Gather a CPU profile from V8 benchmarks site.
2. Try to search in bottom-up view.

Search hogs all time of a CPU core and finally stops with no results. 
DevTools stops working after that. Analysis shows that this is due to V8's 
heap got exhausted by trying to build a bottom-up tree from a top down.

This problem originates from the fact that in WebKit Inspector the bottom 
up tree is built dynamically from the top down tree. Thus, to perform a 
search in a bottom up tree, it first needs to be fully built, which can grow 
up V8's heap to its limit. JSC doesn't impose heap size limit, so searching in 
the same tree in WebKit just eats up a enormous amount of memory, but 
finishes happily.

It seems that an approach to maintaining calls tree needs to be reworked in 
WebKit Inspector.
Comment 1 Mikhail Naganov 2011-05-20 06:10:13 PDT
Created attachment 94204 [details]
patch
Comment 2 Yury Semikhatsky 2011-05-20 06:39:47 PDT
Comment on attachment 94204 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=94204&action=review

> Source/WebCore/bindings/js/ScriptProfile.cpp:71
> +    // FIXME: implement building bottom-up profiles in C++ code,

Please file a bug against JSC and put its number next to the FIXME.
Comment 3 Mikhail Naganov 2011-05-20 06:47:39 PDT
Manually committed: http://trac.webkit.org/changeset/86947

2011-05-20  Mikhail Naganov  <mnaganov@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: [Chromium] Use bottom-up CPU profile tree built in VM,
        instead of building it on Inspector's side.
        https://bugs.webkit.org/show_bug.cgi?id=61185

        * bindings/js/ScriptProfile.cpp:
        (WebCore::ScriptProfile::bottomUpHead):
        (WebCore::ScriptProfile::buildInspectorObjectForBottomUpHead):
        * bindings/js/ScriptProfile.h:
        * bindings/v8/ScriptProfile.cpp:
        (WebCore::ScriptProfile::bottomUpHead):
        (WebCore::ScriptProfile::buildInspectorObjectForBottomUpHead):
        * bindings/v8/ScriptProfile.h:
        * inspector/InspectorProfilerAgent.cpp:
        (WebCore::InspectorProfilerAgent::getProfile):
        * inspector/front-end/ProfileView.js:
        (WebInspector.CPUProfileView.prototype.get bottomUpProfileDataGridTree):
Comment 4 Mikhail Naganov 2011-05-20 06:51:39 PDT
(In reply to comment #2)
> (From update of attachment 94204 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=94204&action=review
> 
> > Source/WebCore/bindings/js/ScriptProfile.cpp:71
> > +    // FIXME: implement building bottom-up profiles in C++ code,
> 
> Please file a bug against JSC and put its number next to the FIXME.

Oh, sorry, I've already had an issue created: https://bugs.webkit.org/show_bug.cgi?id=61184
But I forgot to put it into fixme.