diff options
Diffstat (limited to 'src/3rdparty')
-rw-r--r-- | src/3rdparty/masm/assembler/ARMAssembler.h | 4 | ||||
-rw-r--r-- | src/3rdparty/masm/assembler/MacroAssemblerARMv7.h | 2 | ||||
-rw-r--r-- | src/3rdparty/masm/stubs/WTFStubs.cpp | 6 | ||||
-rw-r--r-- | src/3rdparty/masm/stubs/WTFStubs.h | 2 | ||||
-rw-r--r-- | src/3rdparty/masm/wtf/DataLog.h | 2 | ||||
-rw-r--r-- | src/3rdparty/masm/wtf/OSAllocator.h | 2 | ||||
-rw-r--r-- | src/3rdparty/masm/wtf/OSAllocatorPosix.cpp | 5 | ||||
-rw-r--r-- | src/3rdparty/masm/wtf/OSAllocatorWin.cpp | 14 | ||||
-rw-r--r-- | src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp | 2 | ||||
-rw-r--r-- | src/3rdparty/masm/wtf/PageAllocation.h | 16 | ||||
-rw-r--r-- | src/3rdparty/masm/wtf/PageAllocationAligned.cpp | 9 | ||||
-rw-r--r-- | src/3rdparty/masm/wtf/PageBlock.h | 7 | ||||
-rw-r--r-- | src/3rdparty/masm/wtf/PageReservation.h | 14 | ||||
-rw-r--r-- | src/3rdparty/masm/yarr/YarrJIT.cpp | 8 |
14 files changed, 53 insertions, 40 deletions
diff --git a/src/3rdparty/masm/assembler/ARMAssembler.h b/src/3rdparty/masm/assembler/ARMAssembler.h index 3888226b21..16cc25d4db 100644 --- a/src/3rdparty/masm/assembler/ARMAssembler.h +++ b/src/3rdparty/masm/assembler/ARMAssembler.h @@ -41,10 +41,10 @@ namespace JSC { r0 = 0, r1, r2, - r3, S0 = r3, /* Same as thumb assembler. */ + r3, r4, r5, - r6, + r6, S0 = r6, r7, r8, r9, diff --git a/src/3rdparty/masm/assembler/MacroAssemblerARMv7.h b/src/3rdparty/masm/assembler/MacroAssemblerARMv7.h index 15e427bbff..85cd6c27b9 100644 --- a/src/3rdparty/masm/assembler/MacroAssemblerARMv7.h +++ b/src/3rdparty/masm/assembler/MacroAssemblerARMv7.h @@ -40,7 +40,7 @@ protected: // the YarrJIT needs know about addressTempRegister in order to push // - dTR is likely used more than aTR, and we'll get better instruction // encoding if it's in the low 8 registers. static const RegisterID dataTempRegister = ARMRegisters::ip; - static const RegisterID addressTempRegister = ARMRegisters::r10; + static const RegisterID addressTempRegister = ARMRegisters::r6; static const ARMRegisters::FPDoubleRegisterID fpTempRegister = ARMRegisters::d7; inline ARMRegisters::FPSingleRegisterID fpTempRegisterAsSingle() { return ARMRegisters::asSingle(fpTempRegister); } diff --git a/src/3rdparty/masm/stubs/WTFStubs.cpp b/src/3rdparty/masm/stubs/WTFStubs.cpp index 7e6ba9b81d..2650f1d36a 100644 --- a/src/3rdparty/masm/stubs/WTFStubs.cpp +++ b/src/3rdparty/masm/stubs/WTFStubs.cpp @@ -60,9 +60,9 @@ uint32_t cryptographicallyRandomNumber() return 0; } -static PrintStream* s_dataFile; +static FilePrintStream* s_dataFile; -void setDataFile(PrintStream *ps) +void setDataFile(FilePrintStream *ps) { delete s_dataFile; s_dataFile = ps; @@ -74,7 +74,7 @@ void setDataFile(FILE* f) s_dataFile = new FilePrintStream(f, FilePrintStream::Borrow); } -PrintStream& dataFile() +FilePrintStream& dataFile() { if (!s_dataFile) s_dataFile = new FilePrintStream(stderr, FilePrintStream::Borrow); diff --git a/src/3rdparty/masm/stubs/WTFStubs.h b/src/3rdparty/masm/stubs/WTFStubs.h index 397aed5f16..2b3236553a 100644 --- a/src/3rdparty/masm/stubs/WTFStubs.h +++ b/src/3rdparty/masm/stubs/WTFStubs.h @@ -36,7 +36,7 @@ namespace WTF { void setDataFile(FILE* f); -void setDataFile(class PrintStream *); +void setDataFile(class FilePrintStream *); } diff --git a/src/3rdparty/masm/wtf/DataLog.h b/src/3rdparty/masm/wtf/DataLog.h index 2b3df09970..0bd8efe727 100644 --- a/src/3rdparty/masm/wtf/DataLog.h +++ b/src/3rdparty/masm/wtf/DataLog.h @@ -34,7 +34,7 @@ namespace WTF { -WTF_EXPORT_PRIVATE PrintStream &dataFile(); +WTF_EXPORT_PRIVATE FilePrintStream& dataFile(); WTF_EXPORT_PRIVATE void dataLogFV(const char* format, va_list) WTF_ATTRIBUTE_PRINTF(1, 0); WTF_EXPORT_PRIVATE void dataLogF(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2); diff --git a/src/3rdparty/masm/wtf/OSAllocator.h b/src/3rdparty/masm/wtf/OSAllocator.h index a12a467497..494f8bc3c7 100644 --- a/src/3rdparty/masm/wtf/OSAllocator.h +++ b/src/3rdparty/masm/wtf/OSAllocator.h @@ -45,7 +45,7 @@ public: // These methods are symmetric; reserveUncommitted allocates VM in an uncommitted state, // releaseDecommitted should be called on a region of VM allocated by a single reservation, // the memory must all currently be in a decommitted state. - static void* reserveUncommitted(size_t, Usage = UnknownUsage, bool writable = true, bool executable = false, bool includesGuardPages = false); + static void* reserveUncommitted(size_t, Usage = UnknownUsage, bool writable = true, bool executable = false); WTF_EXPORT_PRIVATE static void releaseDecommitted(void*, size_t); // These methods are symmetric; they commit or decommit a region of VM (uncommitted VM should diff --git a/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp b/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp index d8c8e0378f..f52c22f7fa 100644 --- a/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp +++ b/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp @@ -38,7 +38,7 @@ namespace WTF { -void* OSAllocator::reserveUncommitted(size_t bytes, Usage usage, bool writable, bool executable, bool includesGuardPages) +void* OSAllocator::reserveUncommitted(size_t bytes, Usage usage, bool writable, bool executable) { #if OS(QNX) // Reserve memory with PROT_NONE and MAP_LAZY so it isn't committed now. @@ -49,14 +49,13 @@ void* OSAllocator::reserveUncommitted(size_t bytes, Usage usage, bool writable, UNUSED_PARAM(usage); UNUSED_PARAM(writable); UNUSED_PARAM(executable); - UNUSED_PARAM(includesGuardPages); void* result = mmap(0, bytes, PROT_NONE, MAP_NORESERVE | MAP_PRIVATE | MAP_ANON, -1, 0); if (result == MAP_FAILED) CRASH(); madvise(result, bytes, MADV_DONTNEED); #else - void* result = reserveAndCommit(bytes, usage, writable, executable, includesGuardPages); + void* result = reserveAndCommit(bytes, usage, writable, executable); #if HAVE(MADV_FREE_REUSE) // To support the "reserve then commit" model, we have to initially decommit. while (madvise(result, bytes, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { } diff --git a/src/3rdparty/masm/wtf/OSAllocatorWin.cpp b/src/3rdparty/masm/wtf/OSAllocatorWin.cpp index f95a4841c6..259fc67324 100644 --- a/src/3rdparty/masm/wtf/OSAllocatorWin.cpp +++ b/src/3rdparty/masm/wtf/OSAllocatorWin.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "OSAllocator.h" +#include "PageBlock.h" #if OS(WINDOWS) @@ -40,7 +41,7 @@ static inline DWORD protection(bool writable, bool executable) (writable ? PAGE_READWRITE : PAGE_READONLY); } -void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool writable, bool executable, bool) +void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool writable, bool executable) { void* result = VirtualAlloc(0, bytes, MEM_RESERVE, protection(writable, executable)); if (!result) @@ -48,11 +49,20 @@ void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool writable, bool e return result; } -void* OSAllocator::reserveAndCommit(size_t bytes, Usage, bool writable, bool executable, bool) +void* OSAllocator::reserveAndCommit(size_t bytes, Usage, bool writable, bool executable, + bool includesGuardPages) { void* result = VirtualAlloc(0, bytes, MEM_RESERVE | MEM_COMMIT, protection(writable, executable)); if (!result) CRASH(); + if (includesGuardPages) { + size_t guardSize = pageSize(); + DWORD oldProtect; + if (!VirtualProtect(result, guardSize, protection(false, false), &oldProtect) || + !VirtualProtect(static_cast<char*>(result) + bytes - guardSize, guardSize, + protection(false, false), &oldProtect)) + CRASH(); + } return result; } diff --git a/src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp b/src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp index 7ed9f539e5..9b8f5bf46b 100644 --- a/src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp +++ b/src/3rdparty/masm/wtf/OSAllocatorWinRT.cpp @@ -33,7 +33,7 @@ namespace WTF { -void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool, bool, bool) +void* OSAllocator::reserveUncommitted(size_t bytes, Usage, bool, bool) { void* result = _aligned_malloc(bytes, 16); if (!result) diff --git a/src/3rdparty/masm/wtf/PageAllocation.h b/src/3rdparty/masm/wtf/PageAllocation.h index 18d31880c0..db4e230e03 100644 --- a/src/3rdparty/masm/wtf/PageAllocation.h +++ b/src/3rdparty/masm/wtf/PageAllocation.h @@ -86,11 +86,17 @@ public: // control warning when a client tries to use operator bool exposed above via "using PageBlock::operator bool". operator bool() const { return PageBlock::operator bool(); } #endif + bool operator<(const PageAllocation &b) { return base() < b.base(); } - static PageAllocation allocate(size_t size, OSAllocator::Usage usage = OSAllocator::UnknownUsage, bool writable = true, bool executable = false) + static PageAllocation allocate(size_t size, + OSAllocator::Usage usage = OSAllocator::UnknownUsage, + bool writable = true, bool executable = false, + bool includesGuardPages = false) { ASSERT(isPageAligned(size)); - return PageAllocation(OSAllocator::reserveAndCommit(size, usage, writable, executable), size); + return PageAllocation(OSAllocator::reserveAndCommit(size, usage, writable, executable, + includesGuardPages), size, + includesGuardPages); } void deallocate() @@ -103,12 +109,12 @@ public: ASSERT(tmp); ASSERT(!*this); - OSAllocator::decommitAndRelease(tmp.base(), tmp.size()); + OSAllocator::decommitAndRelease(tmp.realBase(), tmp.realSize()); } private: - PageAllocation(void* base, size_t size) - : PageBlock(base, size, false) + PageAllocation(void* base, size_t size, bool includesGuardPages = false) + : PageBlock(base, size, includesGuardPages) { } }; diff --git a/src/3rdparty/masm/wtf/PageAllocationAligned.cpp b/src/3rdparty/masm/wtf/PageAllocationAligned.cpp index bdb976b1b7..90c2fd61db 100644 --- a/src/3rdparty/masm/wtf/PageAllocationAligned.cpp +++ b/src/3rdparty/masm/wtf/PageAllocationAligned.cpp @@ -52,7 +52,7 @@ PageAllocationAligned PageAllocationAligned::allocate(size_t size, size_t alignm // Resererve with suffcient additional VM to correctly align. size_t reservationSize = size + alignmentDelta; - void* reservationBase = OSAllocator::reserveUncommitted(reservationSize, usage, writable, false); + void* reservationBase = OSAllocator::reserveUncommitted(reservationSize, usage, writable); // Select an aligned region within the reservation and commit. void* alignedBase = reinterpret_cast<uintptr_t>(reservationBase) & alignmentMask @@ -75,10 +75,11 @@ void PageAllocationAligned::deallocate() ASSERT(!*this); #if OS(DARWIN) - vm_deallocate(current_task(), reinterpret_cast<vm_address_t>(tmp.base()), tmp.size()); + vm_deallocate(current_task(), reinterpret_cast<vm_address_t>(tmp.realBase()), tmp.realSize()); #else - ASSERT(tmp.m_reservation.contains(tmp.base(), tmp.size())); - OSAllocator::decommitAndRelease(tmp.m_reservation.base(), tmp.m_reservation.size(), tmp.base(), tmp.size()); + ASSERT(tmp.m_reservation.contains(tmp.realBase(), tmp.realSize())); + OSAllocator::decommitAndRelease(tmp.m_reservation.realBase(), tmp.m_reservation.realSize(), + tmp.realBase(), tmp.realSize()); #endif } diff --git a/src/3rdparty/masm/wtf/PageBlock.h b/src/3rdparty/masm/wtf/PageBlock.h index 56e5570178..4d408e1c91 100644 --- a/src/3rdparty/masm/wtf/PageBlock.h +++ b/src/3rdparty/masm/wtf/PageBlock.h @@ -40,8 +40,13 @@ public: PageBlock(const PageBlock&); PageBlock(void*, size_t, bool hasGuardPages); + void* realBase() const { return m_realBase; } void* base() const { return m_base; } - size_t size() const { return m_size; } + size_t size() const + { + return m_size - 2 * (static_cast<char *>(m_base) - static_cast<char *>(m_realBase)); + } + size_t realSize() const { return m_size; } operator bool() const { return !!m_realBase; } diff --git a/src/3rdparty/masm/wtf/PageReservation.h b/src/3rdparty/masm/wtf/PageReservation.h index 77783ebcc4..74a136168c 100644 --- a/src/3rdparty/masm/wtf/PageReservation.h +++ b/src/3rdparty/masm/wtf/PageReservation.h @@ -104,13 +104,7 @@ public: static PageReservation reserve(size_t size, OSAllocator::Usage usage = OSAllocator::UnknownUsage, bool writable = true, bool executable = false) { ASSERT(isPageAligned(size)); - return PageReservation(OSAllocator::reserveUncommitted(size, usage, writable, executable), size, writable, executable, false); - } - - static PageReservation reserveWithGuardPages(size_t size, OSAllocator::Usage usage = OSAllocator::UnknownUsage, bool writable = true, bool executable = false) - { - ASSERT(isPageAligned(size)); - return PageReservation(OSAllocator::reserveUncommitted(size + pageSize() * 2, usage, writable, executable, true), size, writable, executable, true); + return PageReservation(OSAllocator::reserveUncommitted(size, usage, writable, executable), size, writable, executable); } void deallocate() @@ -125,12 +119,12 @@ public: ASSERT(tmp); ASSERT(!*this); - OSAllocator::releaseDecommitted(tmp.base(), tmp.size()); + OSAllocator::releaseDecommitted(tmp.realBase(), tmp.realSize()); } private: - PageReservation(void* base, size_t size, bool writable, bool executable, bool hasGuardPages) - : PageBlock(base, size, hasGuardPages) + PageReservation(void* base, size_t size, bool writable, bool executable) + : PageBlock(base, size, false) , m_committed(0) , m_writable(writable) , m_executable(executable) diff --git a/src/3rdparty/masm/yarr/YarrJIT.cpp b/src/3rdparty/masm/yarr/YarrJIT.cpp index 94a72a57c7..ce18b3ab4f 100644 --- a/src/3rdparty/masm/yarr/YarrJIT.cpp +++ b/src/3rdparty/masm/yarr/YarrJIT.cpp @@ -46,10 +46,10 @@ class YarrGenerator : private MacroAssembler { static const RegisterID input = ARMRegisters::r0; static const RegisterID index = ARMRegisters::r1; static const RegisterID length = ARMRegisters::r2; - static const RegisterID output = ARMRegisters::r4; + static const RegisterID output = ARMRegisters::r3; - static const RegisterID regT0 = ARMRegisters::r5; - static const RegisterID regT1 = ARMRegisters::r6; + static const RegisterID regT0 = ARMRegisters::r4; + static const RegisterID regT1 = ARMRegisters::r5; static const RegisterID returnRegister = ARMRegisters::r0; static const RegisterID returnRegister2 = ARMRegisters::r1; @@ -2561,7 +2561,6 @@ class YarrGenerator : private MacroAssembler { #if CPU(ARM_TRADITIONAL) push(ARMRegisters::r8); // scratch register #endif - push(addressTempRegister); if (compileMode == IncludeSubpatterns) move(ARMRegisters::r3, output); #elif CPU(SH4) @@ -2589,7 +2588,6 @@ class YarrGenerator : private MacroAssembler { pop(X86Registers::ebx); pop(X86Registers::ebp); #elif CPU(ARM) - pop(addressTempRegister); #if CPU(ARM_TRADITIONAL) pop(ARMRegisters::r8); // scratch register #endif |