Bug 85144

Summary: Bytecompiler should emit trivially fewer jumps in loops
Product: WebKit Reporter: Filip Pizlo <fpizlo>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: dglazkov, ggaren, mjs, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
the patch
oliver: review+, webkit.review.bot: commit-queue-
Archive of layout-test-results from ec2-cr-linux-03 none

Filip Pizlo
Reported 2012-04-28 15:58:55 PDT
Currently for a loop like: while (foo) bar; We emit code like: jmp continueTarget topOfLoop: <code for bar> continueTarget: <code for foo> breakTarget: But it would be more efficient in almost all cases to instead emit: <code for foo> <code for bar> continueTarget: <code for foo> breakTarget: This will lead to more bytecode, and will otherwise be natural for LLInt and Baseline. But for DFG, it's a hearty win since it reduces the number of basic blocks and makes the data flow relationships between foo and bar more obvious.
Attachments
the patch (2.85 KB, patch)
2012-04-28 16:02 PDT, Filip Pizlo
oliver: review+
webkit.review.bot: commit-queue-
Archive of layout-test-results from ec2-cr-linux-03 (6.26 MB, application/zip)
2012-04-28 16:48 PDT, WebKit Review Bot
no flags
Filip Pizlo
Comment 1 2012-04-28 16:02:22 PDT
Created attachment 139375 [details] the patch
Maciej Stachowiak
Comment 2 2012-04-28 16:11:41 PDT
As a comment unrelated to this patch, it would be nice to have a fallback for emitNodeInConditionContext that knows how to generate regular code plus the branch for nodes without a specialized emitNodeInConditionContext - it's lame to have to do the fallback at every call site.
WebKit Review Bot
Comment 3 2012-04-28 16:48:43 PDT
Comment on attachment 139375 [details] the patch Attachment 139375 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/12556753 New failing tests: fast/filesystem/workers/file-writer-sync-truncate-extend.html
WebKit Review Bot
Comment 4 2012-04-28 16:48:49 PDT
Created attachment 139377 [details] Archive of layout-test-results from ec2-cr-linux-03 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-03 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Filip Pizlo
Comment 5 2012-04-28 16:53:26 PDT
Geoffrey Garen
Comment 6 2012-04-28 17:49:13 PDT
I believe that ForInNode would also benefit from this optimization.
Filip Pizlo
Comment 7 2012-05-20 03:00:10 PDT
Note You need to log in before you can comment on or make changes to this bug.