RESOLVED FIXED Bug 182782
[FTL] Support ArrayPush for ArrayStorage
https://bugs.webkit.org/show_bug.cgi?id=182782
Summary [FTL] Support ArrayPush for ArrayStorage
Yusuke Suzuki
Reported 2018-02-14 02:14:18 PST
[FTL] Support ArrayPush for ArrayStorage
Attachments
Patch (8.21 KB, patch)
2018-02-14 02:14 PST, Yusuke Suzuki
no flags
Patch (12.69 KB, patch)
2018-02-14 03:37 PST, Yusuke Suzuki
no flags
Patch (13.91 KB, patch)
2018-02-14 03:59 PST, Yusuke Suzuki
saam: review+
Yusuke Suzuki
Comment 1 2018-02-14 02:14:58 PST
Yusuke Suzuki
Comment 2 2018-02-14 02:17:51 PST
Comment on attachment 333776 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=333776&action=review > Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:4478 > + case Array::ArrayStorage: { ArrayStorage case is similar to Int32/Contiguous/Double. But it has various slightly different things. For example, ArrayStorage_vector has offset while the other arrays's storage does not have offset. And we should check largestPositiveInt32Length. In addition, we need to increment ArrayStorage_numValuesInVector. So, we just create the completely different path for ArrayStorage in this patch.
Yusuke Suzuki
Comment 3 2018-02-14 03:37:05 PST
Yusuke Suzuki
Comment 4 2018-02-14 03:59:22 PST
Saam Barati
Comment 5 2018-02-19 19:18:28 PST
Comment on attachment 333785 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=333785&action=review r=me > Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:4478 > + case Array::ArrayStorage: { Is SlowPutArrayStorage not possible? > Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:4488 > + LValue prevLength = m_out.load32(storage, m_heaps.Butterfly_publicLength); > + // Refuse to handle bizarre lengths. > + speculate(Uncountable, noValue(), nullptr, m_out.above(prevLength, m_out.constInt32(largestPositiveInt32Length))); You can move this code above the if since you do it below too. > Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:4497 > + unsure(slowPath), unsure(fastPath)); You can probably use likely/unlikely here > Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:4535 > + m_out.branch(beyondVectorLength, unsure(slowPath), unsure(fastPath)); you can probably use likely/unlikely here. > Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:4563 > + m_out.branch(beyondVectorLength, unsure(slowCallPath), unsure(continuation)); could probably use likely/unlikely here.
Yusuke Suzuki
Comment 6 2018-02-19 20:55:10 PST
Comment on attachment 333785 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=333785&action=review >> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:4478 >> + case Array::ArrayStorage: { > > Is SlowPutArrayStorage not possible? Currently we do not support SlowPutArrayStorage for ArrayPush/ArrayPop (in DFGByteCodeParser). And we cannot extend this support for SlowPutArrayStorage mechanically since ArrayPush for SlowPutArrayStorage can be reentrant while the other cases are not... so use of scratch buffer should be careful. >> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:4488 >> + speculate(Uncountable, noValue(), nullptr, m_out.above(prevLength, m_out.constInt32(largestPositiveInt32Length))); > > You can move this code above the if since you do it below too. Moved. >> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:4497 >> + unsure(slowPath), unsure(fastPath)); > > You can probably use likely/unlikely here Fixed. >> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:4535 >> + m_out.branch(beyondVectorLength, unsure(slowPath), unsure(fastPath)); > > you can probably use likely/unlikely here. Fixed. >> Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:4563 >> + m_out.branch(beyondVectorLength, unsure(slowCallPath), unsure(continuation)); > > could probably use likely/unlikely here. Fixed.
Yusuke Suzuki
Comment 7 2018-02-19 21:02:02 PST
Radar WebKit Bug Importer
Comment 8 2018-02-19 21:03:30 PST
Note You need to log in before you can comment on or make changes to this bug.