diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-08-30 12:26:26 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-08-30 12:26:26 +0200 |
commit | f214aa5dbe2c4aa3e543aecc2b6ad96d7786862e (patch) | |
tree | dcf1a9a2d351b6ab9364f0cbd06a341a8935a706 /js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h | |
parent | 0bc2511432fe0cdcae92aae71576b6eb9bad7f5c (diff) | |
download | UXP-f214aa5dbe2c4aa3e543aecc2b6ad96d7786862e.tar UXP-f214aa5dbe2c4aa3e543aecc2b6ad96d7786862e.tar.gz UXP-f214aa5dbe2c4aa3e543aecc2b6ad96d7786862e.tar.lz UXP-f214aa5dbe2c4aa3e543aecc2b6ad96d7786862e.tar.xz UXP-f214aa5dbe2c4aa3e543aecc2b6ad96d7786862e.zip |
Revert "Bug 1444668 - Avoid allocating large AssemblerBuffers. r=luke, r=bbouvier, a=RyanVM"
This reverts commit 9472136272f01b858412f2d9d7854d2daa82496f.
Diffstat (limited to 'js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h')
-rw-r--r-- | js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h b/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h index fe678fc7d..8cb557784 100644 --- a/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h +++ b/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h @@ -68,33 +68,6 @@ namespace js { namespace jit { - // AllocPolicy for AssemblerBuffer. OOMs when trying to allocate more than - // MaxCodeBytesPerProcess bytes. Use private inheritance to make sure we - // explicitly have to expose SystemAllocPolicy methods. - class AssemblerBufferAllocPolicy : private SystemAllocPolicy - { - public: - using SystemAllocPolicy::checkSimulatedOOM; - using SystemAllocPolicy::reportAllocOverflow; - using SystemAllocPolicy::free_; - - template <typename T> T* pod_realloc(T* p, size_t oldSize, size_t newSize) { - static_assert(sizeof(T) == 1, - "AssemblerBufferAllocPolicy should only be used with byte vectors"); - MOZ_ASSERT(oldSize <= MaxCodeBytesPerProcess); - if (MOZ_UNLIKELY(newSize > MaxCodeBytesPerProcess)) - return nullptr; - return SystemAllocPolicy::pod_realloc<T>(p, oldSize, newSize); - } - template <typename T> T* pod_malloc(size_t numElems) { - static_assert(sizeof(T) == 1, - "AssemblerBufferAllocPolicy should only be used with byte vectors"); - if (MOZ_UNLIKELY(numElems > MaxCodeBytesPerProcess)) - return nullptr; - return SystemAllocPolicy::pod_malloc<T>(numElems); - } - }; - class AssemblerBuffer { template<size_t size, typename T> @@ -120,9 +93,6 @@ namespace jit { void ensureSpace(size_t space) { - // This should only be called with small |space| values to ensure - // we don't overflow below. - MOZ_ASSERT(space <= 16); if (MOZ_UNLIKELY(!m_buffer.reserve(m_buffer.length() + space))) oomDetected(); } @@ -198,7 +168,7 @@ namespace jit { m_buffer.clear(); } - PageProtectingVector<unsigned char, 256, AssemblerBufferAllocPolicy> m_buffer; + PageProtectingVector<unsigned char, 256, SystemAllocPolicy> m_buffer; bool m_oom; }; |