Bug 100828 - GC should shrink arrays to fit in the smallest sensible amount of memory
Summary: GC should shrink arrays to fit in the smallest sensible amount of memory
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords:
Depends on: 100827
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-31 01:19 PDT by Filip Pizlo
Modified: 2012-10-31 08:59 PDT (History)
6 users (show)

See Also:


Attachments
the patch (1.65 KB, patch)
2012-10-31 01:29 PDT, Filip Pizlo
fpizlo: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2012-10-31 01:19:47 PDT
This will mostly prevent us from having to reason about a priori thresholds for sparse array logic.  If in doubt, JSC should be able to just allocate a large contiguous array and leave it to the GC to figure out whether or not that was a good idea.

That might imply that the GC should also be able to create sparse maps as needed.  Most likely the best way to do it will be that if the GC detects that an array would benefit from a sparse map and that array doesn't already have a sparse map, then it should defer the sparse map creation.  It can be done as part of sweeping, or something.

I'm marking this as depending on https://bugs.webkit.org/show_bug.cgi?id=100827.  Really it's related to the other bug.  I want to first bump up the sparse map size threshold and then later worry about the heuristics to make it safe-for-space in all of the various pathological corner cases.
Comment 1 Filip Pizlo 2012-10-31 01:29:14 PDT
Created attachment 171595 [details]
the patch
Comment 2 Filip Pizlo 2012-10-31 01:29:44 PDT
Comment on attachment 171595 [details]
the patch

Ahhh!!  Never mind.  I posted this patch to the wrong bug.
Comment 3 Geoffrey Garen 2012-10-31 08:45:19 PDT
FWIW, I think we should apply the same logic to named property backing stores.
Comment 4 Oliver Hunt 2012-10-31 08:59:50 PDT
(In reply to comment #3)
> FWIW, I think we should apply the same logic to named property backing stores.

We'd need to deal with structure implying backing store size