]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - jit/ExecutableAllocator.cpp
JavaScriptCore-903.tar.gz
[apple/javascriptcore.git] / jit / ExecutableAllocator.cpp
index 5e10e863d49f6ddd899a33709c0540dfa94aa125..35531d92ed08db71ee0bb6ff0cb005b4bbd089bf 100644 (file)
@@ -33,8 +33,59 @@ namespace JSC {
 
 size_t ExecutableAllocator::pageSize = 0;
 
+#if ENABLE(EXECUTABLE_ALLOCATOR_DEMAND)
+
+void ExecutableAllocator::intializePageSize()
+{
+#if OS(SYMBIAN) && CPU(ARMV5_OR_LOWER)
+    // The moving memory model (as used in ARMv5 and earlier platforms)
+    // on Symbian OS limits the number of chunks for each process to 16. 
+    // To mitigate this limitation increase the pagesize to allocate
+    // fewer, larger chunks. Set the page size to 256 Kb to compensate
+    // for moving memory model limitation
+    ExecutableAllocator::pageSize = 256 * 1024;
+#else
+    ExecutableAllocator::pageSize = WTF::pageSize();
+#endif
+}
+
+ExecutablePool::Allocation ExecutablePool::systemAlloc(size_t size)
+{
+    PageAllocation allocation = PageAllocation::allocate(size, OSAllocator::JSJITCodePages, EXECUTABLE_POOL_WRITABLE, true);
+    if (!allocation)
+        CRASH();
+    return allocation;
+}
+
+void ExecutablePool::systemRelease(ExecutablePool::Allocation& allocation)
+{
+    allocation.deallocate();
+}
+
+bool ExecutableAllocator::isValid() const
+{
+    return true;
+}
+    
+bool ExecutableAllocator::underMemoryPressure()
+{
+    return false;
+}
+    
+size_t ExecutableAllocator::committedByteCount()
+{
+    return 0;
+} 
+
+#endif
+
 #if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
-void ExecutableAllocator::reprotectRegion(void* start, size_t size, ProtectionSeting setting)
+
+#if OS(WINDOWS) || OS(SYMBIAN)
+#error "ASSEMBLER_WX_EXCLUSIVE not yet suported on this platform."
+#endif
+
+void ExecutableAllocator::reprotectRegion(void* start, size_t size, ProtectionSetting setting)
 {
     if (!pageSize)
         intializePageSize();
@@ -52,9 +103,11 @@ void ExecutableAllocator::reprotectRegion(void* start, size_t size, ProtectionSe
 
     mprotect(pageStart, size, (setting == Writable) ? PROTECTION_FLAGS_RW : PROTECTION_FLAGS_RX);
 }
+
 #endif
 
 #if CPU(ARM_TRADITIONAL) && OS(LINUX) && COMPILER(RVCT)
+
 __asm void ExecutableAllocator::cacheFlush(void* code, size_t size)
 {
     ARM
@@ -67,6 +120,7 @@ __asm void ExecutableAllocator::cacheFlush(void* code, size_t size)
     pop {r7}
     bx lr
 }
+
 #endif
 
 }