2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser 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.
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 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
23 #include "ExecutableAllocator.h"
25 #if ENABLE_ASSEMBLER && WTF_PLATFORM_SYMBIAN
30 // Set the page size to 256 Kb to compensate for moving memory model limitation
31 const size_t MOVING_MEM_PAGE_SIZE = 256 * 1024;
35 void ExecutableAllocator::intializePageSize()
37 #if WTF_CPU_ARMV5_OR_LOWER
38 // The moving memory model (as used in ARMv5 and earlier platforms)
39 // on Symbian OS limits the number of chunks for each process to 16.
40 // To mitigate this limitation increase the pagesize to
41 // allocate less of larger chunks.
42 ExecutableAllocator::pageSize = MOVING_MEM_PAGE_SIZE;
45 UserHal::PageSizeInBytes(page_size);
46 ExecutableAllocator::pageSize = page_size;
50 ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n)
52 RChunk* codeChunk = new RChunk();
54 TInt errorCode = codeChunk->CreateLocalCode(n, n);
56 char* allocation = reinterpret_cast<char*>(codeChunk->Base());
57 ExecutablePool::Allocation alloc = { allocation, n, codeChunk };
61 void ExecutablePool::systemRelease(const ExecutablePool::Allocation& alloc)
67 #if ENABLE_ASSEMBLER_WX_EXCLUSIVE
68 #error "ASSEMBLER_WX_EXCLUSIVE not yet suported on this platform."
73 #endif // HAVE(ASSEMBLER)