[Webkit-unassigned] [Bug 102828] r134080 causes heap problem on linux systems where PAGESIZE != 4096

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 18 10:19:40 PST 2013


https://bugs.webkit.org/show_bug.cgi?id=102828


Mark Hahnenberg <mhahnenberg at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #183468|review?                     |review-
               Flag|                            |




--- Comment #32 from Mark Hahnenberg <mhahnenberg at apple.com>  2013-01-18 10:21:28 PST ---
(From update of attachment 183468)
View in context: https://bugs.webkit.org/attachment.cgi?id=183468&action=review

Additionally, there's a function named "sizeFromCapacity" in MarkStackSegment. That doesn't appear to be called from anywhere, so let's remove it while we're here.

> Source/JavaScriptCore/heap/MarkStack.cpp:47
> +#if COMPILER(CLANG)

Let's not ignore the warnings.

> Source/JavaScriptCore/heap/MarkStack.cpp:52
> +const size_t MarkStackArray::s_segmentCapacity = MarkStackSegment::capacityFromSize(MarkStackSegment::blockSize);

If we could use C++11, we could just add constexpr to capacityFromSize and call it a day. Unfortunately we can't, so we have to use some template magic.

Instead of using the old capacityFromSize static function, let's rework the code a little bit. From some brief grepping, it appears that this is the only client of the capacityFromSize function. So in order to get a compile-time constant value, we can instead use a template. Something along the lines of:

template <size_t size> struct CapacityFromSize {
    static const size_t value = // body of current capacityFromSize
};

Stick that somewhere private in MarkStackArray and grab the ::value when defining s_segmentCapacity.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list