Bug 161638 - GetMapBucket node should speculate on the type of its 'key' child
Summary: GetMapBucket node should speculate on the type of its 'key' child
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-06 12:13 PDT by Saam Barati
Modified: 2016-10-03 17:38 PDT (History)
12 users (show)

See Also:


Attachments
patch (16.97 KB, patch)
2016-10-03 16:10 PDT, Saam Barati
fpizlo: review+
Details | Formatted Diff | Diff
patch for landing (16.76 KB, patch)
2016-10-03 17:03 PDT, Saam Barati
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2016-09-06 12:13:59 PDT
We may already have proved the types of the incoming key into the GetMapBucket node, so we should take advantage of this.
Currently, we emit runtime checks for types, however, we could probably emit a less branchy loop if we know what the type of the
incoming key is.
Comment 1 Saam Barati 2016-09-30 18:01:16 PDT
Looks like this is worth 2-3% on ES6SampleBench/Basic.
Comment 2 Saam Barati 2016-10-03 16:10:03 PDT
Created attachment 290532 [details]
patch
Comment 3 Filip Pizlo 2016-10-03 16:17:30 PDT
Comment on attachment 290532 [details]
patch

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

> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:6606
> +            m_out.insertNewBlocksBefore(notBitEqual);

It's scary to me that you're not capturing the return value here and resetting it...

> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:6648
> +            m_out.appendTo(bucketKeyIsInt32, loopAround);

... down here.  Any reason why you don't do that?
Comment 4 Filip Pizlo 2016-10-03 16:26:40 PDT
Comment on attachment 290532 [details]
patch

I think that aside from that minor thing, this code is right.
Comment 5 Saam Barati 2016-10-03 17:03:09 PDT
Created attachment 290537 [details]
patch for landing
Comment 6 Filip Pizlo 2016-10-03 17:08:29 PDT
Comment on attachment 290537 [details]
patch for landing

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

> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:6612
> +            m_out.appendTo(notBitEqual, bucketKeyIsCell);

This order: notBitEqual -> bucketKeyIsCell

is inconsistent with the order of allocation, above:

notBitEqual -> bucketKeyNotCell -> bucketKeyIsCell

I think that might confuse Output, at worst leading to a wonky block order.
Comment 7 Saam Barati 2016-10-03 17:25:24 PDT
Comment on attachment 290537 [details]
patch for landing

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

>> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:6612
>> +            m_out.appendTo(notBitEqual, bucketKeyIsCell);
> 
> This order: notBitEqual -> bucketKeyIsCell
> 
> is inconsistent with the order of allocation, above:
> 
> notBitEqual -> bucketKeyNotCell -> bucketKeyIsCell
> 
> I think that might confuse Output, at worst leading to a wonky block order.

Ok. I'll re-order the allocations. Good catch.
Comment 8 Saam Barati 2016-10-03 17:38:56 PDT
landed in:
https://trac.webkit.org/changeset/206763