Bug 161638

Summary: GetMapBucket node should speculate on the type of its 'key' child
Product: WebKit Reporter: Saam Barati <saam>
Component: JavaScriptCoreAssignee: Saam Barati <saam>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, fpizlo, ggaren, gskachkov, jfbastien, keith_miller, mark.lam, msaboff, oliver, sukolsak, ticaiolima, ysuzuki
Priority: P2    
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
fpizlo: review+
patch for landing none

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