RESOLVED FIXED 194191
[JSC] Shrink size of FunctionExecutable
https://bugs.webkit.org/show_bug.cgi?id=194191
Summary [JSC] Shrink size of FunctionExecutable
Yusuke Suzuki
Reported 2019-02-02 03:37:20 PST
[JSC] Shrink size of FunctionExecutable
Attachments
Patch (22.95 KB, patch)
2019-02-02 03:41 PST, Yusuke Suzuki
no flags
Archive of layout-test-results from ews100 for mac-highsierra (2.43 MB, application/zip)
2019-02-02 04:55 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews107 for mac-highsierra-wk2 (2.52 MB, application/zip)
2019-02-02 05:08 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews113 for mac-highsierra (2.05 MB, application/zip)
2019-02-02 05:33 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews200 for win-future (12.84 MB, application/zip)
2019-02-02 05:41 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews124 for ios-simulator-wk2 (2.67 MB, application/zip)
2019-02-02 05:41 PST, EWS Watchlist
no flags
Patch (23.22 KB, patch)
2019-02-02 16:21 PST, Yusuke Suzuki
no flags
Patch (23.22 KB, patch)
2019-02-02 17:12 PST, Yusuke Suzuki
msaboff: review+
Yusuke Suzuki
Comment 1 2019-02-02 03:41:37 PST
EWS Watchlist
Comment 2 2019-02-02 04:55:39 PST
Comment on attachment 360971 [details] Patch Attachment 360971 [details] did not pass mac-ews (mac): Output: https://webkit-queues.webkit.org/results/11006433 New failing tests: fast/events/event-function-toString.html js/dom/function-names.html
EWS Watchlist
Comment 3 2019-02-02 04:55:41 PST
Created attachment 360972 [details] Archive of layout-test-results from ews100 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-highsierra Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 4 2019-02-02 05:07:59 PST
Comment on attachment 360971 [details] Patch Attachment 360971 [details] did not pass mac-wk2-ews (mac-wk2): Output: https://webkit-queues.webkit.org/results/11006452 New failing tests: fast/events/event-function-toString.html js/dom/function-names.html
EWS Watchlist
Comment 5 2019-02-02 05:08:01 PST
Created attachment 360973 [details] Archive of layout-test-results from ews107 for mac-highsierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-highsierra-wk2 Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 6 2019-02-02 05:33:34 PST
Comment on attachment 360971 [details] Patch Attachment 360971 [details] did not pass mac-debug-ews (mac): Output: https://webkit-queues.webkit.org/results/11006478 New failing tests: fast/events/event-function-toString.html js/dom/function-names.html
EWS Watchlist
Comment 7 2019-02-02 05:33:36 PST
Created attachment 360974 [details] Archive of layout-test-results from ews113 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews113 Port: mac-highsierra Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 8 2019-02-02 05:40:48 PST
Comment on attachment 360971 [details] Patch Attachment 360971 [details] did not pass win-ews (win): Output: https://webkit-queues.webkit.org/results/11006541 New failing tests: fast/events/event-function-toString.html js/dom/function-names.html
EWS Watchlist
Comment 9 2019-02-02 05:41:00 PST
Created attachment 360975 [details] Archive of layout-test-results from ews200 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews200 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
EWS Watchlist
Comment 10 2019-02-02 05:41:29 PST
Comment on attachment 360971 [details] Patch Attachment 360971 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: https://webkit-queues.webkit.org/results/11006462 New failing tests: fast/events/event-function-toString.html js/dom/function-names.html
EWS Watchlist
Comment 11 2019-02-02 05:41:31 PST
Created attachment 360976 [details] Archive of layout-test-results from ews124 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews124 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 12 2019-02-02 06:26:00 PST
Comment on attachment 360971 [details] Patch Attachment 360971 [details] did not pass jsc-ews (mac): Output: https://webkit-queues.webkit.org/results/11006520 New failing tests: typeProfiler.yaml/typeProfiler/return.js.ftl-type-profiler-ftl-eager typeProfiler.yaml/typeProfiler/return.js.ftl-no-cjit-type-profiler-force-poly-proto typeProfiler.yaml/typeProfiler/arrow-functions.js.ftl-type-profiler typeProfiler.yaml/typeProfiler/arrow-functions.js.ftl-type-profiler-ftl-eager typeProfiler.yaml/typeProfiler/return.js.ftl-type-profiler typeProfiler.yaml/typeProfiler/arrow-functions.js.ftl-no-cjit-type-profiler-force-poly-proto apiTests
Saam Barati
Comment 13 2019-02-02 09:25:59 PST
Comment on attachment 360971 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=360971&action=review r- because EWS is unhappy > Source/JavaScriptCore/ChangeLog:16 > + the size of FunctionExecutable in the major case. major => common
Yusuke Suzuki
Comment 14 2019-02-02 16:21:21 PST
Yusuke Suzuki
Comment 15 2019-02-02 17:12:14 PST
Yusuke Suzuki
Comment 16 2019-02-02 17:18:58 PST
Comment on attachment 360971 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=360971&action=review Updated, and I think this is OK now. >> Source/JavaScriptCore/ChangeLog:16 >> + the size of FunctionExecutable in the major case. > > major => common Thanks, fixed. > Source/JavaScriptCore/runtime/FunctionExecutable.cpp:114 > + m_rareData = std::make_unique<RareData>(); We should update the members of m_rareData here by using m_unlinkedExecutable. Fixed in the newer patch.
Michael Saboff
Comment 17 2019-02-04 10:37:20 PST
Comment on attachment 360986 [details] Patch r=me
Mark Lam
Comment 18 2019-02-04 10:38:51 PST
Comment on attachment 360986 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=360986&action=review > Source/JavaScriptCore/runtime/FunctionExecutable.h:188 > + void setOverrideLineNumber(int overrideLineNumber) > + { > + if (overrideLineNumber == -1) > + return; > + ensureRareData().m_overrideLineNumber = overrideLineNumber; > + } > + > + Optional<int> overrideLineNumber() const > + { > + if (UNLIKELY(m_rareData)) > + return m_rareData->m_overrideLineNumber; > + return WTF::nullopt; > + } If it's possible to setOverrideLineNumber(-1) after setOverrideLineNumber(5), then we need to reflect that in ensureRareData().m_overrideLineNumber i.e. setOverrideLineNumber() should check if m_rareData exists and behave accordingly. Ditto for overrideLineNumber() which needs to return a nullopt if m_rareData exists and m_overrideLineNumber is -1. If this is not true, then you should ASSERT(!m_rareData) in the if (overrideLineNumber == -1) case in setOverrideLineNumber(). OK, by grepping the code, I see that setOverrideLineNumber() is only ever called once. Let's add the ASSERT so that we don't fail silently if things change.
Yusuke Suzuki
Comment 19 2019-02-04 11:18:11 PST
Comment on attachment 360986 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=360986&action=review >> Source/JavaScriptCore/runtime/FunctionExecutable.h:188 >> + } > > If it's possible to setOverrideLineNumber(-1) after setOverrideLineNumber(5), then we need to reflect that in ensureRareData().m_overrideLineNumber i.e. setOverrideLineNumber() should check if m_rareData exists and behave accordingly. Ditto for overrideLineNumber() which needs to return a nullopt if m_rareData exists and m_overrideLineNumber is -1. > > If this is not true, then you should ASSERT(!m_rareData) in the if (overrideLineNumber == -1) case in setOverrideLineNumber(). > > OK, by grepping the code, I see that setOverrideLineNumber() is only ever called once. Let's add the ASSERT so that we don't fail silently if things change. Nice! Added ASSERT.
Dominik Inführ
Comment 20 2019-02-04 11:21:13 PST
I've tested that failing test on ARM (jsc-armv7) locally, the test fails because there is not enough executable memory but succeeds with more.
Yusuke Suzuki
Comment 21 2019-02-04 11:26:05 PST
Comment on attachment 360986 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=360986&action=review >>> Source/JavaScriptCore/runtime/FunctionExecutable.h:188 >>> + } >> >> If it's possible to setOverrideLineNumber(-1) after setOverrideLineNumber(5), then we need to reflect that in ensureRareData().m_overrideLineNumber i.e. setOverrideLineNumber() should check if m_rareData exists and behave accordingly. Ditto for overrideLineNumber() which needs to return a nullopt if m_rareData exists and m_overrideLineNumber is -1. >> >> If this is not true, then you should ASSERT(!m_rareData) in the if (overrideLineNumber == -1) case in setOverrideLineNumber(). >> >> OK, by grepping the code, I see that setOverrideLineNumber() is only ever called once. Let's add the ASSERT so that we don't fail silently if things change. > > Nice! Added ASSERT. Or, we can just put `m_rareData->m_overrideLineNumber = WTF::nullopt` if m_rareData exists. Maybe, it is more simple. "Ditto for overrideLineNumber() which needs to return a nullopt if m_rareData exists and m_overrideLineNumber is -1." In this case, our Markable<int> makes it WTF::nullopt. So it just works.
Yusuke Suzuki
Comment 22 2019-02-04 13:02:32 PST
Radar WebKit Bug Importer
Comment 23 2019-02-04 13:03:47 PST
Note You need to log in before you can comment on or make changes to this bug.