Bug 150478 - Air should lay out code optimally
Summary: Air should lay out code optimally
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords:
Depends on:
Blocks: 150456
  Show dependency treegraph
 
Reported: 2015-10-22 16:03 PDT by Filip Pizlo
Modified: 2015-11-17 14:30 PST (History)
15 users (show)

See Also:


Attachments
the patch (36.09 KB, patch)
2015-11-17 13:09 PST, Filip Pizlo
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2015-10-22 16:03:39 PDT
Optimal code layout can be achieved by using a pre-order traversal that does not traverse Rare edges but instead saves them in a secondary rare worklist, followed by a second pre-order traversal that starts with that rare worklist and traverses all edges.
Comment 1 Filip Pizlo 2015-11-17 13:09:14 PST
Created attachment 265700 [details]
the patch
Comment 2 WebKit Commit Bot 2015-11-17 13:10:48 PST
Attachment 265700 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/b3/air/AirOptimizeBlockOrder.cpp:58:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Source/JavaScriptCore/b3/air/AirOptimizeBlockOrder.cpp:141:  Should have only a single space after a punctuation in a comment.  [whitespace/comments] [5]
Total errors found: 2 in 15 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Geoffrey Garen 2015-11-17 14:19:01 PST
Comment on attachment 265700 [details]
the patch

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

r=me

> Source/JavaScriptCore/ChangeLog:17
> +        This also adds the requisite branch flipping, so that branches' taken successor is not the

a branch's taken successor

> Source/JavaScriptCore/b3/air/AirBasicBlock.h:54
> +    // You shouldn't call this except when you know what you're doing.

Can you say something more specific here? This comment is true of all functions :).

> Source/JavaScriptCore/b3/air/AirOptimizeBlockOrder.cpp:90
> +        for (FrequentedBlock& successor : block->successors()) {

I think I would like this more if the class were called "BlockWithFrequency". "Frequented blocks" sounds like a block that has a high frequency.

> Source/JavaScriptCore/b3/air/AirOptimizeBlockOrder.cpp:140
> +        // forget about this phase, then at worse your new instructions won't opt into the inversion

at worst
Comment 4 Filip Pizlo 2015-11-17 14:27:28 PST
(In reply to comment #3)
> Comment on attachment 265700 [details]
> the patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=265700&action=review
> 
> r=me
> 
> > Source/JavaScriptCore/ChangeLog:17
> > +        This also adds the requisite branch flipping, so that branches' taken successor is not the
> 
> a branch's taken successor
> 
> > Source/JavaScriptCore/b3/air/AirBasicBlock.h:54
> > +    // You shouldn't call this except when you know what you're doing.
> 
> Can you say something more specific here? This comment is true of all
> functions :).
> 
> > Source/JavaScriptCore/b3/air/AirOptimizeBlockOrder.cpp:90
> > +        for (FrequentedBlock& successor : block->successors()) {
> 
> I think I would like this more if the class were called
> "BlockWithFrequency". "Frequented blocks" sounds like a block that has a
> high frequency.
> 
> > Source/JavaScriptCore/b3/air/AirOptimizeBlockOrder.cpp:140
> > +        // forget about this phase, then at worse your new instructions won't opt into the inversion
> 
> at worst

Fixed everything but the name of FrequentedBlock.  I agree there is probably a better name.  That would be a sizeable patch, so it should probably be done separately.  I'm not sure how urgent that is.
Comment 5 Filip Pizlo 2015-11-17 14:30:13 PST
Landed in http://trac.webkit.org/changeset/192539