Bug 151470 - Web Inspector: Code hotness visualizer: introduce "isScope: true" property
Summary: Web Inspector: Code hotness visualizer: introduce "isScope: true" property
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Local Build
Hardware: All All
: P2 Normal
Assignee: Nikita Vasilyev
URL:
Keywords: InRadar
Depends on:
Blocks: 146115
  Show dependency treegraph
 
Reported: 2015-11-19 18:10 PST by Nikita Vasilyev
Modified: 2016-12-13 15:41 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Vasilyev 2015-11-19 18:10:13 PST
TL;DR
https://github.com/WebKit/webkit/blob/a7970c63ab35ad903f6060e2ba28eaf1bd562801/Source/JavaScriptCore/runtime/ControlFlowProfiler.cpp#L97
Instead emitting "executionCount: 1" for scopes, we should introduce a separate property. We could name it "parsed: true" instead of "executionCount: 1". I'm not sure if "parsed" is technically accurate, so bike-shedding is welcome.

Longer explanation:

var x = 1;
function foo() {
  return 42;
}

Upon reading executing the JS code above, one of the ranges RuntimeAgent.getBasicBlocks would emit be:

{
   startOffset: 0,
   endOffset: // end of the file
   hasExecuted: true,
   executionCount: 1
}

This is a bit misleading, since function foo hasn't been executed.

I suggest to instead emit:

{
   startOffset: 0,
   endOffset: // end of the file
   hasExecuted: true,
   parsed: true
}

Having a different property would allow to style these ranges differently.
Comment 1 Radar WebKit Bug Importer 2015-11-19 18:10:54 PST
<rdar://problem/23623352>
Comment 2 Nikita Vasilyev 2015-12-07 19:37:20 PST
(In reply to comment #0)
> TL;DR
> https://github.com/WebKit/webkit/blob/
> a7970c63ab35ad903f6060e2ba28eaf1bd562801/Source/JavaScriptCore/runtime/
> ControlFlowProfiler.cpp#L97
> Instead emitting "executionCount: 1" for scopes, we should introduce a
> separate property. We could name it "parsed: true" instead of
> "executionCount: 1". I'm not sure if "parsed" is technically accurate, so
> bike-shedding is welcome.

I renamed it from "parsed" to "isScope".