Bug 96891

Summary: Array profiling has convergence issues
Product: WebKit Reporter: Filip Pizlo <fpizlo>
Component: JavaScriptCoreAssignee: Filip Pizlo <fpizlo>
Status: RESOLVED FIXED    
Severity: Normal CC: barraclough, benjamin, fpizlo, ggaren, mhahnenberg, msaboff, oliver, ossy, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 96968    
Bug Blocks:    
Attachments:
Description Flags
the patch
buildbot: commit-queue-
the patch barraclough: review+

Description Filip Pizlo 2012-09-16 17:19:45 PDT
Consider the following code:

function foo() {
    var o = {};
    o.length = 5;
    for (var i = 0; i < o.length; ++i)
        o[i] = i;
}

Currently, array profiling will always say that 'o' is NonArrayWithArrayStorage, even though on the first iteration it's a NonArray (as in it has no array storage).

We could catch this corner case in one of two ways: (1) OSR exit profiling or (2) more precise baseline profiling.  I prefer (2) because we usually only like to rely on (1) in pathological cases.  The above does not feel like a pathological case - it seems rather sensible to write a program that has a loop, where the first iteration of that loop does special things.

Of course, we could also kill off this pathology, at least in most cases, by relying on loop peeling.  But for now, I think having a more precise array profiler just feels like a nicer solution
Comment 1 Filip Pizlo 2012-09-16 17:28:57 PDT
Created attachment 164328 [details]
the patch
Comment 2 Build Bot 2012-09-16 17:56:50 PDT
Comment on attachment 164328 [details]
the patch

Attachment 164328 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/13873232
Comment 3 Filip Pizlo 2012-09-16 18:06:46 PDT
Created attachment 164330 [details]
the patch

Fix non-DFG builds.
Comment 4 Filip Pizlo 2012-09-17 12:07:38 PDT
Landed in http://trac.webkit.org/changeset/128790
Comment 5 Csaba Osztrogonác 2012-09-17 16:10:33 PDT
(In reply to comment #4)
> Landed in http://trac.webkit.org/changeset/128790

It broke the Qt ARM build - https://bugs.webkit.org/show_bug.cgi?id=96968

Could you check it, please?
Comment 6 Filip Pizlo 2012-09-17 16:11:17 PDT
(In reply to comment #5)
> (In reply to comment #4)
> > Landed in http://trac.webkit.org/changeset/128790
> 
> It broke the Qt ARM build - https://bugs.webkit.org/show_bug.cgi?id=96968
> 
> Could you check it, please?

It broke your build because I introduced new assembler functionality.

It's up to you guys to implement assembler functionality on your platforms.