Comment 9 for bug 1391420

Revision history for this message
In , Mark-lam (mark-lam) wrote :

Comment on attachment 266795
Make commitSize at least as big as the page size

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

commitSIze is only needed when "#if !ENABLE(JIT)". Let's put it in the appropriate sections.

> Source/JavaScriptCore/interpreter/JSStack.cpp:46
> static StaticLock stackStatisticsMutex;
> #endif // !ENABLE(JIT)
>
> +static size_t commitSize;

Move the commitSize declaration just below committedBytesCount above.

> Source/JavaScriptCore/interpreter/JSStack.cpp:58
> + commitSize = std::max(16 * 1024, getpagesize());
> +
> #if !ENABLE(JIT)

Move this initialization below the #if !ENABLE(JIT).

Also, it may not matter much but the commitSize value should only be set once, not every time we construct a new JSStack. Perhaps it would be better to have static function and use that instead wherever you use commitSize currently in JSStack.cpp:

static size_t commitSize()
{
    static size_t size = 0;
    if (!size)
        size = std::max(16 * 1024, getpagesize());
    return size;
}