Unreviewed, rolling out r195141.
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Jan 2016 20:16:01 +0000 (20:16 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Jan 2016 20:16:01 +0000 (20:16 +0000)
Seems to cause crashes on iOS9 64bit

Reverted changeset:

"Fragmentation-free allocator for timeless and/or coupled
allocations."
https://bugs.webkit.org/show_bug.cgi?id=152696
http://trac.webkit.org/changeset/195141

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195304 268f45cc-cd09-0410-ab3c-d52691b4dbfc

25 files changed:
Source/WTF/ChangeLog
Source/WTF/WTF.vcxproj/WTF.vcxproj
Source/WTF/WTF.vcxproj/WTF.vcxproj.filters
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/BumpArena.cpp [deleted file]
Source/WTF/wtf/BumpArena.h [deleted file]
Source/WTF/wtf/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/css/CSSGrammar.y.in
Source/WebCore/css/CSSKeyframesRule.h
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSParserValues.cpp
Source/WebCore/css/CSSParserValues.h
Source/WebCore/css/CSSSelectorList.cpp
Source/WebCore/css/CSSSelectorList.h
Source/WebCore/css/StyleProperties.cpp
Source/WebCore/css/StyleProperties.h
Source/WebCore/css/StyleRule.cpp
Source/WebCore/css/StyleRule.h
Source/WebCore/css/StyleSheetContents.cpp
Source/WebCore/css/StyleSheetContents.h
Source/WebCore/dom/SelectorQuery.cpp
Source/WebCore/dom/SelectorQuery.h
Source/WebCore/svg/SVGFontFaceElement.cpp

index 4aec536..450bc3c 100644 (file)
@@ -1,3 +1,16 @@
+2016-01-19  Chris Dumez  <cdumez@apple.com>
+
+        Unreviewed, rolling out r195141.
+
+        Seems to cause crashes on iOS9 64bit
+
+        Reverted changeset:
+
+        "Fragmentation-free allocator for timeless and/or coupled
+        allocations."
+        https://bugs.webkit.org/show_bug.cgi?id=152696
+        http://trac.webkit.org/changeset/195141
+
 2016-01-19  Enrica Casucci  <enrica@apple.com>
 
         Add support for DataDetectors in WK (iOS).
index d0d6ad1..1d9c944 100644 (file)
@@ -53,7 +53,6 @@
   <ItemGroup>
     <ClCompile Include="..\wtf\Assertions.cpp" />
     <ClCompile Include="..\wtf\BitVector.cpp" />
-    <ClCompile Include="..\wtf\BumpArena.cpp" />
     <ClCompile Include="..\wtf\CompilationThread.cpp" />
     <ClCompile Include="..\wtf\CryptographicUtilities.cpp" />
     <ClCompile Include="..\wtf\CryptographicallyRandomNumber.cpp" />
index b547bb8..5fb1841 100644 (file)
     <ClCompile Include="..\wtf\BitVector.cpp">
       <Filter>wtf</Filter>
     </ClCompile>
-    <ClCompile Include="..\wtf\BumpArena.cpp">
-      <Filter>wtf</Filter>
-    </ClCompile>
     <ClCompile Include="..\wtf\CryptographicUtilities.cpp">
       <Filter>wtf</Filter>
     </ClCompile>
index 4fc0097..283c612 100644 (file)
                A8A47486151A825B004123FF /* WTFThreadData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4737A151A825B004123FF /* WTFThreadData.cpp */; };
                A8A47487151A825B004123FF /* WTFThreadData.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4737B151A825B004123FF /* WTFThreadData.h */; };
                A8A4748C151A8264004123FF /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4748B151A8264004123FF /* config.h */; };
-               AD9C50C11C3C1D5D005FBF1E /* BumpArena.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD9C50BF1C3C1D5D005FBF1E /* BumpArena.cpp */; };
-               AD9C50C21C3C1D5D005FBF1E /* BumpArena.h in Headers */ = {isa = PBXBuildFile; fileRef = AD9C50C01C3C1D5D005FBF1E /* BumpArena.h */; settings = {ATTRIBUTES = (Private, ); }; };
                B38FD7BD168953E80065C969 /* FeatureDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = B38FD7BC168953E80065C969 /* FeatureDefines.h */; };
                C4F8A93719C65EB400B2B15D /* Stopwatch.h in Headers */ = {isa = PBXBuildFile; fileRef = C4F8A93619C65EB400B2B15D /* Stopwatch.h */; };
                CD5497AC15857D0300B5BC30 /* MediaTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5497AA15857D0300B5BC30 /* MediaTime.cpp */; };
                A8A4737A151A825B004123FF /* WTFThreadData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WTFThreadData.cpp; sourceTree = "<group>"; };
                A8A4737B151A825B004123FF /* WTFThreadData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTFThreadData.h; sourceTree = "<group>"; };
                A8A4748B151A8264004123FF /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
-               AD9C50BF1C3C1D5D005FBF1E /* BumpArena.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BumpArena.cpp; sourceTree = "<group>"; };
-               AD9C50C01C3C1D5D005FBF1E /* BumpArena.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BumpArena.h; sourceTree = "<group>"; };
                B38FD7BC168953E80065C969 /* FeatureDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FeatureDefines.h; sourceTree = "<group>"; };
                C4F8A93619C65EB400B2B15D /* Stopwatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Stopwatch.h; sourceTree = "<group>"; };
                CD5497AA15857D0300B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTime.cpp; sourceTree = "<group>"; };
                                A8A47265151A825A004123FF /* BloomFilter.h */,
                                0F93274A1C17F4B700CF6564 /* Box.h */,
                                0F4570441BE834410062A629 /* BubbleSort.h */,
-                               AD9C50BF1C3C1D5D005FBF1E /* BumpArena.cpp */,
-                               AD9C50C01C3C1D5D005FBF1E /* BumpArena.h */,
                                A8A47267151A825A004123FF /* BumpPointerAllocator.h */,
                                EB95E1EF161A72410089A2F5 /* ByteOrder.h */,
                                A8A4726A151A825A004123FF /* CheckedArithmetic.h */,
                                A8A4742C151A825B004123FF /* StringExtras.h in Headers */,
                                A8A4743F151A825B004123FF /* StringHash.h in Headers */,
                                A748745417A0BDAE00FA04CB /* StringHashDumpContext.h in Headers */,
-                               AD9C50C21C3C1D5D005FBF1E /* BumpArena.h in Headers */,
                                A8A47441151A825B004123FF /* StringImpl.h in Headers */,
                                A8A47442151A825B004123FF /* StringOperators.h in Headers */,
                                0FDDBFA81666DFA300C55FEF /* StringPrintStream.h in Headers */,
                                A5BA15FA182435A600A82E69 /* AtomicStringImplCF.cpp in Sources */,
                                9BC70F05176C379D00101DEC /* AtomicStringTable.cpp in Sources */,
                                1469419D16EAB10A0024E146 /* AutodrainedPoolMac.mm in Sources */,
-                               AD9C50C11C3C1D5D005FBF1E /* BumpArena.cpp in Sources */,
                                8134013815B092FD001FF0B8 /* Base64.cpp in Sources */,
                                A8A473A8151A825B004123FF /* bignum-dtoa.cc in Sources */,
                                A8A473AA151A825B004123FF /* bignum.cc in Sources */,
diff --git a/Source/WTF/wtf/BumpArena.cpp b/Source/WTF/wtf/BumpArena.cpp
deleted file mode 100644 (file)
index f7a18c6..0000000
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include "config.h"
-#include "BumpArena.h"
-
-#include <wtf/HashSet.h>
-#include <wtf/NeverDestroyed.h>
-#include <wtf/Vector.h>
-
-#if OS(UNIX)
-#define USE_BUMPARENA 1
-#include <sys/mman.h>
-#else
-#define USE_BUMPARENA 0
-#endif
-
-#if OS(DARWIN)
-#include <mach/vm_statistics.h>
-// FIXME: Figure out which VM tag to use.
-#define BUMPARENA_VM_TAG VM_MAKE_TAG(VM_MEMORY_APPLICATION_SPECIFIC_1)
-#else
-#define BUMPARENA_VM_TAG -1
-#endif
-
-#if DEBUG_BUMPARENA
-#include <notify.h>
-#endif
-
-namespace WTF {
-
-#if USE(BUMPARENA)
-
-static const size_t blockSize = 4096;
-static const size_t blockMask = ~(blockSize - 1);
-
-class BumpArena::Block {
-public:
-    static constexpr size_t capacity() { return blockSize - sizeof(Block); }
-
-    static RefPtr<Block> create(BumpArena&);
-    ~Block();
-
-    void ref();
-    void deref();
-
-    BumpArena& arena() { return m_arena.get(); }
-
-    static Block& blockFor(const void*);
-
-    char* payloadStart() { return reinterpret_cast<char*>(&m_data); }
-
-#if DEBUG_BUMPARENA
-    void dump();
-#endif
-
-private:
-    friend class BumpArena;
-    explicit Block(BumpArena&);
-
-    Ref<BumpArena> m_arena;
-
-    unsigned m_refCount { 1 };
-
-#if DEBUG_BUMPARENA
-    size_t m_bytesAvailable { 0 };
-#endif
-
-#if COMPILER(MSVC)
-#pragma warning(push)
-#pragma warning(disable: 4200) // Disable "zero-sized array in struct/union" warning
-#endif
-    char* m_data[0];
-#if COMPILER(MSVC)
-#pragma warning(pop)
-#endif
-};
-
-#if DEBUG_BUMPARENA
-static HashSet<BumpArena*>& arenas()
-{
-    static NeverDestroyed<HashSet<BumpArena*>> set;
-    return set;
-}
-#endif
-
-BumpArena::Block::Block(BumpArena& arena)
-    : m_arena(arena)
-{
-#if DEBUG_BUMPARENA
-    m_arena->m_liveBlocks.add(this);
-#endif
-}
-
-BumpArena::Block::~Block()
-{
-#if DEBUG_BUMPARENA
-    m_arena->m_liveBlocks.remove(this);
-#endif
-}
-
-void BumpArena::Block::ref()
-{
-    ++m_refCount;
-}
-
-struct BlockAllocator {
-    static const size_t vmSize = 128 * MB;
-
-    BlockAllocator();
-
-    void* allocateBlock();
-    void deallocateBlock(void*);
-
-    bool isAllocation(const void* p) const;
-
-    char* vmBase;
-    char* vmEnd;
-    char* nextBlock;
-    Vector<void*> freeList;
-};
-
-BlockAllocator::BlockAllocator()
-{
-    vmBase = reinterpret_cast<char*>(mmap(0, vmSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, BUMPARENA_VM_TAG, 0));
-    RELEASE_ASSERT(vmBase != MAP_FAILED);
-    vmEnd = vmBase + vmSize;
-    nextBlock = reinterpret_cast<char*>(roundUpToMultipleOf<blockSize>(reinterpret_cast<uintptr_t>(vmBase)));
-}
-
-bool BlockAllocator::isAllocation(const void* p) const
-{
-    return p >= vmBase && p <= vmEnd;
-}
-
-static BlockAllocator& blockAllocator()
-{
-    static NeverDestroyed<BlockAllocator> allocator;
-    return allocator;
-}
-
-void* BlockAllocator::allocateBlock()
-{
-    if (!freeList.isEmpty()) {
-        void* block = freeList.takeLast();
-#if OS(DARWIN)
-        while (madvise(block, blockSize, MADV_FREE_REUSE) == -1 && errno == EAGAIN) { }
-#else
-        while (madvise(block, blockSize, MADV_NORMAL) == -1 && errno == EAGAIN) { }
-#endif
-        return block;
-    }
-    char* newNextBlock = nextBlock + blockSize;
-    if (newNextBlock >= vmEnd)
-        return nullptr;
-    void* block = nextBlock;
-    nextBlock += blockSize;
-    return block;
-}
-
-void BlockAllocator::deallocateBlock(void* block)
-{
-#if OS(DARWIN)
-    while (madvise(block, blockSize, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN) { }
-#else
-    while (madvise(block, blockSize, MADV_DONTNEED) == -1 && errno == EAGAIN) { }
-#endif
-    freeList.append(block);
-}
-
-void BumpArena::Block::deref()
-{
-    --m_refCount;
-
-    if (!m_refCount) {
-        this->~Block();
-        blockAllocator().deallocateBlock(this);
-    } else if (m_refCount == 1 && m_arena->m_currentBlock == this) {
-        m_arena->m_currentPayloadEnd = nullptr;
-        m_arena->m_currentRemaining = 0;
-        // Break the ref-cycle between BumpArena and this Block.
-        m_arena->m_currentBlock = nullptr;
-    }
-}
-
-RefPtr<BumpArena::Block> BumpArena::Block::create(BumpArena& arena)
-{
-    void* allocation = blockAllocator().allocateBlock();
-    if (!allocation)
-        return nullptr;
-    return adoptRef(*new (NotNull, allocation) Block(arena));
-}
-
-#if DEBUG_BUMPARENA
-void BumpArena::Block::dump()
-{
-    WTFLogAlways("  %10s %p - %3u, %8lu bytes available\n", m_arena->m_currentBlock == this ? "[current]" : "", this, m_refCount, m_bytesAvailable);
-}
-
-void BumpArena::dump()
-{
-    WTFLogAlways("BumpArena{%p}", this);
-    WTFLogAlways("  refCount: %u\n", refCount());
-    WTFLogAlways("  Blocks (%d)\n", m_liveBlocks.size());
-    for (Block* block : m_liveBlocks) {
-        if (block == m_currentBlock)
-            continue;
-        block->dump();
-    }
-    if (m_currentBlock)
-        m_currentBlock->dump();
-}
-#endif
-
-Ref<BumpArena> BumpArena::create()
-{
-    return adoptRef(*new BumpArena);
-}
-
-BumpArena::BumpArena()
-{
-#if DEBUG_BUMPARENA
-    arenas().add(this);
-    static std::once_flag once;
-    std::call_once(once, [] {
-        int d;
-        notify_register_dispatch("com.apple.WebKit.BumpArena.Dump", &d, dispatch_get_main_queue(), ^(int) {
-            for (BumpArena* arena : arenas())
-                arena->dump();
-        });
-    });
-#endif
-}
-
-BumpArena::~BumpArena()
-{
-#if DEBUG_BUMPARENA
-    arenas().remove(this);
-#endif
-}
-
-void* BumpArena::allocateSlow(size_t size)
-{
-    if (size > Block::capacity())
-        return fastMalloc(size);
-
-    m_currentBlock = Block::create(*this);
-    if (!m_currentBlock) {
-        m_currentPayloadEnd = nullptr;
-        m_currentRemaining = 0;
-        return fastMalloc(size);
-    }
-
-    m_currentPayloadEnd = m_currentBlock->payloadStart() + Block::capacity();
-    m_currentRemaining = Block::capacity() - size;
-#if DEBUG_BUMPARENA
-    m_currentBlock->m_bytesAvailable = m_currentRemaining;
-#endif
-    m_currentBlock->ref();
-    return m_currentPayloadEnd - m_currentRemaining - size;
-}
-
-void* BumpArena::allocate(size_t size)
-{
-    size = roundUpToMultipleOf<8>(size);
-    size_t currentRemaining = m_currentRemaining;
-    if (size > currentRemaining)
-        return allocateSlow(size);
-    currentRemaining -= size;
-    m_currentRemaining = currentRemaining;
-#if DEBUG_BUMPARENA
-    m_currentBlock->m_bytesAvailable = m_currentRemaining;
-#endif
-    m_currentBlock->ref();
-    return m_currentPayloadEnd - currentRemaining - size;
-}
-
-void BumpArena::deallocate(void* p)
-{
-    if (!p)
-        return;
-    if (blockAllocator().isAllocation(p))
-        Block::blockFor(p).deref();
-    else
-        fastFree(p);
-}
-
-BumpArena::Block& BumpArena::Block::blockFor(const void* p)
-{
-    return *reinterpret_cast<Block*>(reinterpret_cast<uintptr_t>(p) & blockMask);
-}
-
-BumpArena* BumpArena::arenaFor(const void* p)
-{
-    ASSERT(p);
-    if (!blockAllocator().isAllocation(p))
-        return nullptr;
-    return &Block::blockFor(p).arena();
-}
-
-void* BumpArena::allocate(BumpArena* arena, size_t size)
-{
-    if (arena)
-        return arena->allocate(size);
-    return fastMalloc(size);
-}
-
-#else // !USE(BUMPARENA) below
-
-class BumpArena::Block {
-public:
-    void ref() { }
-    void deref() { }
-};
-
-Ref<BumpArena> BumpArena::create()
-{
-    return adoptRef(*new BumpArena);
-}
-
-BumpArena::BumpArena()
-{
-}
-
-BumpArena::~BumpArena()
-{
-}
-
-BumpArena* BumpArena::arenaFor(const void*)
-{
-    return nullptr;
-}
-
-void* BumpArena::allocate(BumpArena*, size_t size)
-{
-    return fastMalloc(size);
-}
-
-void BumpArena::deallocate(void* p)
-{
-    fastFree(p);
-}
-
-#endif
-
-} // namespace WTF
diff --git a/Source/WTF/wtf/BumpArena.h b/Source/WTF/wtf/BumpArena.h
deleted file mode 100644 (file)
index 6cafdb5..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef BumpArena_h
-#define BumpArena_h
-
-#include <wtf/HashSet.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-#define DEBUG_BUMPARENA 0
-
-namespace WTF {
-
-class BumpArena : public RefCounted<BumpArena> {
-public:
-    WTF_EXPORT_PRIVATE static Ref<BumpArena> create();
-    WTF_EXPORT_PRIVATE ~BumpArena();
-
-    WTF_EXPORT_PRIVATE static void* allocate(BumpArena*, size_t);
-    WTF_EXPORT_PRIVATE static void deallocate(void*);
-
-    WTF_EXPORT_PRIVATE static BumpArena* arenaFor(const void*);
-
-private:
-    BumpArena();
-    void* allocate(size_t);
-    void* allocateSlow(size_t);
-
-    class Block;
-    friend class Block;
-    RefPtr<Block> m_currentBlock;
-
-    char* m_currentPayloadEnd { nullptr };
-    size_t m_currentRemaining { 0 };
-
-#if DEBUG_BUMPARENA
-    void dump();
-    HashSet<Block*> m_liveBlocks;
-#endif
-};
-
-#define WTF_MAKE_BUMPARENA_ALLOCATED \
-public: \
-    void* operator new(size_t, void* p) { return p; } \
-    void* operator new[](size_t, void* p) { return p; } \
-    \
-    void* operator new(size_t size) \
-    { \
-        return ::WTF::BumpArena::allocate(nullptr, size); \
-    } \
-    void* operator new(size_t size, BumpArena* arena) \
-    { \
-        return ::WTF::BumpArena::allocate(arena, size); \
-    } \
-    void operator delete(void* p) \
-    { \
-        ::WTF::BumpArena::deallocate(p); \
-    } \
-    \
-    void* operator new[](size_t size) \
-    { \
-        return ::WTF::BumpArena::allocate(nullptr, size); \
-    } \
-    \
-    void operator delete[](void* p) \
-    { \
-        ::WTF::BumpArena::deallocate(p); \
-    } \
-    void* operator new(size_t, NotNullTag, void* location) \
-    { \
-        ASSERT(location); \
-        return location; \
-    } \
-private: \
-typedef int __thisIsHereToForceASemicolonAfterThisMacro
-
-} // namespace WTF
-
-using WTF::BumpArena;
-
-#endif
index 2a8b44a..0942486 100644 (file)
@@ -7,7 +7,6 @@ set(WTF_HEADERS
     BitVector.h
     Bitmap.h
     BubbleSort.h
-    BumpArena.h
     BumpPointerAllocator.h
     ByteOrder.h
     CompilationThread.h
@@ -155,7 +154,6 @@ set(WTF_SOURCES
     Assertions.cpp
     Atomics.cpp
     BitVector.cpp
-    BumpArena.cpp
     CompilationThread.cpp
     CryptographicUtilities.cpp
     CryptographicallyRandomNumber.cpp
index 17bda06..192d058 100644 (file)
@@ -1,3 +1,16 @@
+2016-01-19  Chris Dumez  <cdumez@apple.com>
+
+        Unreviewed, rolling out r195141.
+
+        Seems to cause crashes on iOS9 64bit
+
+        Reverted changeset:
+
+        "Fragmentation-free allocator for timeless and/or coupled
+        allocations."
+        https://bugs.webkit.org/show_bug.cgi?id=152696
+        http://trac.webkit.org/changeset/195141
+
 2015-12-07  Jer Noble  <jer.noble@apple.com>
 
         [EME] Correctly report errors when generating key requests from AVContentKeySession.
index e057015..944cb7a 100644 (file)
@@ -403,7 +403,7 @@ webkit_selector:
     WEBKIT_SELECTOR_SYM '{' maybe_space selector_list '}' {
         if ($4) {
             if (parser->m_selectorListForParseSelector)
-                parser->m_selectorListForParseSelector->adoptSelectorVector(parser->arena(), *$4);
+                parser->m_selectorListForParseSelector->adoptSelectorVector(*$4);
             parser->recycleSelectorVector(std::unique_ptr<Vector<std::unique_ptr<CSSParserSelector>>>($4));
         }
     }
@@ -1353,7 +1353,7 @@ pseudo:
 #if ENABLE_VIDEO_TRACK
     // used by ::cue(:past/:future)
     | ':' ':' CUEFUNCTION maybe_space simple_selector_list maybe_space ')' {
-        $$ = CSSParserSelector::parsePseudoElementCueFunctionSelector(parser->arena(), $3, $5);
+        $$ = CSSParserSelector::parsePseudoElementCueFunctionSelector($3, $5);
     }
 #endif
     // use by :-webkit-any.
@@ -1366,7 +1366,7 @@ pseudo:
         if ($4) {
             auto selector = std::make_unique<CSSParserSelector>();
             selector->setMatch(CSSSelector::PseudoClass);
-            selector->adoptSelectorVector(parser->arena(), *std::unique_ptr<Vector<std::unique_ptr<CSSParserSelector>>>($4));
+            selector->adoptSelectorVector(*std::unique_ptr<Vector<std::unique_ptr<CSSParserSelector>>>($4));
             selector->setPseudoClassValue($2);
             if (selector->pseudoClassType() == CSSSelector::PseudoClassAny)
                 $$ = selector.release();
@@ -1377,7 +1377,7 @@ pseudo:
         if ($4) {
             auto selector = std::make_unique<CSSParserSelector>();
             selector->setMatch(CSSSelector::PseudoClass);
-            selector->adoptSelectorVector(parser->arena(), *std::unique_ptr<Vector<std::unique_ptr<CSSParserSelector>>>($4));
+            selector->adoptSelectorVector(*std::unique_ptr<Vector<std::unique_ptr<CSSParserSelector>>>($4));
             selector->setPseudoClassValue($2);
             if (selector->pseudoClassType() == CSSSelector::PseudoClassMatches)
                 $$ = selector.release();
@@ -1427,7 +1427,7 @@ pseudo:
             selector->setArgument($4);
             selector->setPseudoClassValue($2);
             if (ending)
-                selector->adoptSelectorVector(parser->arena(), *ending);
+                selector->adoptSelectorVector(*ending);
             CSSSelector::PseudoClassType pseudoClassType = selector->pseudoClassType();
             if (pseudoClassType == CSSSelector::PseudoClassNthChild || pseudoClassType == CSSSelector::PseudoClassNthLastChild)
                 $$ = selector.release();
@@ -1442,7 +1442,7 @@ pseudo:
             selector->setArgument(AtomicString::number($4 * $5));
             selector->setPseudoClassValue($2);
             if (ending)
-                selector->adoptSelectorVector(parser->arena(), *ending);
+                selector->adoptSelectorVector(*ending);
             CSSSelector::PseudoClassType pseudoClassType = selector->pseudoClassType();
             if (pseudoClassType == CSSSelector::PseudoClassNthChild || pseudoClassType == CSSSelector::PseudoClassNthLastChild)
                 $$ = selector.release();
@@ -1457,7 +1457,7 @@ pseudo:
             selector->setArgument($4);
             selector->setPseudoClassValue($2);
             if (ending)
-               selector->adoptSelectorVector(parser->arena(), *ending);
+               selector->adoptSelectorVector(*ending);
             CSSSelector::PseudoClassType pseudoClassType = selector->pseudoClassType();
             if (pseudoClassType == CSSSelector::PseudoClassNthChild || pseudoClassType == CSSSelector::PseudoClassNthLastChild)
                 $$ = selector.release();
@@ -1511,7 +1511,7 @@ pseudo:
                 auto selector = std::make_unique<CSSParserSelector>();
                 selector->setMatch(CSSSelector::PseudoClass);
                 selector->setPseudoClassValue($2);
-                selector->adoptSelectorVector(parser->arena(), *list);
+                selector->adoptSelectorVector(*list);
                 if (selector->pseudoClassType() == CSSSelector::PseudoClassNot)
                     $$ = selector.release();
             }
index 89f1c04..865bbed 100644 (file)
@@ -40,7 +40,7 @@ class CSSKeyframeRule;
 
 class StyleRuleKeyframes : public StyleRuleBase {
 public:
-    static Ref<StyleRuleKeyframes> create(BumpArena* arena) { return adoptRef(*new (arena) StyleRuleKeyframes); }
+    static Ref<StyleRuleKeyframes> create() { return adoptRef(*new StyleRuleKeyframes()); }
     
     ~StyleRuleKeyframes();
     
index 13410e1..d28696c 100644 (file)
@@ -1644,7 +1644,7 @@ Ref<ImmutableStyleProperties> CSSParser::createStyleProperties()
     if (unusedEntries)
         results.remove(0, unusedEntries);
 
-    return ImmutableStyleProperties::create(arena(), results.data(), results.size(), m_context.mode);
+    return ImmutableStyleProperties::create(results.data(), results.size(), m_context.mode);
 }
 
 void CSSParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important, bool implicit)
@@ -12701,9 +12701,9 @@ RefPtr<StyleRuleBase> CSSParser::createMediaRule(PassRefPtr<MediaQuerySet> media
     if (!media) {
         // To comply with w3c test suite expectation, create an empty media query
         // even when it is syntactically incorrect.
-        rule = StyleRuleMedia::create(arena(), MediaQuerySet::create(), emptyRules);
+        rule = StyleRuleMedia::create(MediaQuerySet::create(), emptyRules);
     } else
-        rule = StyleRuleMedia::create(arena(), media, rules ? *rules : emptyRules);
+        rule = StyleRuleMedia::create(media, rules ? *rules : emptyRules);
     processAndAddNewRuleToSourceTreeIfNeeded();
     return rule;
 }
@@ -12729,10 +12729,10 @@ RefPtr<StyleRuleBase> CSSParser::createSupportsRule(bool conditionIsSupported, R
         conditionText = String(m_dataStart16.get() + conditionOffset, conditionLength).stripWhiteSpace();
 
     if (rules)
-        rule = StyleRuleSupports::create(arena(), conditionText, conditionIsSupported, *rules);
+        rule = StyleRuleSupports::create(conditionText, conditionIsSupported, *rules);
     else {
         RuleList emptyRules;
-        rule = StyleRuleSupports::create(arena(), conditionText, conditionIsSupported, emptyRules);
+        rule = StyleRuleSupports::create(conditionText, conditionIsSupported, emptyRules);
     }
 
     processAndAddNewRuleToSourceTreeIfNeeded();
@@ -12841,7 +12841,7 @@ RefPtr<StyleRuleKeyframes> CSSParser::createKeyframesRule(const String& name, st
 {
     std::unique_ptr<Vector<RefPtr<StyleKeyframe>>> keyframes = WTFMove(popKeyframes);
     m_allowImportRules = m_allowNamespaceDeclarations = false;
-    RefPtr<StyleRuleKeyframes> rule = StyleRuleKeyframes::create(arena());
+    RefPtr<StyleRuleKeyframes> rule = StyleRuleKeyframes::create();
     for (size_t i = 0; i < keyframes->size(); ++i)
         rule->parserAppendKeyframe(keyframes->at(i));
     rule->setName(name);
@@ -12849,24 +12849,14 @@ RefPtr<StyleRuleKeyframes> CSSParser::createKeyframesRule(const String& name, st
     return rule;
 }
 
-void CSSParser::setArena(BumpArena& arena)
-{
-    m_arena = &arena;
-}
-
-BumpArena* CSSParser::arena()
-{
-    return m_arena.get();
-}
-
 RefPtr<StyleRuleBase> CSSParser::createStyleRule(Vector<std::unique_ptr<CSSParserSelector>>* selectors)
 {
     RefPtr<StyleRule> rule;
     if (selectors) {
         m_allowImportRules = false;
         m_allowNamespaceDeclarations = false;
-        rule = StyleRule::create(arena(), m_lastSelectorLineNumber, createStyleProperties());
-        rule->parserAdoptSelectorVector(arena(), *selectors);
+        rule = StyleRule::create(m_lastSelectorLineNumber, createStyleProperties());
+        rule->parserAdoptSelectorVector(*selectors);
         processAndAddNewRuleToSourceTreeIfNeeded();
     } else
         popRuleData();
@@ -12889,7 +12879,7 @@ RefPtr<StyleRuleBase> CSSParser::createFontFaceRule()
             return nullptr;
         }
     }
-    RefPtr<StyleRuleFontFace> rule = StyleRuleFontFace::create(arena(), createStyleProperties());
+    RefPtr<StyleRuleFontFace> rule = StyleRuleFontFace::create(createStyleProperties());
     clearProperties();
     processAndAddNewRuleToSourceTreeIfNeeded();
     return rule;
@@ -12973,10 +12963,10 @@ RefPtr<StyleRuleBase> CSSParser::createPageRule(std::unique_ptr<CSSParserSelecto
     m_allowImportRules = m_allowNamespaceDeclarations = false;
     RefPtr<StyleRulePage> rule;
     if (pageSelector) {
-        rule = StyleRulePage::create(arena(), createStyleProperties());
+        rule = StyleRulePage::create(createStyleProperties());
         Vector<std::unique_ptr<CSSParserSelector>> selectorVector;
         selectorVector.append(WTFMove(pageSelector));
-        rule->parserAdoptSelectorVector(arena(), selectorVector);
+        rule->parserAdoptSelectorVector(selectorVector);
         processAndAddNewRuleToSourceTreeIfNeeded();
     } else
         popRuleData();
@@ -13008,7 +12998,7 @@ RefPtr<StyleRuleBase> CSSParser::createRegionRule(Vector<std::unique_ptr<CSSPars
 
     m_allowImportRules = m_allowNamespaceDeclarations = false;
 
-    RefPtr<StyleRuleRegion> regionRule = StyleRuleRegion::create(arena(), regionSelector, *rules);
+    RefPtr<StyleRuleRegion> regionRule = StyleRuleRegion::create(regionSelector, *rules);
 
     if (isExtractingSourceData())
         addNewRuleToSourceTree(CSSRuleSourceData::createUnknown());
@@ -13282,7 +13272,7 @@ PassRefPtr<StyleRuleBase> CSSParser::createViewportRule()
 {
     m_allowImportRules = m_allowNamespaceDeclarations = false;
 
-    RefPtr<StyleRuleViewport> rule = StyleRuleViewport::create(arena(), createStyleProperties());
+    RefPtr<StyleRuleViewport> rule = StyleRuleViewport::create(createStyleProperties());
     clearProperties();
 
     processAndAddNewRuleToSourceTreeIfNeeded();
index 37be322..fd0409d 100644 (file)
@@ -36,7 +36,6 @@
 #include "SourceSizeList.h"
 #include "WebKitCSSFilterValue.h"
 #include <memory>
-#include <wtf/BumpArena.h>
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/Vector.h>
@@ -115,8 +114,6 @@ public:
     WEBCORE_EXPORT CSSParser(const CSSParserContext&);
     WEBCORE_EXPORT ~CSSParser();
 
-    void setArena(BumpArena&);
-
     void parseSheet(StyleSheetContents*, const String&, const TextPosition&, RuleSourceDataList*, bool logErrors);
     RefPtr<StyleRuleBase> parseRule(StyleSheetContents*, const String&);
     RefPtr<StyleKeyframe> parseKeyframeRule(StyleSheetContents*, const String&);
@@ -400,8 +397,6 @@ public:
 
     CSSParserContext m_context;
 
-    BumpArena* arena();
-    RefPtr<BumpArena> m_arena;
     bool m_important;
     CSSPropertyID m_id;
     AtomicString m_customPropertyName;
index ad6847f..fd9b9d5 100644 (file)
@@ -214,7 +214,7 @@ CSSParserSelector* CSSParserSelector::parsePseudoElementSelector(CSSParserString
 }
 
 #if ENABLE(VIDEO_TRACK)
-CSSParserSelector* CSSParserSelector::parsePseudoElementCueFunctionSelector(BumpArena* arena, const CSSParserString& functionIdentifier, Vector<std::unique_ptr<CSSParserSelector>>* parsedSelectorVector)
+CSSParserSelector* CSSParserSelector::parsePseudoElementCueFunctionSelector(const CSSParserString& functionIdentifier, Vector<std::unique_ptr<CSSParserSelector>>* parsedSelectorVector)
 {
     ASSERT_UNUSED(functionIdentifier, String(functionIdentifier) == "cue(");
 
@@ -226,7 +226,7 @@ CSSParserSelector* CSSParserSelector::parsePseudoElementCueFunctionSelector(Bump
     auto selector = std::make_unique<CSSParserSelector>();
     selector->m_selector->setMatch(CSSSelector::PseudoElement);
     selector->m_selector->setPseudoElementType(CSSSelector::PseudoElementCue);
-    selector->adoptSelectorVector(arena, *selectorVector);
+    selector->adoptSelectorVector(*selectorVector);
     return selector.release();
 }
 #endif
@@ -279,10 +279,10 @@ CSSParserSelector::~CSSParserSelector()
     }
 }
 
-void CSSParserSelector::adoptSelectorVector(BumpArena* arena, Vector<std::unique_ptr<CSSParserSelector>>& selectorVector)
+void CSSParserSelector::adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector)
 {
     auto selectorList = std::make_unique<CSSSelectorList>();
-    selectorList->adoptSelectorVector(arena, selectorVector);
+    selectorList->adoptSelectorVector(selectorVector);
     m_selector->setSelectorList(WTFMove(selectorList));
 }
 
index 51bcd49..ce9b532 100644 (file)
@@ -24,7 +24,6 @@
 #include "CSSSelector.h"
 #include "CSSValueKeywords.h"
 #include "CSSValueList.h"
-#include <wtf/BumpArena.h>
 #include <wtf/text/AtomicString.h>
 #include <wtf/text/AtomicStringHash.h>
 #include <wtf/text/WTFString.h>
@@ -212,7 +211,7 @@ class CSSParserSelector {
 public:
     static CSSParserSelector* parsePagePseudoSelector(const CSSParserString& pseudoTypeString);
     static CSSParserSelector* parsePseudoElementSelector(CSSParserString& pseudoTypeString);
-    static CSSParserSelector* parsePseudoElementCueFunctionSelector(BumpArena*, const CSSParserString& functionIdentifier, Vector<std::unique_ptr<CSSParserSelector>>* selectorVector);
+    static CSSParserSelector* parsePseudoElementCueFunctionSelector(const CSSParserString& functionIdentifier, Vector<std::unique_ptr<CSSParserSelector>>* selectorVector);
     static CSSParserSelector* parsePseudoClassAndCompatibilityElementSelector(CSSParserString& pseudoTypeString);
 
     CSSParserSelector();
@@ -229,7 +228,7 @@ public:
     void setRelation(CSSSelector::Relation value) { m_selector->setRelation(value); }
     void setForPage() { m_selector->setForPage(); }
 
-    void adoptSelectorVector(BumpArena*, Vector<std::unique_ptr<CSSParserSelector>>& selectorVector);
+    void adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector);
     void setLangArgumentList(const Vector<CSSParserString>& stringVector);
 
     void setPseudoClassValue(const CSSParserString& pseudoClassString);
index 5cf4e46..36aadef 100644 (file)
@@ -37,7 +37,7 @@ CSSSelectorList::CSSSelectorList(const CSSSelectorList& other)
     unsigned otherComponentCount = other.componentCount();
     ASSERT_WITH_SECURITY_IMPLICATION(otherComponentCount);
 
-    m_selectorArray = reinterpret_cast<CSSSelector*>(BumpArena::allocate(BumpArena::arenaFor(other.m_selectorArray), sizeof(CSSSelector) * otherComponentCount));
+    m_selectorArray = reinterpret_cast<CSSSelector*>(fastMalloc(sizeof(CSSSelector) * otherComponentCount));
     for (unsigned i = 0; i < otherComponentCount; ++i)
         new (NotNull, &m_selectorArray[i]) CSSSelector(other.m_selectorArray[i]);
 }
@@ -49,7 +49,7 @@ CSSSelectorList::CSSSelectorList(CSSSelectorList&& other)
     other.m_selectorArray = nullptr;
 }
 
-void CSSSelectorList::adoptSelectorVector(BumpArena* arena, Vector<std::unique_ptr<CSSParserSelector>>& selectorVector)
+void CSSSelectorList::adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!selectorVector.isEmpty());
 
@@ -60,7 +60,7 @@ void CSSSelectorList::adoptSelectorVector(BumpArena* arena, Vector<std::unique_p
             ++flattenedSize;
     }
     ASSERT(flattenedSize);
-    m_selectorArray = reinterpret_cast<CSSSelector*>(BumpArena::allocate(arena, sizeof(CSSSelector) * flattenedSize));
+    m_selectorArray = reinterpret_cast<CSSSelector*>(fastMalloc(sizeof(CSSSelector) * flattenedSize));
     size_t arrayIndex = 0;
     for (size_t i = 0; i < selectorVector.size(); ++i) {
         CSSParserSelector* current = selectorVector[i].get();
@@ -119,7 +119,7 @@ void CSSSelectorList::deleteSelectors()
         isLastSelector = s->isLastInSelectorList();
         s->~CSSSelector();
     }
-    BumpArena::deallocate(selectorArray);
+    fastFree(selectorArray);
 }
 
 String CSSSelectorList::selectorsText() const
index 6cbfc06..05b7e98 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "CSSSelector.h"
 #include <memory>
-#include <wtf/BumpArena.h>
 
 namespace WebCore {
 
@@ -43,7 +42,7 @@ public:
 
     ~CSSSelectorList() { deleteSelectors(); }
 
-    void adoptSelectorVector(BumpArena*, Vector<std::unique_ptr<CSSParserSelector>>&);
+    void adoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectorVector);
     void adoptSelectorArray(CSSSelector* selectors) { ASSERT(!m_selectorArray); m_selectorArray = selectors; }
 
     bool isValid() const { return !!m_selectorArray; }
index ef3706f..14f7ac7 100644 (file)
@@ -55,9 +55,9 @@ static bool isInitialOrInherit(const String& value)
     return value.length() == 7 && (value == "initial" || value == "inherit");
 }
 
-Ref<ImmutableStyleProperties> ImmutableStyleProperties::create(BumpArena* arena, const CSSProperty* properties, unsigned count, CSSParserMode cssParserMode)
+Ref<ImmutableStyleProperties> ImmutableStyleProperties::create(const CSSProperty* properties, unsigned count, CSSParserMode cssParserMode)
 {
-    void* slot = BumpArena::allocate(arena, sizeForImmutableStylePropertiesWithPropertyCount(count));
+    void* slot = WTF::fastMalloc(sizeForImmutableStylePropertiesWithPropertyCount(count));
     return adoptRef(*new (NotNull, slot) ImmutableStyleProperties(properties, count, cssParserMode));
 }
 
@@ -66,7 +66,7 @@ Ref<ImmutableStyleProperties> StyleProperties::immutableCopyIfNeeded() const
     if (is<ImmutableStyleProperties>(*this))
         return downcast<ImmutableStyleProperties>(const_cast<StyleProperties&>(*this));
     const MutableStyleProperties& mutableThis = downcast<MutableStyleProperties>(*this);
-    return ImmutableStyleProperties::create(BumpArena::arenaFor(this), mutableThis.m_propertyVector.data(), mutableThis.m_propertyVector.size(), cssParserMode());
+    return ImmutableStyleProperties::create(mutableThis.m_propertyVector.data(), mutableThis.m_propertyVector.size(), cssParserMode());
 }
 
 MutableStyleProperties::MutableStyleProperties(CSSParserMode cssParserMode)
index 0d0a705..7d09c45 100644 (file)
@@ -29,7 +29,6 @@
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
 #include <memory>
-#include <wtf/BumpArena.h>
 #include <wtf/ListHashSet.h>
 #include <wtf/TypeCasts.h>
 #include <wtf/Vector.h>
@@ -47,8 +46,7 @@ class StyledElement;
 class StylePropertyShorthand;
 class StyleSheetContents;
 
-class StyleProperties : public WTF::RefCountedBase {
-    WTF_MAKE_BUMPARENA_ALLOCATED;
+class StyleProperties : public RefCounted<StyleProperties> {
     friend class PropertyReference;
 public:
     // Override RefCounted's deref() to ensure operator delete is called on
@@ -163,7 +161,7 @@ private:
 class ImmutableStyleProperties : public StyleProperties {
 public:
     WEBCORE_EXPORT ~ImmutableStyleProperties();
-    static Ref<ImmutableStyleProperties> create(BumpArena*, const CSSProperty* properties, unsigned count, CSSParserMode);
+    static Ref<ImmutableStyleProperties> create(const CSSProperty* properties, unsigned count, CSSParserMode);
 
     unsigned propertyCount() const { return m_arraySize; }
     bool isEmpty() const { return !propertyCount(); }
index 7ffc640..116c129 100644 (file)
@@ -219,14 +219,14 @@ MutableStyleProperties& StyleRule::mutableProperties()
     return downcast<MutableStyleProperties>(m_properties.get());
 }
 
-Ref<StyleRule> StyleRule::create(BumpArena* arena, int sourceLine, const Vector<const CSSSelector*>& selectors, Ref<StyleProperties>&& properties)
+Ref<StyleRule> StyleRule::create(int sourceLine, const Vector<const CSSSelector*>& selectors, Ref<StyleProperties>&& properties)
 {
     ASSERT_WITH_SECURITY_IMPLICATION(!selectors.isEmpty());
-    CSSSelector* selectorListArray = reinterpret_cast<CSSSelector*>(BumpArena::allocate(arena, sizeof(CSSSelector) * selectors.size()));
+    CSSSelector* selectorListArray = reinterpret_cast<CSSSelector*>(fastMalloc(sizeof(CSSSelector) * selectors.size()));
     for (unsigned i = 0; i < selectors.size(); ++i)
         new (NotNull, &selectorListArray[i]) CSSSelector(*selectors.at(i));
     selectorListArray[selectors.size() - 1].setLastInSelectorList();
-    auto rule = StyleRule::create(arena, sourceLine, WTFMove(properties));
+    auto rule = StyleRule::create(sourceLine, WTFMove(properties));
     rule.get().parserAdoptSelectorArray(selectorListArray);
     return rule;
 }
@@ -244,7 +244,7 @@ Vector<RefPtr<StyleRule>> StyleRule::splitIntoMultipleRulesWithMaximumSelectorCo
             componentsInThisSelector.append(component);
 
         if (componentsInThisSelector.size() + componentsSinceLastSplit.size() > maxCount && !componentsSinceLastSplit.isEmpty()) {
-            rules.append(create(BumpArena::arenaFor(this), sourceLine(), componentsSinceLastSplit, const_cast<StyleProperties&>(m_properties.get())));
+            rules.append(create(sourceLine(), componentsSinceLastSplit, const_cast<StyleProperties&>(m_properties.get())));
             componentsSinceLastSplit.clear();
         }
 
@@ -252,7 +252,7 @@ Vector<RefPtr<StyleRule>> StyleRule::splitIntoMultipleRulesWithMaximumSelectorCo
     }
 
     if (!componentsSinceLastSplit.isEmpty())
-        rules.append(create(BumpArena::arenaFor(this), sourceLine(), componentsSinceLastSplit, const_cast<StyleProperties&>(m_properties.get())));
+        rules.append(create(sourceLine(), componentsSinceLastSplit, const_cast<StyleProperties&>(m_properties.get())));
 
     return rules;
 }
@@ -360,7 +360,7 @@ StyleRuleSupports::StyleRuleSupports(const StyleRuleSupports& o)
 StyleRuleRegion::StyleRuleRegion(Vector<std::unique_ptr<CSSParserSelector>>* selectors, Vector<RefPtr<StyleRuleBase>>& adoptRules)
     : StyleRuleGroup(Region, adoptRules)
 {
-    m_selectorList.adoptSelectorVector(BumpArena::arenaFor(this), *selectors);
+    m_selectorList.adoptSelectorVector(*selectors);
 }
 
 StyleRuleRegion::StyleRuleRegion(const StyleRuleRegion& o)
index a883ec2..e2f8972 100644 (file)
@@ -25,7 +25,6 @@
 #include "CSSSelectorList.h"
 #include "MediaList.h"
 #include "StyleProperties.h"
-#include <wtf/BumpArena.h>
 #include <wtf/RefPtr.h>
 #include <wtf/TypeCasts.h>
 
@@ -38,7 +37,7 @@ class MutableStyleProperties;
 class StyleProperties;
 
 class StyleRuleBase : public WTF::RefCountedBase {
-    WTF_MAKE_BUMPARENA_ALLOCATED;
+    WTF_MAKE_FAST_ALLOCATED;
 public:
     enum Type {
         Unknown, // Not used.
@@ -102,10 +101,11 @@ private:
 };
 
 class StyleRule : public StyleRuleBase {
+    WTF_MAKE_FAST_ALLOCATED;
 public:
-    static Ref<StyleRule> create(BumpArena* arena, int sourceLine, Ref<StyleProperties>&& properties)
+    static Ref<StyleRule> create(int sourceLine, Ref<StyleProperties>&& properties)
     {
-        return adoptRef(*new (arena) StyleRule(sourceLine, WTFMove(properties)));
+        return adoptRef(*new StyleRule(sourceLine, WTFMove(properties)));
     }
     
     ~StyleRule();
@@ -114,7 +114,7 @@ public:
     const StyleProperties& properties() const { return m_properties; }
     MutableStyleProperties& mutableProperties();
     
-    void parserAdoptSelectorVector(BumpArena* arena, Vector<std::unique_ptr<CSSParserSelector>>& selectors) { m_selectorList.adoptSelectorVector(arena, selectors); }
+    void parserAdoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectors) { m_selectorList.adoptSelectorVector(selectors); }
     void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList = WTFMove(selectors); }
     void parserAdoptSelectorArray(CSSSelector* selectors) { m_selectorList.adoptSelectorArray(selectors); }
 
@@ -128,7 +128,7 @@ private:
     StyleRule(int sourceLine, Ref<StyleProperties>&&);
     StyleRule(const StyleRule&);
 
-    static Ref<StyleRule> create(BumpArena*, int sourceLine, const Vector<const CSSSelector*>&, Ref<StyleProperties>&&);
+    static Ref<StyleRule> create(int sourceLine, const Vector<const CSSSelector*>&, Ref<StyleProperties>&&);
 
     Ref<StyleProperties> m_properties;
     CSSSelectorList m_selectorList;
@@ -136,7 +136,7 @@ private:
 
 class StyleRuleFontFace : public StyleRuleBase {
 public:
-    static Ref<StyleRuleFontFace> create(BumpArena* arena, Ref<StyleProperties>&& properties) { return adoptRef(*new (arena) StyleRuleFontFace(WTFMove(properties))); }
+    static Ref<StyleRuleFontFace> create(Ref<StyleProperties>&& properties) { return adoptRef(*new StyleRuleFontFace(WTFMove(properties))); }
     
     ~StyleRuleFontFace();
 
@@ -155,7 +155,7 @@ private:
 
 class StyleRulePage : public StyleRuleBase {
 public:
-    static Ref<StyleRulePage> create(BumpArena* arena, Ref<StyleProperties>&& properties) { return adoptRef(*new (arena) StyleRulePage(WTFMove(properties))); }
+    static Ref<StyleRulePage> create(Ref<StyleProperties>&& properties) { return adoptRef(*new StyleRulePage(WTFMove(properties))); }
 
     ~StyleRulePage();
 
@@ -163,7 +163,7 @@ public:
     const StyleProperties& properties() const { return m_properties; }
     MutableStyleProperties& mutableProperties();
 
-    void parserAdoptSelectorVector(BumpArena* arena, Vector<std::unique_ptr<CSSParserSelector>>& selectors) { m_selectorList.adoptSelectorVector(arena, selectors); }
+    void parserAdoptSelectorVector(Vector<std::unique_ptr<CSSParserSelector>>& selectors) { m_selectorList.adoptSelectorVector(selectors); }
     void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList = WTFMove(selectors); }
 
     Ref<StyleRulePage> copy() const { return adoptRef(*new StyleRulePage(*this)); }
@@ -193,9 +193,9 @@ private:
 
 class StyleRuleMedia : public StyleRuleGroup {
 public:
-    static Ref<StyleRuleMedia> create(BumpArena* arena, PassRefPtr<MediaQuerySet> media, Vector<RefPtr<StyleRuleBase>>& adoptRules)
+    static Ref<StyleRuleMedia> create(PassRefPtr<MediaQuerySet> media, Vector<RefPtr<StyleRuleBase>>& adoptRules)
     {
-        return adoptRef(*new (arena) StyleRuleMedia(media, adoptRules));
+        return adoptRef(*new StyleRuleMedia(media, adoptRules));
     }
 
     MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); }
@@ -211,9 +211,9 @@ private:
 
 class StyleRuleSupports : public StyleRuleGroup {
 public:
-    static Ref<StyleRuleSupports> create(BumpArena* arena, const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>& adoptRules)
+    static Ref<StyleRuleSupports> create(const String& conditionText, bool conditionIsSupported, Vector<RefPtr<StyleRuleBase>>& adoptRules)
     {
-        return adoptRef(*new (arena) StyleRuleSupports(conditionText, conditionIsSupported, adoptRules));
+        return adoptRef(*new StyleRuleSupports(conditionText, conditionIsSupported, adoptRules));
     }
 
     String conditionText() const { return m_conditionText; }
@@ -230,9 +230,9 @@ private:
 
 class StyleRuleRegion : public StyleRuleGroup {
 public:
-    static Ref<StyleRuleRegion> create(BumpArena* arena, Vector<std::unique_ptr<CSSParserSelector>>* selectors, Vector<RefPtr<StyleRuleBase>>& adoptRules)
+    static Ref<StyleRuleRegion> create(Vector<std::unique_ptr<CSSParserSelector>>* selectors, Vector<RefPtr<StyleRuleBase>>& adoptRules)
     {
-        return adoptRef(*new (arena) StyleRuleRegion(selectors, adoptRules));
+        return adoptRef(*new StyleRuleRegion(selectors, adoptRules));
     }
 
     const CSSSelectorList& selectorList() const { return m_selectorList; }
@@ -249,7 +249,7 @@ private:
 #if ENABLE(CSS_DEVICE_ADAPTATION)
 class StyleRuleViewport : public StyleRuleBase {
 public:
-    static Ref<StyleRuleViewport> create(BumpArena* arena, Ref<StyleProperties>&& properties) { return adoptRef(*new (arena) StyleRuleViewport(WTFMove(properties))); }
+    static Ref<StyleRuleViewport> create(Ref<StyleProperties>&& properties) { return adoptRef(*new StyleRuleViewport(WTFMove(properties))); }
 
     ~StyleRuleViewport();
 
index e54e91a..3e30149 100644 (file)
@@ -71,7 +71,6 @@ StyleSheetContents::StyleSheetContents(StyleRuleImport* ownerRule, const String&
     , m_isMutable(false)
     , m_isInMemoryCache(false)
     , m_parserContext(context)
-    , m_arena(BumpArena::create())
 {
 }
 
@@ -92,7 +91,6 @@ StyleSheetContents::StyleSheetContents(const StyleSheetContents& o)
     , m_isMutable(false)
     , m_isInMemoryCache(false)
     , m_parserContext(o.m_parserContext)
-    , m_arena(BumpArena::create())
 {
     ASSERT(o.isCacheable());
 
@@ -315,7 +313,6 @@ void StyleSheetContents::parseAuthorStyleSheet(const CachedCSSStyleSheet* cached
     }
 
     CSSParser p(parserContext());
-    p.setArena(m_arena.get());
     p.parseSheet(this, sheetText, TextPosition(), nullptr, true);
 
     if (m_parserContext.needsSiteSpecificQuirks && isStrictParserMode(m_parserContext.mode)) {
@@ -337,7 +334,6 @@ bool StyleSheetContents::parseString(const String& sheetText)
 bool StyleSheetContents::parseStringAtPosition(const String& sheetText, const TextPosition& textPosition, bool createdByParser)
 {
     CSSParser p(parserContext());
-    p.setArena(m_arena.get());
     p.parseSheet(this, sheetText, textPosition, nullptr, createdByParser);
     return true;
 }
index 68317db..f256621 100644 (file)
@@ -24,7 +24,6 @@
 #include "CSSParserMode.h"
 #include "CachePolicy.h"
 #include "URL.h"
-#include <wtf/BumpArena.h>
 #include <wtf/HashMap.h>
 #include <wtf/ListHashSet.h>
 #include <wtf/RefCounted.h>
@@ -174,8 +173,6 @@ private:
     CSSParserContext m_parserContext;
 
     Vector<CSSStyleSheet*> m_clients;
-
-    Ref<BumpArena> m_arena;
 };
 
 } // namespace
index 2201db3..f7f294e 100644 (file)
@@ -608,11 +608,6 @@ SelectorQuery::SelectorQuery(CSSSelectorList&& selectorList)
 {
 }
 
-SelectorQueryCache::SelectorQueryCache()
-    : m_arena(BumpArena::create())
-{
-}
-
 SelectorQuery* SelectorQueryCache::add(const String& selectors, Document& document, ExceptionCode& ec)
 {
     auto it = m_entries.find(selectors);
@@ -620,7 +615,6 @@ SelectorQuery* SelectorQueryCache::add(const String& selectors, Document& docume
         return it->value.get();
 
     CSSParser parser(document);
-    parser.setArena(m_arena.get());
     CSSSelectorList selectorList;
     parser.parseSelector(selectors, selectorList);
 
index a565da7..58ab670 100644 (file)
@@ -29,7 +29,6 @@
 #include "CSSSelectorList.h"
 #include "NodeList.h"
 #include "SelectorCompiler.h"
-#include <wtf/BumpArena.h>
 #include <wtf/HashMap.h>
 #include <wtf/Vector.h>
 #include <wtf/text/AtomicStringHash.h>
@@ -133,12 +132,10 @@ class SelectorQueryCache {
     WTF_MAKE_FAST_ALLOCATED;
 
 public:
-    SelectorQueryCache();
     SelectorQuery* add(const String&, Document&, ExceptionCode&);
 
 private:
     HashMap<String, std::unique_ptr<SelectorQuery>> m_entries;
-    Ref<BumpArena> m_arena;
 };
 
 inline bool SelectorQuery::matches(Element& element) const
index 3fe8d32..a257972 100644 (file)
@@ -49,7 +49,7 @@ using namespace SVGNames;
 
 inline SVGFontFaceElement::SVGFontFaceElement(const QualifiedName& tagName, Document& document)
     : SVGElement(tagName, document)
-    , m_fontFaceRule(StyleRuleFontFace::create(nullptr, MutableStyleProperties::create(CSSStrictMode)))
+    , m_fontFaceRule(StyleRuleFontFace::create(MutableStyleProperties::create(CSSStrictMode)))
     , m_fontElement(nullptr)
 {
     ASSERT(hasTagName(font_faceTag));