Changeset 56370 in webkit


Ignore:
Timestamp:
Mar 22, 2010 5:28:28 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-03-22 Siddharth Mathur <siddharth.mathur@nokia.com>

Reviewed by Laszlo Gombos.

[Symbian] More efficient aligned memory allocation for JSC Collector
https://bugs.webkit.org/show_bug.cgi?id=34350

  • runtime/Collector.cpp: Reduced port-specific code and added private data member (JSC::Heap::Heap): (JSC::Heap::~Heap): (JSC::Heap::destroy): (JSC::Heap::allocateBlock): (JSC::Heap::freeBlockPtr):
  • runtime/Collector.h: Added private data member
  • wtf/symbian: Added.
  • wtf/symbian/BlockAllocatorSymbian.cpp: Added. (WTF::AlignedBlockAllocator::AlignedBlockAllocator): Helper class to allocate aligned blocks more efficiently as required by Collector (WTF::AlignedBlockAllocator::alloc): (WTF::AlignedBlockAllocator::free): (WTF::AlignedBlockAllocator::destroy): (WTF::AlignedBlockAllocator::~AlignedBlockAllocator):
  • wtf/symbian/BlockAllocatorSymbian.h: Added.
Location:
trunk/JavaScriptCore
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r56348 r56370  
     12010-03-22  Siddharth Mathur  <siddharth.mathur@nokia.com>
     2
     3        Reviewed by Laszlo Gombos.
     4
     5        [Symbian] More efficient aligned memory allocation for JSC Collector
     6        https://bugs.webkit.org/show_bug.cgi?id=34350
     7
     8        * JavaScriptCore.pri: Added 2 new Symbian source files and HAL linkage
     9
     10        * runtime/Collector.cpp: Reduced port-specific code and added private data member
     11        (JSC::Heap::Heap):
     12        (JSC::Heap::~Heap):
     13        (JSC::Heap::destroy):
     14        (JSC::Heap::allocateBlock):
     15        (JSC::Heap::freeBlockPtr):
     16
     17        * runtime/Collector.h: Added private data member
     18
     19        * wtf/symbian: Added.
     20        * wtf/symbian/BlockAllocatorSymbian.cpp: Added.
     21        (WTF::AlignedBlockAllocator::AlignedBlockAllocator): Helper class to allocate
     22        aligned blocks more efficiently as required by Collector
     23        (WTF::AlignedBlockAllocator::alloc):
     24        (WTF::AlignedBlockAllocator::free):
     25        (WTF::AlignedBlockAllocator::destroy):
     26        (WTF::AlignedBlockAllocator::~AlignedBlockAllocator):
     27        * wtf/symbian/BlockAllocatorSymbian.h: Added.
     28
    1292010-03-22  Geoffrey Garen  <ggaren@apple.com>
    230
  • trunk/JavaScriptCore/JavaScriptCore.pri

    r55367 r56370  
    1717    # Need to guarantee this comes before system includes of /epoc32/include
    1818    MMP_RULES += "USERINCLUDE ../JavaScriptCore/profiler"
     19    LIBS += -lhal
    1920}
    2021
     
    3334    $$PWD/runtime \
    3435    $$PWD/wtf \
     36    $$PWD/wtf/symbian \
    3537    $$PWD/wtf/unicode \
    3638    $$PWD/yarr \
     
    213215    wtf/RandomNumber.cpp \
    214216    wtf/RefCountedLeakCounter.cpp \
     217    wtf/symbian/BlockAllocatorSymbian.cpp \
    215218    wtf/ThreadingNone.cpp \
    216219    wtf/Threading.cpp \
  • trunk/JavaScriptCore/runtime/Collector.cpp

    r55453 r56370  
    5454#include <mach/vm_map.h>
    5555
    56 #elif OS(SYMBIAN)
    57 #include <e32std.h>
    58 #include <e32cmn.h>
    59 #include <unistd.h>
    60 
    6156#elif OS(WINDOWS)
    6257
     
    109104// a PIC branch in Mach-O binaries, see <rdar://problem/5971391>.
    110105#define MIN_ARRAY_SIZE (static_cast<size_t>(14))
    111 
    112 #if OS(SYMBIAN)
    113 const size_t MAX_NUM_BLOCKS = 256; // Max size of collector heap set to 16 MB
    114 static RHeap* userChunk = 0;
    115 #endif
    116106
    117107#if ENABLE(JSC_MULTIPLE_THREADS)
     
    147137#endif
    148138    , m_globalData(globalData)
     139#if OS(SYMBIAN)
     140    , m_blockallocator(JSCCOLLECTOR_VIRTUALMEM_RESERVATION, BLOCK_SIZE)
     141#endif
    149142{
    150143    ASSERT(globalData);
    151    
    152 #if OS(SYMBIAN)
    153     // Symbian OpenC supports mmap but currently not the MAP_ANON flag.
    154     // Using fastMalloc() does not properly align blocks on 64k boundaries
    155     // and previous implementation was flawed/incomplete.
    156     // UserHeap::ChunkHeap allows allocation of continuous memory and specification
    157     // of alignment value for (symbian) cells within that heap.
    158     //
    159     // Clarification and mapping of terminology:
    160     // RHeap (created by UserHeap::ChunkHeap below) is continuos memory chunk,
    161     // which can dynamically grow up to 8 MB,
    162     // that holds all CollectorBlocks of this session (static).
    163     // Each symbian cell within RHeap maps to a 64kb aligned CollectorBlock.
    164     // JSCell objects are maintained as usual within CollectorBlocks.
    165     if (!userChunk) {
    166         userChunk = UserHeap::ChunkHeap(0, 0, MAX_NUM_BLOCKS * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE);
    167         if (!userChunk)
    168             CRASH();
    169     }
    170 #endif // OS(SYMBIAN)
    171    
    172144    memset(&m_heap, 0, sizeof(CollectorHeap));
    173145    allocateBlock();
     
    212184    }
    213185#endif
    214 
     186#if OS(SYMBIAN)
     187    m_blockallocator.destroy();
     188#endif
    215189    m_globalData = 0;
    216190}
     
    222196    vm_map(current_task(), &address, BLOCK_SIZE, BLOCK_OFFSET_MASK, VM_FLAGS_ANYWHERE | VM_TAG_FOR_COLLECTOR_MEMORY, MEMORY_OBJECT_NULL, 0, FALSE, VM_PROT_DEFAULT, VM_PROT_DEFAULT, VM_INHERIT_DEFAULT);
    223197#elif OS(SYMBIAN)
    224     // Allocate a 64 kb aligned CollectorBlock
    225     unsigned char* mask = reinterpret_cast<unsigned char*>(userChunk->Alloc(BLOCK_SIZE));
    226     if (!mask)
     198    void* address = m_blockallocator.alloc(); 
     199    if (!address)
    227200        CRASH();
    228     uintptr_t address = reinterpret_cast<uintptr_t>(mask);
    229201#elif OS(WINCE)
    230202    void* address = VirtualAlloc(NULL, BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
     
    317289    vm_deallocate(current_task(), reinterpret_cast<vm_address_t>(block), BLOCK_SIZE);
    318290#elif OS(SYMBIAN)
    319     userChunk->Free(reinterpret_cast<TAny*>(block));
     291    m_blockallocator.free(reinterpret_cast<void*>(block));
    320292#elif OS(WINCE)
    321293    VirtualFree(block, 0, MEM_RELEASE);
  • trunk/JavaScriptCore/runtime/Collector.h

    r56085 r56370  
    3434#if ENABLE(JSC_MULTIPLE_THREADS)
    3535#include <pthread.h>
     36#endif
     37
     38#if OS(SYMBIAN)
     39#include <wtf/symbian/BlockAllocatorSymbian.h>
    3640#endif
    3741
     
    169173#endif
    170174
     175#if OS(SYMBIAN)
     176        // Allocates collector blocks with correct alignment
     177        WTF::AlignedBlockAllocator m_blockallocator;
     178#endif
     179       
    171180        JSGlobalData* m_globalData;
    172181    };
Note: See TracChangeset for help on using the changeset viewer.