Bug 120910 - Calculating the size of the Heap should not require walking over it
Summary: Calculating the size of the Heap should not require walking over it
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: 121074
  Show dependency treegraph
 
Reported: 2013-09-06 16:47 PDT by Mark Hahnenberg
Modified: 2013-09-12 10:57 PDT (History)
0 users

See Also:


Attachments
Patch (7.69 KB, patch)
2013-09-06 18:33 PDT, Mark Hahnenberg
ggaren: review+
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-09-06 16:47:03 PDT
Currently Heap::size() is O(sizeof(Heap)). This is too expensive to call during a collection. We should keep a count of visited and copied bytes as each collection progresses so as to avoid re-walking the Heap at the end of collection.
Comment 1 Mark Hahnenberg 2013-09-06 18:33:08 PDT
Created attachment 210827 [details]
Patch
Comment 2 Geoffrey Garen 2013-09-06 23:09:13 PDT
Comment on attachment 210827 [details]
Patch

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

r=me

> Source/JavaScriptCore/heap/Heap.cpp:647
> +    // rather than all used (inluding dead) copied bytes, thus it's 

Should be "including".

> Source/JavaScriptCore/heap/Heap.h:254
> +        size_t m_totalBytesVisited;
> +        size_t m_totalBytesCopied;

Let's initialize these in the Heap constructor.
Comment 3 Mark Hahnenberg 2013-09-08 17:11:16 PDT
Committed r155317: <http://trac.webkit.org/changeset/155317>