Bug 728623: disable jitcode address randomization on Win64, r=dvander, a=akeybl
authorDavid Mandelin <dmandelin@mozilla.com>
Wed, 14 Mar 2012 17:36:34 -0700
changeset 91845 ce052bf33131e1819ee6e05ead445c8827626b95
parent 91844 d42b8ffc7ba0cce98127e8efe1a50fe35bbf08f3
child 91846 245b87d73a55dfd06d979ef83bf0ac650afefeda
push idunknown
push userunknown
push dateunknown
reviewersdvander, akeybl
bugs728623
milestone13.0a2
Bug 728623: disable jitcode address randomization on Win64, r=dvander, a=akeybl
js/src/assembler/jit/ExecutableAllocatorWin.cpp
--- a/js/src/assembler/jit/ExecutableAllocatorWin.cpp
+++ b/js/src/assembler/jit/ExecutableAllocatorWin.cpp
@@ -98,21 +98,25 @@ RandomizeIsBroken()
     // races if runtimes are created from multiple threads.
     static int result = RandomizeIsBrokenImpl();
     return !!result;
 }
 
 ExecutablePool::Allocation ExecutableAllocator::systemAlloc(size_t n)
 {
     void *allocation = NULL;
+    // Randomization disabled to avoid a performance fault on x64 builds.
+    // See bug 728623.
+#ifndef JS_CPU_X64
     if (allocBehavior == AllocationCanRandomize && !RandomizeIsBroken()) {
         void *randomAddress = computeRandomAllocationAddress();
         allocation = VirtualAlloc(randomAddress, n, MEM_COMMIT | MEM_RESERVE,
                                   PAGE_EXECUTE_READWRITE);
     }
+#endif
     if (!allocation)
         allocation = VirtualAlloc(0, n, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
     ExecutablePool::Allocation alloc = { reinterpret_cast<char*>(allocation), n };
     return alloc;
 }
 
 void ExecutableAllocator::systemRelease(const ExecutablePool::Allocation& alloc)
 {