Bug 155916

Summary: Web Inspector: Improve handling of Bound functions in samples
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: graouts, inspector-bugzilla-changes, saam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
[IMAGE] Call Tree with "bound" clutter none

Description Joseph Pecoraro 2016-03-25 20:26:59 PDT
Created attachment 274968 [details]
[IMAGE] Call Tree with "bound" clutter

* SUMMARY
Improve handling of Bound functions in samples.

Currently bound functions show up in the sample twice. The "[N] bound foo" and its immediate call to "[ƒ] foo". Ending up with:

    [ƒ] doStuff
      [N] bound foo
        [ƒ] foo
          [N] bound foo
            [ƒ] foo

Note we do not show these bound functions in our call stack. If we were paused in the inner foo here we would have a call stack like:

    [ƒ] foo
    [ƒ] foo
    [ƒ] doStuff

So the profile here could be:

    [ƒ] doStuff
      [ƒ] foo
        [ƒ] foo

Or:

    [ƒ] doStuff
      [ƒ] bound foo
        [ƒ] bound foo

Removing a bunch of extra, unnecessary duplication in the call tree.

* TEST
<script>
setInterval(function() { // anonymous
    (function foo() { // bound foo => foo
        var until = Date.now() + 2;
        while (Date.now() <= until);
        console.log(Date.now());
    }).bind(null)()
}, 1000);
</script>
Comment 1 Radar WebKit Bug Importer 2016-03-25 20:28:31 PDT
<rdar://problem/25371989>