summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/jit/ExecutableAllocator.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/jit/ExecutableAllocator.h')
-rw-r--r--Source/JavaScriptCore/jit/ExecutableAllocator.h32
1 files changed, 26 insertions, 6 deletions
diff --git a/Source/JavaScriptCore/jit/ExecutableAllocator.h b/Source/JavaScriptCore/jit/ExecutableAllocator.h
index 9294f5e44..01be7c1aa 100644
--- a/Source/JavaScriptCore/jit/ExecutableAllocator.h
+++ b/Source/JavaScriptCore/jit/ExecutableAllocator.h
@@ -32,6 +32,7 @@
#include <wtf/MetaAllocatorHandle.h>
#include <wtf/MetaAllocator.h>
#include <wtf/PageAllocation.h>
+#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
@@ -54,6 +55,12 @@
#include <unistd.h>
#endif
+#if OS(WINCE)
+// From pkfuncs.h (private header file from the Platform Builder)
+#define CACHE_SYNC_ALL 0x07F
+extern "C" __declspec(dllimport) void CacheRangeFlush(LPVOID pAddr, DWORD dwLength, DWORD dwFlags);
+#endif
+
#define JIT_ALLOCATOR_LARGE_ALLOC_SIZE (pageSize() * 4)
#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
@@ -67,9 +74,25 @@
namespace JSC {
class VM;
+void releaseExecutableMemory(VM&);
static const unsigned jitAllocationGranule = 32;
+inline size_t roundUpAllocationSize(size_t request, size_t granularity)
+{
+ RELEASE_ASSERT((std::numeric_limits<size_t>::max() - granularity) > request);
+
+ // Round up to next page boundary
+ size_t size = request + (granularity - 1);
+ size = size & ~(granularity - 1);
+ ASSERT(size >= request);
+ return size;
+}
+
+}
+
+namespace JSC {
+
typedef WTF::MetaAllocatorHandle ExecutableMemoryHandle;
#if ENABLE(ASSEMBLER)
@@ -79,16 +102,13 @@ class DemandExecutableAllocator;
#endif
#if ENABLE(EXECUTABLE_ALLOCATOR_FIXED)
-#if CPU(ARM)
+#if CPU(ARM) || CPU(ARM64)
static const size_t fixedExecutableMemoryPoolSize = 16 * 1024 * 1024;
-#elif CPU(ARM64)
-static const size_t fixedExecutableMemoryPoolSize = 32 * 1024 * 1024;
#elif CPU(X86_64)
static const size_t fixedExecutableMemoryPoolSize = 1024 * 1024 * 1024;
#else
static const size_t fixedExecutableMemoryPoolSize = 32 * 1024 * 1024;
#endif
-static const double executablePoolReservationFraction = 0.25;
extern uintptr_t startOfFixedExecutableMemoryPool;
#endif
@@ -114,7 +134,7 @@ public:
static void dumpProfile() { }
#endif
- RefPtr<ExecutableMemoryHandle> allocate(VM&, size_t sizeInBytes, void* ownerUID, JITCompilationEffort);
+ PassRefPtr<ExecutableMemoryHandle> allocate(VM&, size_t sizeInBytes, void* ownerUID, JITCompilationEffort);
#if ENABLE(ASSEMBLER_WX_EXCLUSIVE)
static void makeWritable(void* start, size_t size)
@@ -139,7 +159,7 @@ private:
static void reprotectRegion(void*, size_t, ProtectionSetting);
#if ENABLE(EXECUTABLE_ALLOCATOR_DEMAND)
// We create a MetaAllocator for each JS global object.
- std::unique_ptr<DemandExecutableAllocator> m_allocator;
+ OwnPtr<DemandExecutableAllocator> m_allocator;
DemandExecutableAllocator* allocator() { return m_allocator.get(); }
#endif
#endif