]>
Commit | Line | Data |
---|---|---|
f9bf01c6 A |
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 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. | |
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 | * Lesser General Public License for more details. | |
13 | * | |
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 | |
18 | * | |
19 | */ | |
20 | ||
21 | #include "config.h" | |
22 | ||
23 | #include "ExecutableAllocator.h" | |
24 | ||
25 | #if ENABLE(ASSEMBLER) && OS(SYMBIAN) | |
26 | ||
27 | #include <e32hal.h> | |
28 | #include <e32std.h> | |
29 | ||
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; | |
32 | ||
33 | namespace JSC { | |
34 | ||
35 | void ExecutableAllocator::intializePageSize() | |
36 | { | |
37 | #if 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; | |
43 | #else | |
44 | TInt page_size; | |
45 | UserHal::PageSizeInBytes(page_size); | |
46 | ExecutableAllocator::pageSize = page_size; | |
47 | #endif | |
48 | } | |
49 | ||
50 | ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t n) | |
51 | { | |
52 | RChunk* codeChunk = new RChunk(); | |
53 | ||
54 | TInt errorCode = codeChunk->CreateLocalCode(n, n); | |
55 | ||
56 | char* allocation = reinterpret_cast<char*>(codeChunk->Base()); | |
57 | if (!allocation) | |
58 | CRASH(); | |
59 | ExecutablePool::Allocation alloc = { allocation, n, codeChunk }; | |
60 | return alloc; | |
61 | } | |
62 | ||
63 | void ExecutablePool::systemRelease(const ExecutablePool::Allocation& alloc) | |
64 | { | |
65 | alloc.chunk->Close(); | |
66 | delete alloc.chunk; | |
67 | } | |
68 | ||
69 | #if ENABLE(ASSEMBLER_WX_EXCLUSIVE) | |
70 | #error "ASSEMBLER_WX_EXCLUSIVE not yet suported on this platform." | |
71 | #endif | |
72 | ||
73 | } | |
74 | ||
75 | #endif // HAVE(ASSEMBLER) |