Bug 194944 - [JSC] We should consider moving UnlinkedFunctionExecutable::m_parentScopeTDZVariables to RareData
Summary: [JSC] We should consider moving UnlinkedFunctionExecutable::m_parentScopeTDZV...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Caio Lima
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-02-22 07:19 PST by Caio Lima
Modified: 2019-04-24 11:13 PDT (History)
8 users (show)

See Also:


Attachments
WIP - Patch (21.29 KB, patch)
2019-02-26 19:11 PST, Caio Lima
no flags Details | Formatted Diff | Diff
WIP - Patch (21.20 KB, patch)
2019-02-26 19:37 PST, Caio Lima
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews126 for ios-simulator-wk2 (2.55 MB, application/zip)
2019-02-26 22:51 PST, EWS Watchlist
no flags Details
Patch (22.32 KB, patch)
2019-02-28 09:59 PST, Caio Lima
no flags Details | Formatted Diff | Diff
Patch (23.85 KB, patch)
2019-03-18 10:27 PDT, Caio Lima
no flags Details | Formatted Diff | Diff
Patch (23.87 KB, patch)
2019-04-01 08:43 PDT, Caio Lima
no flags Details | Formatted Diff | Diff
Patch (23.82 KB, patch)
2019-04-04 07:30 PDT, Caio Lima
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Caio Lima 2019-02-22 07:19:00 PST
Based on profiling data on Speedometer2, JetStream2, Kranken, Octane and LongSpider, `UnlinkedFunctionExecutable::m_parentScopeTDZVariables` often is carrying an empty VariableEnvironment (see results below).
In such case, we should consider move it to RareData and ensure it only when `parentScopeTDZVariables` is not empty.
Comment 1 Caio Lima 2019-02-22 07:20:27 PST
Data collected from Speedometer2

Total number of UFE: 39463
Total number of non-empty parentScopeTDZVars: 428

Data collected from JetStream2

Total number of UFE: 83715
Total number of non-empty parentScopeTDZVars:  5285

Data from other benchmarks

Octane/jquery
Total number of UFE: 75334
Total number of non-empty VarEnv: 10

Octane/typescript
Total number of UFE: 1773
Total number of non-empty VarEnv: 10

Octane/pdfjs
Total number of UFE: 1047
Total number of non-empty VarEnv: 10
Comment 2 Caio Lima 2019-02-26 19:11:55 PST
Created attachment 363057 [details]
WIP - Patch
Comment 3 Caio Lima 2019-02-26 19:37:07 PST
Created attachment 363060 [details]
WIP - Patch
Comment 4 EWS Watchlist 2019-02-26 22:51:06 PST
Comment on attachment 363060 [details]
WIP - Patch

Attachment 363060 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/11299222

New failing tests:
fast/viewport/ios/device-width-viewport-after-changing-view-scale.html
Comment 5 EWS Watchlist 2019-02-26 22:51:08 PST
Created attachment 363074 [details]
Archive of layout-test-results from ews126 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews126  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 6 Caio Lima 2019-02-28 09:59:56 PST
Created attachment 363233 [details]
Patch
Comment 7 Caio Lima 2019-03-18 10:27:08 PDT
Created attachment 365027 [details]
Patch
Comment 8 Caio Lima 2019-03-25 12:47:55 PDT
Ping Review
Comment 9 Caio Lima 2019-04-01 08:43:25 PDT
Created attachment 366398 [details]
Patch
Comment 10 Keith Miller 2019-04-03 15:04:52 PDT
Comment on attachment 366398 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=366398&action=review

r=me with some comments.

> Source/JavaScriptCore/ChangeLog:3
> +        [JSC] We should consider move UnlinkedFunctionExecutable::m_parentScopeTDZVariables to RareData

typo: move=>moving.

> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h:1278
> +        bool m_cachedVariablesUnderTDZIsEmpty { false };

Nit: I think this is clearer as m_hasCachedVariablesUnderTDZ since that's the active tense.
Comment 11 Caio Lima 2019-04-04 07:30:40 PDT
Created attachment 366709 [details]
Patch
Comment 12 Caio Lima 2019-04-04 09:54:32 PDT
Comment on attachment 366709 [details]
Patch

Thank you very much for the review!
Comment 13 WebKit Commit Bot 2019-04-04 10:21:21 PDT
Comment on attachment 366709 [details]
Patch

Clearing flags on attachment: 366709

Committed r243875: <https://trac.webkit.org/changeset/243875>
Comment 14 WebKit Commit Bot 2019-04-04 10:21:23 PDT
All reviewed patches have been landed.  Closing bug.
Comment 15 Radar WebKit Bug Importer 2019-04-04 10:22:24 PDT
<rdar://problem/49611795>
Comment 16 Saam Barati 2019-04-04 16:10:48 PDT
(In reply to Caio Lima from comment #1)
> Data collected from Speedometer2
> 
> Total number of UFE: 39463
> Total number of non-empty parentScopeTDZVars: 428
> 
> Data collected from JetStream2
> 
> Total number of UFE: 83715
> Total number of non-empty parentScopeTDZVars:  5285
> 
> Data from other benchmarks
> 
> Octane/jquery
> Total number of UFE: 75334
> Total number of non-empty VarEnv: 10
> 
> Octane/typescript
> Total number of UFE: 1773
> Total number of non-empty VarEnv: 10
> 
> Octane/pdfjs
> Total number of UFE: 1047
> Total number of non-empty VarEnv: 10

What about all of JetStream 2?
Comment 17 Caio Lima 2019-04-24 11:13:36 PDT
(In reply to Saam Barati from comment #16)
> (In reply to Caio Lima from comment #1)
> > Data collected from Speedometer2
> > 
> > Total number of UFE: 39463
> > Total number of non-empty parentScopeTDZVars: 428
> > 
> > Data collected from JetStream2
> > 
> > Total number of UFE: 83715
> > Total number of non-empty parentScopeTDZVars:  5285
> > 
> > Data from other benchmarks
> > 
> > Octane/jquery
> > Total number of UFE: 75334
> > Total number of non-empty VarEnv: 10
> > 
> > Octane/typescript
> > Total number of UFE: 1773
> > Total number of non-empty VarEnv: 10
> > 
> > Octane/pdfjs
> > Total number of UFE: 1047
> > Total number of non-empty VarEnv: 10
> 
> What about all of JetStream 2?

Numbers shows that 6% of total number of UnlinkedFunctionExecutable have non-empty VariableEnvironment. I'm not sure what is the policy to move something to RareData, but I think we should consider this a case to be rare.