Bug 161671 - [JSC] Use GetArrayLength for JSArray.length even when the array type is undecided
Summary: [JSC] Use GetArrayLength for JSArray.length even when the array type is undec...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Benjamin Poulain
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-06 20:34 PDT by Benjamin Poulain
Modified: 2016-09-12 15:15 PDT (History)
5 users (show)

See Also:


Attachments
Patch (9.31 KB, patch)
2016-09-07 20:12 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Poulain 2016-09-06 20:34:00 PDT
[JSC] Use GetArrayLength for JSArray.length even when the array type is undecided
Comment 1 Benjamin Poulain 2016-09-07 20:12:57 PDT
Created attachment 288232 [details]
Patch
Comment 2 Geoffrey Garen 2016-09-08 09:24:46 PDT
Comment on attachment 288232 [details]
Patch

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

r=me

> Source/JavaScriptCore/dfg/DFGArrayMode.cpp:203
> -        if (node->op() == GetByVal
> +        if ((node->op() == GetByVal || canBecomeGetArrayLength(graph, node))

Looks like the comment above needs an update.

...The code above returns early if index is not int32. How can we get here if we're compiling "array.length"?
Comment 3 Benjamin Poulain 2016-09-12 14:51:36 PDT
(In reply to comment #2)
> > Source/JavaScriptCore/dfg/DFGArrayMode.cpp:203
> > -        if (node->op() == GetByVal
> > +        if ((node->op() == GetByVal || canBecomeGetArrayLength(graph, node))
> 
> Looks like the comment above needs an update.
> 
> ...The code above returns early if index is not int32. How can we get here
> if we're compiling "array.length"?

For GetArrayLength, the index type is the type returned by GetById("length").
Comment 4 WebKit Commit Bot 2016-09-12 15:15:43 PDT
Comment on attachment 288232 [details]
Patch

Clearing flags on attachment: 288232

Committed r205830: <http://trac.webkit.org/changeset/205830>
Comment 5 WebKit Commit Bot 2016-09-12 15:15:46 PDT
All reviewed patches have been landed.  Closing bug.