RESOLVED FIXED Bug 182731
[FTL] Add Arrayify for ArrayStorage and SlowPutArrayStorage
https://bugs.webkit.org/show_bug.cgi?id=182731
Summary [FTL] Add Arrayify for ArrayStorage and SlowPutArrayStorage
Yusuke Suzuki
Reported 2018-02-13 09:31:22 PST
...
Attachments
Patch (4.85 KB, patch)
2018-02-13 10:38 PST, Yusuke Suzuki
no flags
Patch (17.82 KB, patch)
2018-02-13 12:45 PST, Yusuke Suzuki
no flags
Patch (18.59 KB, patch)
2018-02-14 01:25 PST, Yusuke Suzuki
saam: review+
Yusuke Suzuki
Comment 1 2018-02-13 10:38:54 PST
Yusuke Suzuki
Comment 2 2018-02-13 12:45:06 PST
Yusuke Suzuki
Comment 3 2018-02-13 12:48:41 PST
Comment on attachment 333713 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=333713&action=review > Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:-791 > - m_jit.and32(TrustedImm32(IndexingShapeMask), tempGPR); Old DFG implementation does not check Array::NonArray/Array::OriginalNonArray well (it does not look into IsArray). This patch also fixes it.
Saam Barati
Comment 4 2018-02-13 14:52:38 PST
Comment on attachment 333713 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=333713&action=review > Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:780 > + TrustedImm32(SlowPutArrayStorageShape - ArrayStorageShape))); This math doesn't look right to me: input indexing type = i = 0x0c (NonArrayWithSlowPutArrayStorage) i - (0x0A | 1) = 1 1 is not above (0x0c - 0x0a) = 2
Yusuke Suzuki
Comment 5 2018-02-14 01:25:06 PST
Comment on attachment 333713 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=333713&action=review >> Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:780 >> + TrustedImm32(SlowPutArrayStorageShape - ArrayStorageShape))); > > This math doesn't look right to me: > input indexing type = i = 0x0c (NonArrayWithSlowPutArrayStorage) > i - (0x0A | 1) = 1 > 1 is not above (0x0c - 0x0a) = 2 Oops, I thought IsArray is higher than SlowPutArrayStorageShape. Fixed.
Yusuke Suzuki
Comment 6 2018-02-14 01:25:52 PST
Yusuke Suzuki
Comment 7 2018-02-17 22:16:26 PST
Ping?
Saam Barati
Comment 8 2018-02-19 18:36:23 PST
Comment on attachment 333775 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=333775&action=review r=me with some FTL comments > Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:14590 > + LValue shapeResult = m_out.belowOrEqual( nit: I'd maybe call this something like "isExpectedShape" or "isAnArrayStorageShape" or something similar. > Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:14595 > + m_out.branch(shapeResult, usually(checkCase), usually(falseCase)); these are both usually, that's wrong. The "falseCase" should be "unlikely"
Saam Barati
Comment 9 2018-02-19 18:37:15 PST
(In reply to Saam Barati from comment #8) > Comment on attachment 333775 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=333775&action=review > > r=me with some FTL comments > > > Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:14590 > > + LValue shapeResult = m_out.belowOrEqual( > > nit: I'd maybe call this something like "isExpectedShape" or > "isAnArrayStorageShape" or something similar. > > > Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:14595 > > + m_out.branch(shapeResult, usually(checkCase), usually(falseCase)); > > these are both usually, that's wrong. The "falseCase" should be "unlikely" Oops, I has two reviews going in two different windows. Going to comment more.
Saam Barati
Comment 10 2018-02-19 18:38:42 PST
Comment on attachment 333775 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=333775&action=review >> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:14595 >> + m_out.branch(shapeResult, usually(checkCase), usually(falseCase)); > > these are both usually, that's wrong. The "falseCase" should be "unlikely" Ignore be saying which one should be likely/unlikely. I'll let you decide that. > Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:14606 > + usually(trueCase), usually(falseCase)); You use usually twice here again. > Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:14613 > + usually(trueCase), usually(falseCase)); and here. > Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:14627 > + m_out.appendTo(falseCase, continuation); > + ValueFromBlock falseValue = m_out.anchor(m_out.booleanFalse); > + m_out.jump(continuation); You don't need a basic block to do this. You can just anchor this in the initial basic block and remove this. (Or you can remove the true block and do something similar there).
Yusuke Suzuki
Comment 11 2018-02-19 19:58:15 PST
Comment on attachment 333775 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=333775&action=review >>> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:14590 >>> + LValue shapeResult = m_out.belowOrEqual( >> >> nit: I'd maybe call this something like "isExpectedShape" or "isAnArrayStorageShape" or something similar. > > Oops, I has two reviews going in two different windows. Going to comment more. OK, I'll use `isAnArrayStorageShape`. >>> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:14595 >>> + m_out.branch(shapeResult, usually(checkCase), usually(falseCase)); >> >> these are both usually, that's wrong. The "falseCase" should be "unlikely" > > Ignore be saying which one should be likely/unlikely. I'll let you decide that. I think using `usually` is ok here since the condition produced by this function would be used for both cases. >> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:14627 >> + m_out.jump(continuation); > > You don't need a basic block to do this. You can just anchor this in the initial basic block and remove this. (Or you can remove the true block and do something similar there). Nice, I've moved falseValue anchor to the initial basic block, and remove this `falseCase` BB.
Yusuke Suzuki
Comment 12 2018-02-19 20:00:22 PST
Radar WebKit Bug Importer
Comment 13 2018-02-19 20:01:31 PST
Yusuke Suzuki
Comment 14 2018-02-19 20:50:32 PST
Comment on attachment 333775 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=333775&action=review >>>> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:14595 >>>> + m_out.branch(shapeResult, usually(checkCase), usually(falseCase)); >>> >>> these are both usually, that's wrong. The "falseCase" should be "unlikely" >> >> Ignore be saying which one should be likely/unlikely. I'll let you decide that. > > I think using `usually` is ok here since the condition produced by this function would be used for both cases. Oops, I misunderstood your comment. I'll change them to `unsure()`.
Note You need to log in before you can comment on or make changes to this bug.