Bug 194191 - [JSC] Shrink size of FunctionExecutable
Summary: [JSC] Shrink size of FunctionExecutable
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks: 193606
  Show dependency treegraph
 
Reported: 2019-02-02 03:37 PST by Yusuke Suzuki
Modified: 2019-02-04 17:33 PST (History)
10 users (show)

See Also:


Attachments
Patch (22.95 KB, patch)
2019-02-02 03:41 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
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 Details
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 Details
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 Details
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 Details
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 Details
Patch (23.22 KB, patch)
2019-02-02 16:21 PST, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (23.22 KB, patch)
2019-02-02 17:12 PST, Yusuke Suzuki
msaboff: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2019-02-02 03:37:20 PST
[JSC] Shrink size of FunctionExecutable
Comment 1 Yusuke Suzuki 2019-02-02 03:41:37 PST
Created attachment 360971 [details]
Patch
Comment 2 EWS Watchlist 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
Comment 3 EWS Watchlist 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
Comment 4 EWS Watchlist 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
Comment 5 EWS Watchlist 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
Comment 6 EWS Watchlist 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
Comment 7 EWS Watchlist 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
Comment 8 EWS Watchlist 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
Comment 9 EWS Watchlist 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
Comment 10 EWS Watchlist 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
Comment 11 EWS Watchlist 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
Comment 12 EWS Watchlist 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
Comment 13 Saam Barati 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
Comment 14 Yusuke Suzuki 2019-02-02 16:21:21 PST
Created attachment 360984 [details]
Patch
Comment 15 Yusuke Suzuki 2019-02-02 17:12:14 PST
Created attachment 360986 [details]
Patch
Comment 16 Yusuke Suzuki 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.
Comment 17 Michael Saboff 2019-02-04 10:37:20 PST
Comment on attachment 360986 [details]
Patch

r=me
Comment 18 Mark Lam 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.
Comment 19 Yusuke Suzuki 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.
Comment 20 Dominik Inführ 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.
Comment 21 Yusuke Suzuki 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.
Comment 22 Yusuke Suzuki 2019-02-04 13:02:32 PST
Committed r240938: <https://trac.webkit.org/changeset/240938>
Comment 23 Radar WebKit Bug Importer 2019-02-04 13:03:47 PST
<rdar://problem/47796473>