RESOLVED FIXED Bug 200192
[JSC] Make StructureChain less-tricky by using Auxiliary Buffer
https://bugs.webkit.org/show_bug.cgi?id=200192
Summary [JSC] Make StructureChain less-tricky by using Auxiliary Buffer
Yusuke Suzuki
Reported 2019-07-26 22:17:48 PDT
[JSC] Make StructureChain less-tricky by using Auxiliary Buffer
Attachments
Patch (5.93 KB, patch)
2019-07-26 22:20 PDT, Yusuke Suzuki
no flags
Patch (5.92 KB, patch)
2019-07-26 22:21 PDT, Yusuke Suzuki
no flags
Patch (6.12 KB, patch)
2019-07-27 00:31 PDT, Yusuke Suzuki
no flags
Patch (7.97 KB, patch)
2019-07-27 02:33 PDT, Yusuke Suzuki
saam: review+
ews-watchlist: commit-queue-
Yusuke Suzuki
Comment 1 2019-07-26 22:20:07 PDT
Yusuke Suzuki
Comment 2 2019-07-26 22:21:34 PDT
Yusuke Suzuki
Comment 3 2019-07-27 00:31:29 PDT
Yusuke Suzuki
Comment 4 2019-07-27 02:33:52 PDT
EWS Watchlist
Comment 5 2019-07-27 04:40:07 PDT
Comment on attachment 375024 [details] Patch Attachment 375024 [details] did not pass jsc-ews (mac): Output: https://webkit-queues.webkit.org/results/12821145 New failing tests: mozilla-tests.yaml/js1_5/Array/regress-101964.js.mozilla-dfg-eager-no-cjit-validate-phases
Saam Barati
Comment 6 2019-07-30 17:27:22 PDT
Comment on attachment 375024 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=375024&action=review r=me > Source/JavaScriptCore/runtime/StructureChain.cpp:48 > + ++size; // Sentinel nullptr. is it worth just having a size field? (Or we could also be terrible people and encode the size in the auxiliary pointer itself, since the size of a prototype chain is usually low. And if we exceed 16 bits we can OOM.) > Source/JavaScriptCore/runtime/StructureChain.cpp:49 > + WriteBarrier<Structure>* vector = static_cast<WriteBarrier<Structure>*>(vm.jsValueGigacageAuxiliarySpace.allocateNonVirtual(vm, (Checked<size_t>(size) * sizeof(WriteBarrier<Structure>)).unsafeGet(), nullptr, AllocationFailureMode::Assert)); What about OOM? Seems easy to just make this an allocation that can fail?
Saam Barati
Comment 7 2019-07-30 17:27:35 PDT
(In reply to Build Bot from comment #5) > Comment on attachment 375024 [details] > Patch > > Attachment 375024 [details] did not pass jsc-ews (mac): > Output: https://webkit-queues.webkit.org/results/12821145 > > New failing tests: > mozilla-tests.yaml/js1_5/Array/regress-101964.js.mozilla-dfg-eager-no-cjit- > validate-phases Is this real?
Yusuke Suzuki
Comment 8 2019-07-30 17:50:36 PDT
(In reply to Saam Barati from comment #7) > (In reply to Build Bot from comment #5) > > Comment on attachment 375024 [details] > > Patch > > > > Attachment 375024 [details] did not pass jsc-ews (mac): > > Output: https://webkit-queues.webkit.org/results/12821145 > > > > New failing tests: > > mozilla-tests.yaml/js1_5/Array/regress-101964.js.mozilla-dfg-eager-no-cjit- > > validate-phases > > Is this real? This test is known as flaky these days, and it is not a real issue with this patch.
Yusuke Suzuki
Comment 9 2019-07-30 17:59:09 PDT
Comment on attachment 375024 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=375024&action=review Thanks! >> Source/JavaScriptCore/runtime/StructureChain.cpp:48 >> + ++size; // Sentinel nullptr. > > is it worth just having a size field? (Or we could also be terrible people and encode the size in the auxiliary pointer itself, since the size of a prototype chain is usually low. And if we exceed 16 bits we can OOM.) The current callers of StructureChain is now assuming that StructureChain allocation never fails. I think just crashing if OOM happens is OK here, as we did by allocating array with makeUniqueArray. Since caching such a large StructureChain may not be profitable, it would be nice if we can make the caller allocation-failure-aware, and limit the size of StructureChain like <= UINT16_MAX. I'll note it as FIXME with bugzilla link. >> Source/JavaScriptCore/runtime/StructureChain.cpp:49 >> + WriteBarrier<Structure>* vector = static_cast<WriteBarrier<Structure>*>(vm.jsValueGigacageAuxiliarySpace.allocateNonVirtual(vm, (Checked<size_t>(size) * sizeof(WriteBarrier<Structure>)).unsafeGet(), nullptr, AllocationFailureMode::Assert)); > > What about OOM? Seems easy to just make this an allocation that can fail? I added the FIXME about allocation-failure-aware callers.
Yusuke Suzuki
Comment 10 2019-07-30 18:22:24 PDT
Radar WebKit Bug Importer
Comment 11 2019-07-30 18:24:19 PDT
Note You need to log in before you can comment on or make changes to this bug.