Bug 162887

Summary: String.prototype.toLowerCase should be a DFG/FTL intrinsic
Product: WebKit Reporter: Saam Barati <saam>
Component: JavaScriptCoreAssignee: Saam Barati <saam>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, cmarcelo, commit-queue, dbates, fpizlo, ggaren, gskachkov, jfbastien, keith_miller, mark.lam, msaboff, oliver, ticaiolima, ysuzuki
Priority: P2    
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
WIP
none
patch
none
patch
fpizlo: review+
patch for landing
none
patch for landing v2 none

Saam Barati
Reported 2016-10-03 21:00:55 PDT
This is around a 7% speedup on ES6SampleBench/Basic. I also suspect it might help other things like Dromaeo.
Attachments
WIP (17.03 KB, patch)
2016-10-03 21:01 PDT, Saam Barati
no flags
patch (29.93 KB, patch)
2016-10-04 16:18 PDT, Saam Barati
no flags
patch (30.00 KB, patch)
2016-10-04 16:29 PDT, Saam Barati
fpizlo: review+
patch for landing (30.48 KB, patch)
2016-10-04 18:27 PDT, Saam Barati
no flags
patch for landing v2 (30.09 KB, patch)
2016-10-04 22:31 PDT, Saam Barati
no flags
Saam Barati
Comment 1 2016-10-03 21:01:46 PDT
Created attachment 290563 [details] WIP This is the gist of the patch, but needs some cleanup and possibly some better rules for Clobberize. I think it's probably valid to CSE toLowerCase().
Saam Barati
Comment 2 2016-10-04 16:18:31 PDT
Saam Barati
Comment 3 2016-10-04 16:29:59 PDT
Created attachment 290666 [details] patch rebased
JF Bastien
Comment 4 2016-10-04 16:32:38 PDT
Comment on attachment 290662 [details] patch What happens when code does: String.prototype.toLowerCase = function() { return this; };
Saam Barati
Comment 5 2016-10-04 16:36:52 PDT
(In reply to comment #4) > Comment on attachment 290662 [details] > patch > > What happens when code does: String.prototype.toLowerCase = function() { > return this; }; The intrinsic is tied to the primordial function we instantiate for this property, not the property path "String.prototype.toLowerCase".
Filip Pizlo
Comment 6 2016-10-04 16:46:03 PDT
Comment on attachment 290666 [details] patch so awesome.
Yusuke Suzuki
Comment 7 2016-10-04 17:05:22 PDT
Comment on attachment 290666 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=290666&action=review r=me too. > Source/JavaScriptCore/ChangeLog:8 > + This patch makes ToLowerCase an intrinsic in the DFG/FTL. On the fast It is nice if we can handle the similar intrinsic in toUpperCase() in the separated patch. > Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:1010 > + break; OK, target is already filtered with SpecString. So it does not clobber. > Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:1011 > + } And we have a chance to emit LazyJSValue if the given child is constant-folded in StrengthReduction phase. > Source/JavaScriptCore/dfg/DFGClobberize.h:1297 > + return; Nice. > Source/WTF/wtf/text/StringImpl.h:685 > + WTF_EXPORT_STRING_API Ref<StringImpl> convertToLowercaseWithoutLocaleStartingAtFailingIndex(unsigned); Let's include some word indicating that this function is only effective for 8bit. Maybe, "8Bit" ?
Saam Barati
Comment 8 2016-10-04 18:17:22 PDT
Comment on attachment 290666 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=290666&action=review >> Source/WTF/wtf/text/StringImpl.h:685 >> + WTF_EXPORT_STRING_API Ref<StringImpl> convertToLowercaseWithoutLocaleStartingAtFailingIndex(unsigned); > > Let's include some word indicating that this function is only effective for 8bit. Maybe, "8Bit" ? Sounds good. I'll make it: convertToLowercaseWithoutLocaleStartingAtFailingIndex8Bit
Saam Barati
Comment 9 2016-10-04 18:27:34 PDT
Created attachment 290676 [details] patch for landing
WebKit Commit Bot
Comment 10 2016-10-04 18:29:21 PDT
Attachment 290676 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/ChangeLog:7: Line contains tab character. [whitespace/tab] [5] Total errors found: 1 in 29 files If any of these errors are false positives, please file a bug against check-webkit-style.
Saam Barati
Comment 11 2016-10-04 22:31:50 PDT
Created attachment 290689 [details] patch for landing v2 Fix changelog.
WebKit Commit Bot
Comment 12 2016-10-04 23:18:47 PDT
Comment on attachment 290689 [details] patch for landing v2 Clearing flags on attachment: 290689 Committed r206804: <http://trac.webkit.org/changeset/206804>
WebKit Commit Bot
Comment 13 2016-10-04 23:18:53 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.