RESOLVED FIXED 193031
[JSC] Optimize Object.prototype.toString
https://bugs.webkit.org/show_bug.cgi?id=193031
Summary [JSC] Optimize Object.prototype.toString
Yusuke Suzuki
Reported 2018-12-24 23:46:22 PST
[JSC] Optimize Object.prototype.toString
Attachments
Patch (37.09 KB, patch)
2018-12-24 23:46 PST, Yusuke Suzuki
no flags
Patch (33.28 KB, patch)
2018-12-24 23:56 PST, Yusuke Suzuki
no flags
Patch (33.21 KB, patch)
2018-12-24 23:58 PST, Yusuke Suzuki
no flags
Patch (37.21 KB, patch)
2018-12-25 00:24 PST, Yusuke Suzuki
no flags
Archive of layout-test-results from ews114 for mac-sierra (2.01 MB, application/zip)
2018-12-25 02:36 PST, EWS Watchlist
no flags
Patch (36.48 KB, patch)
2018-12-26 06:36 PST, Yusuke Suzuki
no flags
Archive of layout-test-results from ews114 for mac-sierra (2.02 MB, application/zip)
2018-12-26 09:24 PST, EWS Watchlist
no flags
Patch (42.17 KB, patch)
2018-12-27 05:34 PST, Yusuke Suzuki
no flags
Patch (42.20 KB, patch)
2018-12-27 05:39 PST, Yusuke Suzuki
no flags
Patch (43.02 KB, patch)
2018-12-31 22:47 PST, Yusuke Suzuki
no flags
Patch (42.34 KB, patch)
2019-01-02 15:10 PST, Yusuke Suzuki
no flags
Patch (42.35 KB, patch)
2019-01-02 15:17 PST, Yusuke Suzuki
saam: review+
Yusuke Suzuki
Comment 1 2018-12-24 23:46:54 PST
Yusuke Suzuki
Comment 2 2018-12-24 23:56:45 PST
Yusuke Suzuki
Comment 3 2018-12-24 23:58:59 PST
Yusuke Suzuki
Comment 4 2018-12-25 00:24:31 PST
EWS Watchlist
Comment 5 2018-12-25 02:36:24 PST
Comment on attachment 358060 [details] Patch Attachment 358060 [details] did not pass mac-debug-ews (mac): Output: https://webkit-queues.webkit.org/results/10541563 New failing tests: media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-until-play.html
EWS Watchlist
Comment 6 2018-12-25 02:36:26 PST
Created attachment 358062 [details] Archive of layout-test-results from ews114 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews114 Port: mac-sierra Platform: Mac OS X 10.12.6
Yusuke Suzuki
Comment 7 2018-12-26 06:36:57 PST
EWS Watchlist
Comment 8 2018-12-26 09:24:00 PST
Comment on attachment 358078 [details] Patch Attachment 358078 [details] did not pass mac-debug-ews (mac): Output: https://webkit-queues.webkit.org/results/10551775 New failing tests: media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-until-play.html
EWS Watchlist
Comment 9 2018-12-26 09:24:02 PST
Created attachment 358080 [details] Archive of layout-test-results from ews114 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews114 Port: mac-sierra Platform: Mac OS X 10.12.6
Yusuke Suzuki
Comment 10 2018-12-27 05:34:38 PST
Yusuke Suzuki
Comment 11 2018-12-27 05:39:37 PST
Keith Miller
Comment 12 2018-12-31 15:55:07 PST
Comment on attachment 358111 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=358111&action=review > Source/JavaScriptCore/ChangeLog:9 > + It is called so many times in wtb-lebab.js. This patch optimizes Did you mean to say more in this sentence? If not, I would get rid of the "so" and make this: "It is called many times in wtb-lebab.js, for instance" > Source/JavaScriptCore/ChangeLog:12 > + 1. We should emit code looking up cached one in DFG and FTL. Nit: cached one => a cached result. > Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:12473 > + auto isUndefined = m_jit.branchIfUndefined(sourceRegs); > + m_jit.move(TrustedImmPtr::weakPointer(m_jit.graph(), m_jit.vm()->smallStrings.nullObjectString()), resultGPR); > + auto done = m_jit.jump(); > + isUndefined.link(&m_jit); > + m_jit.move(TrustedImmPtr::weakPointer(m_jit.graph(), m_jit.vm()->smallStrings.undefinedObjectString()), resultGPR); > + done.link(&m_jit); Don't you need a case here for booleans? If so, can you add a test? > Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:6449 > + LBasicBlock undefinedCase = m_out.newBlock(); > + LBasicBlock nullCase = m_out.newBlock(); > + LBasicBlock continuation = m_out.newBlock(); > + > + speculate(m_node->child1()); > + LValue source = lowJSValue(m_node->child1(), ManualOperandSpeculation); > + LValue valueIsUndefined = m_out.equal(source, m_out.constInt64(ValueUndefined)); > + m_out.branch(valueIsUndefined, unsure(undefinedCase), unsure(nullCase)); > + > + LBasicBlock lastNext = m_out.appendTo(undefinedCase, nullCase); > + ValueFromBlock undefinedString = m_out.anchor(weakPointer(vm().smallStrings.undefinedObjectString())); > + m_out.jump(continuation); > + > + m_out.appendTo(nullCase, continuation); > + ValueFromBlock nullString = m_out.anchor(weakPointer(vm().smallStrings.nullObjectString())); > + m_out.jump(continuation); > + > + m_out.appendTo(continuation, lastNext); > + setJSValue(m_out.phi(pointerType(), undefinedString, nullString)); > + return; Ditto on the boolean here.
Yusuke Suzuki
Comment 13 2018-12-31 18:35:31 PST
Comment on attachment 358111 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=358111&action=review >> Source/JavaScriptCore/ChangeLog:9 >> + It is called so many times in wtb-lebab.js. This patch optimizes > > Did you mean to say more in this sentence? If not, I would get rid of the "so" and make this: "It is called many times in wtb-lebab.js, for instance" Yeah, fixed by dropping `so`. >> Source/JavaScriptCore/ChangeLog:12 >> + 1. We should emit code looking up cached one in DFG and FTL. > > Nit: cached one => a cached result. Nice. Fixed. >> Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:12473 >> + done.link(&m_jit); > > Don't you need a case here for booleans? If so, can you add a test? Oops, fixed to use OtherUse and SpecOther. Misc is not right. >> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:6449 >> + return; > > Ditto on the boolean here. Fixed.
Yusuke Suzuki
Comment 14 2018-12-31 22:47:33 PST
Yusuke Suzuki
Comment 15 2019-01-02 15:10:54 PST
Yusuke Suzuki
Comment 16 2019-01-02 15:17:23 PST
Yusuke Suzuki
Comment 17 2019-01-03 17:18:48 PST
Ping?
Saam Barati
Comment 18 2019-01-04 08:58:00 PST
Comment on attachment 358214 [details] Patch r=me
Saam Barati
Comment 19 2019-01-04 09:00:11 PST
Comment on attachment 358214 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=358214&action=review > Source/JavaScriptCore/ChangeLog:12 > + 1. We should emit code looking up cached one in DFG and FTL. cached one => cached to string
Yusuke Suzuki
Comment 20 2019-01-04 09:02:39 PST
Comment on attachment 358214 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=358214&action=review Thank you! >> Source/JavaScriptCore/ChangeLog:12 >> + 1. We should emit code looking up cached one in DFG and FTL. > > cached one => cached to string Oops, fixed.
Yusuke Suzuki
Comment 21 2019-01-04 09:04:13 PST
Radar WebKit Bug Importer
Comment 22 2019-01-04 09:05:34 PST
Note You need to log in before you can comment on or make changes to this bug.