Bug 113662 - Regions should be allocated from the same contiguous segment of virtual memory
Summary: Regions should be allocated from the same contiguous segment of virtual memory
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Hahnenberg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-31 09:20 PDT by Mark Hahnenberg
Modified: 2013-04-01 11:45 PDT (History)
4 users (show)

See Also:


Attachments
Patch (34.02 KB, patch)
2013-03-31 20:49 PDT, Mark Hahnenberg
no flags Details | Formatted Diff | Diff
Patch (33.98 KB, patch)
2013-03-31 21:13 PDT, Mark Hahnenberg
fpizlo: review+
eflews.bot: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Hahnenberg 2013-03-31 09:20:03 PDT
Instead of letting the OS spread our Regions all over the place, we should allocate them all within some range of each other. This change will open the door to some other optimizations, e.g. doing simple range checks for our write barriers and compressing JSCell pointers to 32-bits.

We can do this by having a SuperRegion for each BlockAllocator (i.e. per-VM) which subclasses MetaAllocator along the lines of the FixedVMPoolExecutableAllocator we use for the JIT.
Comment 1 Mark Hahnenberg 2013-03-31 20:49:43 PDT
Created attachment 195921 [details]
Patch
Comment 2 Mark Hahnenberg 2013-03-31 20:51:47 PDT
(In reply to comment #1)
> Created an attachment (id=195921) [details]
> Patch

This patch is actually a slight speedup on some benchmarks.
Comment 3 Mark Hahnenberg 2013-03-31 21:13:39 PDT
Created attachment 195922 [details]
Patch
Comment 4 Mark Hahnenberg 2013-03-31 21:14:28 PDT
(In reply to comment #3)
> Created an attachment (id=195922) [details]
> Patch

Had to add more ifdefs.
Comment 5 Filip Pizlo 2013-03-31 21:16:59 PDT
Comment on attachment 195922 [details]
Patch

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

Other than the one comment, looks good!

> Source/WTF/wtf/MetaAllocator.h:67
> +    WTF_EXPORT_PRIVATE MetaAllocator(size_t allocationGranule, size_t pageSize = 0);

Why not say pageSize = WTF::pageSize() and then get rid of the pageSize initialization conditional inside MetaAllocator::MetaAllocator?
Comment 6 Mark Hahnenberg 2013-03-31 21:19:05 PDT
(In reply to comment #5)
> (From update of attachment 195922 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=195922&action=review
> 
> Other than the one comment, looks good!
> 
> > Source/WTF/wtf/MetaAllocator.h:67
> > +    WTF_EXPORT_PRIVATE MetaAllocator(size_t allocationGranule, size_t pageSize = 0);
> 
> Why not say pageSize = WTF::pageSize() and then get rid of the pageSize initialization conditional inside MetaAllocator::MetaAllocator?

Good call.
Comment 7 EFL EWS Bot 2013-03-31 21:57:45 PDT
Comment on attachment 195922 [details]
Patch

Attachment 195922 [details] did not pass efl-ews (efl):
Output: http://webkit-commit-queue.appspot.com/results/17392062
Comment 8 Mark Hahnenberg 2013-04-01 08:22:11 PDT
Committed r147324: <http://trac.webkit.org/changeset/147324>
Comment 10 Geoffrey Garen 2013-04-01 11:45:58 PDT
Comment on attachment 195922 [details]
Patch

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

> Source/JavaScriptCore/heap/SuperRegion.cpp:34
> +const size_t SuperRegion::s_fixedHeapMemoryPoolSize = 4 * 1024 * MB;

This seems a bit excessive, compared to most heaps. If the only cost of going over is a bit of performance, maybe we should make this smaller, like 1GB or 2GB.