Changeset 87198 in webkit


Ignore:
Timestamp:
May 24, 2011 1:51:52 PM (13 years ago)
Author:
ggaren@apple.com
Message:

2011-05-24 Geoffrey Garen <ggaren@apple.com>

Reviewed by Oliver Hunt.

Let's just have one way to get the system page size, bokay?
https://bugs.webkit.org/show_bug.cgi?id=61384

  • CMakeListsEfl.txt:
  • CMakeListsWinCE.txt:
  • GNUmakefile.list.am:
  • JavaScriptCore.exp:
  • JavaScriptCore.gypi:
  • JavaScriptCore.pro:
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: MarkStack[Platform].cpp is gone completely now, since it only existed to provide a duplicate way to access the system page size.
  • heap/MarkStack.cpp: (JSC::MarkStack::reset):
  • heap/MarkStack.h: (JSC::::MarkStackArray): (JSC::::shrinkAllocation): Use WTF::pageSize.
  • heap/MarkStackPosix.cpp:
  • heap/MarkStackSymbian.cpp:
  • heap/MarkStackWin.cpp: Removed now-empty files.
  • jit/ExecutableAllocator.cpp: (JSC::ExecutableAllocator::reprotectRegion):
  • jit/ExecutableAllocator.h: (JSC::ExecutableAllocator::ExecutableAllocator): (JSC::ExecutablePool::ExecutablePool): (JSC::ExecutablePool::poolAllocate):
  • jit/ExecutableAllocatorFixedVMPool.cpp: Use WTF::pageSize.
  • wscript: Removed now-empty files.
  • wtf/PageBlock.cpp: (WTF::systemPageSize): Integrated questionable Symbian page size rule from ExecutableAllocator, because that seems like what the original author should have done.
Location:
trunk/Source/JavaScriptCore
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/CMakeListsEfl.txt

    r87061 r87198  
    22    jit/ExecutableAllocatorFixedVMPool.cpp
    33    jit/ExecutableAllocator.cpp
    4     heap/MarkStackPosix.cpp
    54)
    65
  • trunk/Source/JavaScriptCore/CMakeListsWinCE.txt

    r83520 r87198  
    11LIST(APPEND JavaScriptCore_SOURCES
    22    jit/ExecutableAllocator.cpp
    3 
    4     heap/MarkStackWin.cpp
    53)
    64
  • trunk/Source/JavaScriptCore/ChangeLog

    r87190 r87198  
     12011-05-24  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Let's just have one way to get the system page size, bokay?
     6        https://bugs.webkit.org/show_bug.cgi?id=61384
     7
     8        * CMakeListsEfl.txt:
     9        * CMakeListsWinCE.txt:
     10        * GNUmakefile.list.am:
     11        * JavaScriptCore.exp:
     12        * JavaScriptCore.gypi:
     13        * JavaScriptCore.pro:
     14        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: MarkStack[Platform].cpp
     15        is gone completely now, since it only existed to provide a duplicate way
     16        to access the system page size.
     17
     18        * heap/MarkStack.cpp:
     19        (JSC::MarkStack::reset):
     20        * heap/MarkStack.h:
     21        (JSC::::MarkStackArray):
     22        (JSC::::shrinkAllocation): Use WTF::pageSize.
     23
     24        * heap/MarkStackPosix.cpp:
     25        * heap/MarkStackSymbian.cpp:
     26        * heap/MarkStackWin.cpp: Removed now-empty files.
     27
     28        * jit/ExecutableAllocator.cpp:
     29        (JSC::ExecutableAllocator::reprotectRegion):
     30        * jit/ExecutableAllocator.h:
     31        (JSC::ExecutableAllocator::ExecutableAllocator):
     32        (JSC::ExecutablePool::ExecutablePool):
     33        (JSC::ExecutablePool::poolAllocate):
     34        * jit/ExecutableAllocatorFixedVMPool.cpp: Use WTF::pageSize.
     35
     36        * wscript: Removed now-empty files.
     37
     38        * wtf/PageBlock.cpp:
     39        (WTF::systemPageSize): Integrated questionable Symbian page size rule
     40        from ExecutableAllocator, because that seems like what the original
     41        author should have done.
     42
    1432011-05-24  Oliver Hunt  <oliver@apple.com>
    244
  • trunk/Source/JavaScriptCore/GNUmakefile.list.am

    r86727 r87198  
    577577if TARGET_WIN32
    578578javascriptcore_sources += \
    579         Source/JavaScriptCore/heap/MarkStackWin.cpp \
    580579        Source/JavaScriptCore/wtf/OSAllocatorWin.cpp
    581580else
    582581javascriptcore_sources += \
    583582        Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp \
    584         Source/JavaScriptCore/heap/MarkStackPosix.cpp \
    585583        Source/JavaScriptCore/wtf/OSAllocatorPosix.cpp
    586584endif
  • trunk/Source/JavaScriptCore/JavaScriptCore.exp

    r86906 r87198  
    324324__ZN3JSC9CodeBlockD1Ev
    325325__ZN3JSC9CodeBlockD2Ev
    326 __ZN3JSC9MarkStack10s_pageSizeE
    327 __ZN3JSC9MarkStack18initializePagesizeEv
    328326__ZN3JSC9Structure21addPropertyTransitionERNS_12JSGlobalDataEPS0_RKNS_10IdentifierEjPNS_6JSCellERm
    329327__ZN3JSC9Structure22materializePropertyMapERNS_12JSGlobalDataE
  • trunk/Source/JavaScriptCore/JavaScriptCore.gypi

    r86727 r87198  
    320320            'heap/MarkStack.cpp',
    321321            'heap/MarkStack.h',
    322             'heap/MarkStackPosix.cpp',
    323             'heap/MarkStackSymbian.cpp',
    324             'heap/MarkStackWin.cpp',
    325322            'heap/MarkedBlock.cpp',
    326323            'heap/MarkedBlock.h',
  • trunk/Source/JavaScriptCore/JavaScriptCore.pro

    r86974 r87198  
    7777    heap/MachineStackMarker.cpp \
    7878    heap/MarkStack.cpp \
    79     heap/MarkStackPosix.cpp \
    80     heap/MarkStackSymbian.cpp \
    81     heap/MarkStackWin.cpp \
    8279    heap/MarkedBlock.cpp \
    8380    heap/MarkedSpace.cpp \
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj

    r83506 r87198  
    19151915                            </File>
    19161916                            <File
    1917                                     RelativePath="..\..\heap\MarkStackWin.cpp"
    1918                                     >
    1919                             </File>
    1920                             <File
    19211917                                    RelativePath="..\..\heap\Heap.cpp"
    19221918                                    >
  • trunk/Source/JavaScriptCore/heap/MarkStack.cpp

    r86294 r87198  
    3737namespace JSC {
    3838
    39 size_t MarkStack::s_pageSize = 0;
    40 
    4139void MarkStack::reset()
    4240{
    43     ASSERT(s_pageSize);
    44     m_values.shrinkAllocation(s_pageSize);
    45     m_markSets.shrinkAllocation(s_pageSize);
     41    m_values.shrinkAllocation(pageSize());
     42    m_markSets.shrinkAllocation(pageSize());
    4643    m_opaqueRoots.clear();
    4744}
  • trunk/Source/JavaScriptCore/heap/MarkStack.h

    r87183 r87198  
    3434#include <wtf/Noncopyable.h>
    3535#include <wtf/OSAllocator.h>
     36#include <wtf/PageBlock.h>
    3637
    3738namespace JSC {
     
    8384
    8485    public:
    85         static size_t pageSize();
    86 
    8786        static void* allocateStack(size_t);
    8887        static void releaseStack(void*, size_t);
     
    109108#endif
    110109
    111         static void initializePagesize();
    112 
    113110        void append(JSValue*);
    114111        void append(JSValue*, size_t count);
     
    118115        void internalAppend(JSValue);
    119116        void visitChildren(JSCell*);
    120 
    121         static size_t s_pageSize;
    122117
    123118        void* m_jsArrayVPtr;
     
    181176    }
    182177
    183     inline size_t MarkStack::pageSize()
    184     {
    185         if (!s_pageSize)
    186             initializePagesize();
    187         return s_pageSize;
    188     }
    189 
    190178    template <typename T> inline MarkStackArray<T>::MarkStackArray()
    191179        : m_top(0)
    192         , m_allocated(MarkStack::pageSize())
     180        , m_allocated(pageSize())
    193181        , m_capacity(m_allocated / sizeof(T))
    194182    {
     
    244232    {
    245233        ASSERT(size <= m_allocated);
    246         ASSERT(0 == (size % MarkStack::pageSize()));
     234        ASSERT(isPageAligned(size));
    247235        if (size == m_allocated)
    248236            return;
  • trunk/Source/JavaScriptCore/heap/MarkStackPosix.cpp

    r83506 r87198  
    1 /*
    2  * Copyright (C) 2009 Apple Inc. All rights reserved.
    3  *
    4  * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions
    6  * are met:
    7  * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright
    10  *    notice, this list of conditions and the following disclaimer in the
    11  *    documentation and/or other materials provided with the distribution.
    12  *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
    14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
    17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    24  */
    25 
    26 #include "config.h"
    27 #include "MarkStack.h"
    28 
    29 #if OS(UNIX) && !OS(SYMBIAN)
    30 
    31 #include <unistd.h>
    32 #include <sys/mman.h>
    33 
    34 namespace JSC {
    35 
    36 void MarkStack::initializePagesize()
    37 {
    38     MarkStack::s_pageSize = getpagesize();
    39 }
    40 
    41 }
    42 
    43 #endif
  • trunk/Source/JavaScriptCore/heap/MarkStackSymbian.cpp

    r83506 r87198  
    1 /*
    2     Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
    3 
    4     This library is free software; you can redistribute it and/or
    5     modify it under the terms of the GNU Library General Public
    6     License as published by the Free Software Foundation; either
    7     version 2 of the License, or (at your option) any later version.
    8 
    9     This library is distributed in the hope that it will be useful,
    10     but WITHOUT ANY WARRANTY; without even the implied warranty of
    11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    12     Library General Public License for more details.
    13 
    14     You should have received a copy of the GNU Library General Public License
    15     along with this library; see the file COPYING.LIB.  If not, write to
    16     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    17     Boston, MA 02110-1301, USA.
    18 */
    19 
    20 #include "config.h"
    21 #include "MarkStack.h"
    22 
    23 #if OS(SYMBIAN)
    24 
    25 #include <e32hal.h>
    26 
    27 namespace JSC {
    28 
    29 void MarkStack::initializePagesize()
    30 {
    31     TInt page_size;
    32     UserHal::PageSizeInBytes(page_size);
    33     MarkStack::s_pageSize = page_size;
    34 }
    35 
    36 }
    37 
    38 #endif
  • trunk/Source/JavaScriptCore/heap/MarkStackWin.cpp

    r83506 r87198  
    1 /*
    2  * Copyright (C) 2009 Apple Inc. All rights reserved.
    3  *
    4  * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions
    6  * are met:
    7  * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright
    10  *    notice, this list of conditions and the following disclaimer in the
    11  *    documentation and/or other materials provided with the distribution.
    12  *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
    14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
    17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    24  */
    25 
    26 #include "config.h"
    27 #include "MarkStack.h"
    28 
    29 #if OS(WINDOWS)
    30 
    31 #include "windows.h"
    32 
    33 namespace JSC {
    34 
    35 void MarkStack::initializePagesize()
    36 {
    37     SYSTEM_INFO system_info;
    38     GetSystemInfo(&system_info);
    39     MarkStack::s_pageSize = system_info.dwPageSize;
    40 }
    41 
    42 }
    43 
    44 #endif
  • trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp

    r77972 r87198  
    3232namespace JSC {
    3333
    34 size_t ExecutableAllocator::pageSize = 0;
    35 
    3634#if ENABLE(EXECUTABLE_ALLOCATOR_DEMAND)
    37 
    38 void ExecutableAllocator::intializePageSize()
    39 {
    40 #if OS(SYMBIAN) && CPU(ARMV5_OR_LOWER)
    41     // The moving memory model (as used in ARMv5 and earlier platforms)
    42     // on Symbian OS limits the number of chunks for each process to 16.
    43     // To mitigate this limitation increase the pagesize to allocate
    44     // fewer, larger chunks. Set the page size to 256 Kb to compensate
    45     // for moving memory model limitation
    46     ExecutableAllocator::pageSize = 256 * 1024;
    47 #else
    48     ExecutableAllocator::pageSize = WTF::pageSize();
    49 #endif
    50 }
    5135
    5236ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t size)
     
    8872void ExecutableAllocator::reprotectRegion(void* start, size_t size, ProtectionSetting setting)
    8973{
    90     if (!pageSize)
    91         intializePageSize();
     74    size_t pageSize = WTF::pageSize();
    9275
    9376    // Calculate the start of the page containing this region,
  • trunk/Source/JavaScriptCore/jit/ExecutableAllocator.h

    r85253 r87198  
    6767#endif
    6868
    69 #define JIT_ALLOCATOR_PAGE_SIZE (ExecutableAllocator::pageSize)
    70 #define JIT_ALLOCATOR_LARGE_ALLOC_SIZE (ExecutableAllocator::pageSize * 4)
     69#define JIT_ALLOCATOR_LARGE_ALLOC_SIZE (pageSize() * 4)
    7170
    7271#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
     
    178177
    179178public:
    180     static size_t pageSize;
    181179    ExecutableAllocator()
    182180    {
    183         if (!pageSize)
    184             intializePageSize();
    185181        if (isValid())
    186182            m_smallAllocationPool = ExecutablePool::create(JIT_ALLOCATOR_LARGE_ALLOC_SIZE);
     
    339335
    340336    RefPtr<ExecutablePool> m_smallAllocationPool;
    341     static void intializePageSize();
    342337};
    343338
    344339inline ExecutablePool::ExecutablePool(size_t n)
    345340{
    346     size_t allocSize = roundUpAllocationSize(n, JIT_ALLOCATOR_PAGE_SIZE);
     341    size_t allocSize = roundUpAllocationSize(n, pageSize());
    347342    Allocation mem = systemAlloc(allocSize);
    348343    m_pools.append(mem);
     
    355350inline void* ExecutablePool::poolAllocate(size_t n)
    356351{
    357     size_t allocSize = roundUpAllocationSize(n, JIT_ALLOCATOR_PAGE_SIZE);
     352    size_t allocSize = roundUpAllocationSize(n, pageSize());
    358353   
    359354    Allocation result = systemAlloc(allocSize);
  • trunk/Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp

    r86906 r87198  
    492492}   
    493493
    494 void ExecutableAllocator::intializePageSize()
    495 {
    496     ExecutableAllocator::pageSize = getpagesize();
    497 }
    498 
    499494bool ExecutableAllocator::isValid() const
    500495{
  • trunk/Source/JavaScriptCore/wscript

    r84994 r87198  
    4343    if Options.options.port == "wx":
    4444        if building_on_win32:
    45             jscore_excludes += ['MarkStackPosix.cpp', 'OSAllocatorPosix.cpp', 'ThreadingPthreads.cpp']
    46             sources += ['heap/MarkStackWin.cpp']
     45            jscore_excludes += ['OSAllocatorPosix.cpp', 'ThreadingPthreads.cpp']
    4746        else:
    4847            jscore_excludes.append('JSStringRefBSTR.cpp')
  • trunk/Source/JavaScriptCore/wtf/PageBlock.cpp

    r74357 r87198  
    6767inline size_t systemPageSize()
    6868{
     69#if CPU(ARMV5_OR_LOWER)
     70    // The moving memory model (as used in ARMv5 and earlier platforms)
     71    // on Symbian OS limits the number of chunks for each process to 16.
     72    // To mitigate this limitation increase the pagesize to allocate
     73    // fewer, larger chunks. Set the page size to 256 Kb to compensate
     74    // for moving memory model limitation
     75    return 256 * 1024;
     76#else
    6977    static TInt page_size = 0;
    7078    UserHal::PageSizeInBytes(page_size);
    7179    return page_size;
     80#endif
    7281}
    7382
Note: See TracChangeset for help on using the changeset viewer.