Bug 153851 - [iOS] Throw away linked code when navigating to a new page.
Summary: [iOS] Throw away linked code when navigating to a new page.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords: Performance
Depends on: 153940
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-03 17:51 PST by Andreas Kling
Modified: 2016-06-17 06:35 PDT (History)
9 users (show)

See Also:


Attachments
Patch (4.86 KB, patch)
2016-02-03 17:54 PST, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch for relanding (5.71 KB, patch)
2016-02-06 08:02 PST, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch (3.64 KB, patch)
2016-06-17 05:12 PDT, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch (4.36 KB, patch)
2016-06-17 05:13 PDT, Andreas Kling
koivisto: review+
Details | Formatted Diff | Diff
Patch for landing (4.34 KB, patch)
2016-06-17 05:57 PDT, Andreas Kling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2016-02-03 17:51:07 PST
We can keep our peak memory usage down by throwing away linked code when navigating to a new page.
Since linked code is tied to a specific global object, it won't be useful to the incoming page.
In the event of a backwards navigation, the cost of relinking that code is far lower than the memory cost of keeping it around.
Comment 1 Andreas Kling 2016-02-03 17:54:32 PST
Created attachment 270619 [details]
Patch
Comment 2 WebKit Commit Bot 2016-02-03 19:12:29 PST
Comment on attachment 270619 [details]
Patch

Clearing flags on attachment: 270619

Committed r196104: <http://trac.webkit.org/changeset/196104>
Comment 3 WebKit Commit Bot 2016-02-03 19:12:35 PST
All reviewed patches have been landed.  Closing bug.
Comment 4 WebKit Commit Bot 2016-02-06 02:08:29 PST
Re-opened since this is blocked by bug 153940
Comment 5 Andreas Kling 2016-02-06 08:02:28 PST
Created attachment 270795 [details]
Patch for relanding

Let's try to re-land this with a fix: don't throw away code unless we're navigating away from an existing history item.
Or basically only do this if the navigation is PageCache-eligible.
Comment 6 WebKit Commit Bot 2016-02-06 09:00:34 PST
Comment on attachment 270795 [details]
Patch for relanding

Clearing flags on attachment: 270795

Committed r196217: <http://trac.webkit.org/changeset/196217>
Comment 7 WebKit Commit Bot 2016-02-06 09:00:37 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Andreas Kling 2016-06-16 16:59:43 PDT
Rolled out in <https://trac.webkit.org/changeset/202139>
Comment 9 Andreas Kling 2016-06-17 05:12:35 PDT
Created attachment 281556 [details]
Patch

Same thing again, but this time we only do it if we haven't navigated in the last 2 seconds.
This looks a bit cheesy at first sight, but I can't think of a simpler fix for the excessive work problem.
Comment 10 Andreas Kling 2016-06-17 05:13:51 PDT
Created attachment 281557 [details]
Patch
Comment 11 WebKit Commit Bot 2016-06-17 05:15:02 PDT
Attachment 281557 [details] did not pass style-queue:


ERROR: Source/WebCore/platform/MemoryPressureHandler.cpp:43:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 1 in 4 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 12 Antti Koivisto 2016-06-17 05:52:54 PDT
Comment on attachment 281557 [details]
Patch

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

> Source/WebCore/platform/MemoryPressureHandler.cpp:167
> +    const auto minimumTimeSinceNavigation = std::chrono::seconds(2);

Could just say 

const auto minimumTimeSinceNavigation = 2s;
Comment 13 Andreas Kling 2016-06-17 05:57:18 PDT
Created attachment 281559 [details]
Patch for landing
Comment 14 WebKit Commit Bot 2016-06-17 06:35:33 PDT
Comment on attachment 281559 [details]
Patch for landing

Clearing flags on attachment: 281559

Committed r202166: <http://trac.webkit.org/changeset/202166>
Comment 15 WebKit Commit Bot 2016-06-17 06:35:38 PDT
All reviewed patches have been landed.  Closing bug.