Changeset 56370 in webkit
- Timestamp:
- Mar 22, 2010 5:28:28 PM (14 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r56348 r56370 1 2010-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 1 29 2010-03-22 Geoffrey Garen <ggaren@apple.com> 2 30 -
trunk/JavaScriptCore/JavaScriptCore.pri
r55367 r56370 17 17 # Need to guarantee this comes before system includes of /epoc32/include 18 18 MMP_RULES += "USERINCLUDE ../JavaScriptCore/profiler" 19 LIBS += -lhal 19 20 } 20 21 … … 33 34 $$PWD/runtime \ 34 35 $$PWD/wtf \ 36 $$PWD/wtf/symbian \ 35 37 $$PWD/wtf/unicode \ 36 38 $$PWD/yarr \ … … 213 215 wtf/RandomNumber.cpp \ 214 216 wtf/RefCountedLeakCounter.cpp \ 217 wtf/symbian/BlockAllocatorSymbian.cpp \ 215 218 wtf/ThreadingNone.cpp \ 216 219 wtf/Threading.cpp \ -
trunk/JavaScriptCore/runtime/Collector.cpp
r55453 r56370 54 54 #include <mach/vm_map.h> 55 55 56 #elif OS(SYMBIAN)57 #include <e32std.h>58 #include <e32cmn.h>59 #include <unistd.h>60 61 56 #elif OS(WINDOWS) 62 57 … … 109 104 // a PIC branch in Mach-O binaries, see <rdar://problem/5971391>. 110 105 #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 MB114 static RHeap* userChunk = 0;115 #endif116 106 117 107 #if ENABLE(JSC_MULTIPLE_THREADS) … … 147 137 #endif 148 138 , m_globalData(globalData) 139 #if OS(SYMBIAN) 140 , m_blockallocator(JSCCOLLECTOR_VIRTUALMEM_RESERVATION, BLOCK_SIZE) 141 #endif 149 142 { 150 143 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 boundaries155 // and previous implementation was flawed/incomplete.156 // UserHeap::ChunkHeap allows allocation of continuous memory and specification157 // 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 172 144 memset(&m_heap, 0, sizeof(CollectorHeap)); 173 145 allocateBlock(); … … 212 184 } 213 185 #endif 214 186 #if OS(SYMBIAN) 187 m_blockallocator.destroy(); 188 #endif 215 189 m_globalData = 0; 216 190 } … … 222 196 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); 223 197 #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) 227 200 CRASH(); 228 uintptr_t address = reinterpret_cast<uintptr_t>(mask);229 201 #elif OS(WINCE) 230 202 void* address = VirtualAlloc(NULL, BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); … … 317 289 vm_deallocate(current_task(), reinterpret_cast<vm_address_t>(block), BLOCK_SIZE); 318 290 #elif OS(SYMBIAN) 319 userChunk->Free(reinterpret_cast<TAny*>(block));291 m_blockallocator.free(reinterpret_cast<void*>(block)); 320 292 #elif OS(WINCE) 321 293 VirtualFree(block, 0, MEM_RELEASE); -
trunk/JavaScriptCore/runtime/Collector.h
r56085 r56370 34 34 #if ENABLE(JSC_MULTIPLE_THREADS) 35 35 #include <pthread.h> 36 #endif 37 38 #if OS(SYMBIAN) 39 #include <wtf/symbian/BlockAllocatorSymbian.h> 36 40 #endif 37 41 … … 169 173 #endif 170 174 175 #if OS(SYMBIAN) 176 // Allocates collector blocks with correct alignment 177 WTF::AlignedBlockAllocator m_blockallocator; 178 #endif 179 171 180 JSGlobalData* m_globalData; 172 181 };
Note: See TracChangeset
for help on using the changeset viewer.