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.
Created attachment 265700 [details] the patch
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 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
(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.
Landed in http://trac.webkit.org/changeset/192539