| 1 | /* |
| 2 | * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
| 26 | #ifndef ParserArena_h |
| 27 | #define ParserArena_hcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/parser/ParserArena.h:27:9`! |
| 28 | |
| 29 | #include "Identifier.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Identifier.h`/ |
| 30 | #include <wtf/SegmentedVector.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/SegmentedVector.h`/ |
| 31 | |
| 32 | namespace JSCcxx . . $ `<built-in>:463:9`! { |
| 33 | |
| 34 | class ParserArenaDeletablecxx . . $ QTJSC/ParserArenaDeletable#; |
| 35 | class ParserArenaRefCountedcxx . . $ QTJSC/ParserArenaRefCounted#; |
| 36 | |
| 37 | class IdentifierArenacxx . . $ QTJSC/IdentifierArena# : public FastAllocBasecxx . . $ FastAllocBase# { |
| 38 | public: |
| 39 | ALWAYS_INLINEcxx . . $ `../3rdparty/javascriptcore/JavaScriptCore/wtf/AlwaysInline.h:25:9`! const Identifiercxx . . $ QTJSC/Identifier#& makeIdentifiercxx . . $ QTJSC/IdentifierArena#makeIdentifier(8bd20c2cb45bde8a).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#*, const UCharcxx . . $ UChar#* characters, size_t length); |
| 40 | const Identifiercxx . . $ QTJSC/Identifier#& makeNumericIdentifiercxx . . $ QTJSC/IdentifierArena#makeNumericIdentifier(adffc0791dd8e2f2).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#*, double number); |
| 41 | |
| 42 | void clearcxx . . $ QTJSC/IdentifierArena#clear(49f6e7a06ebc5aa8).() { m_identifiers.clear(); } |
| 43 | bool isEmptycxx . . $ QTJSC/IdentifierArena#isEmpty(50ce9a9e25b4a850).() const { return m_identifiers.isEmpty(); } |
| 44 | |
| 45 | private: |
| 46 | typedef SegmentedVectorcxx . . $ SegmentedVector#<Identifiercxx . . $ QTJSC/Identifier#, 64> IdentifierVectorcxx . . $ QTJSC/IdentifierArena#IdentifierVector#; |
| 47 | IdentifierVectorcxx . . $ QTJSC/IdentifierArena#IdentifierVector# m_identifierscxx . . $ QTJSC/IdentifierArena#m_identifiers.; |
| 48 | }; |
| 49 | |
| 50 | ALWAYS_INLINEcxx . . $ `../3rdparty/javascriptcore/JavaScriptCore/wtf/AlwaysInline.h:25:9`! const Identifiercxx . . $ QTJSC/Identifier#& IdentifierArenacxx . . $ QTJSC/IdentifierArena#::makeIdentifiercxx . . $ QTJSC/IdentifierArena#makeIdentifier(8bd20c2cb45bde8a).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData, const UCharcxx . . $ UChar#* characters, size_t length) |
| 51 | { |
| 52 | m_identifiers.append(Identifier(globalData, characters, length)); |
| 53 | return m_identifiers.last(); |
| 54 | } |
| 55 | |
| 56 | inline const Identifiercxx . . $ QTJSC/Identifier#& IdentifierArenacxx . . $ QTJSC/IdentifierArena#::makeNumericIdentifiercxx . . $ QTJSC/IdentifierArena#makeNumericIdentifier(adffc0791dd8e2f2).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData, double number) |
| 57 | { |
| 58 | m_identifiers.append(Identifier(globalData, UString::from(number))); |
| 59 | return m_identifiers.last(); |
| 60 | } |
| 61 | |
| 62 | class ParserArenacxx . . $ QTJSC/ParserArena# : Noncopyablecxx . . $ Noncopyable# { |
| 63 | public: |
| 64 | ParserArenacxx . . $ QTJSC/ParserArena#ParserArena(49f6e7a06ebc5aa8).(); |
| 65 | ~cxx . . $ QTJSC/ParserArena#`~ParserArena`(49f6e7a06ebc5aa8).ParserArenacxx . . $ QTJSC/ParserArena#(); |
| 66 | |
| 67 | void swapcxx . . $ QTJSC/ParserArena#swap(d85e1b85aaf17628).(ParserArenacxx . . $ QTJSC/ParserArena#& otherArena) |
| 68 | { |
| 69 | std::swapcxx . . $ std/swap(f89c42d3de5cf18b).(m_freeableMemorycxx . . $ QTJSC/ParserArena#m_freeableMemory., otherArena.m_freeableMemorycxx . . $ QTJSC/ParserArena#m_freeableMemory.); |
| 70 | std::swapcxx . . $ std/swap(f89c42d3de5cf18b).(m_freeablePoolEndcxx . . $ QTJSC/ParserArena#m_freeablePoolEnd., otherArena.m_freeablePoolEndcxx . . $ QTJSC/ParserArena#m_freeablePoolEnd.); |
| 71 | m_identifierArena.swap(otherArena.m_identifierArena); |
| 72 | m_freeablePools.swap(otherArena.m_freeablePools); |
| 73 | m_deletableObjects.swap(otherArena.m_deletableObjects); |
| 74 | m_refCountedObjects.swap(otherArena.m_refCountedObjects); |
| 75 | } |
| 76 | |
| 77 | void* allocateFreeablecxx . . $ QTJSC/ParserArena#allocateFreeable(bfcfa4d6b7f7ef64).(size_t size) |
| 78 | { |
| 79 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(size); |
| 80 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(size <= freeablePoolSize); |
| 81 | size_t alignedSize = alignSizecxx . . $ QTJSC/ParserArena#alignSize(ecdaa1632f49f591).(size); |
| 82 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(alignedSize <= freeablePoolSize); |
| 83 | if (UNLIKELYcxx . . $ `../3rdparty/javascriptcore/JavaScriptCore/wtf/AlwaysInline.h:45:9`!(static_cast<size_t>(m_freeablePoolEnd - m_freeableMemory) < alignedSize)) |
| 84 | allocateFreeablePoolcxx . . $ QTJSC/ParserArena#allocateFreeablePool(49f6e7a06ebc5aa8).(); |
| 85 | void* block = m_freeableMemorycxx . . $ QTJSC/ParserArena#m_freeableMemory.; |
| 86 | m_freeableMemorycxx . . $ QTJSC/ParserArena#m_freeableMemory. += alignedSize; |
| 87 | return block; |
| 88 | } |
| 89 | |
| 90 | void* allocateDeletablecxx . . $ QTJSC/ParserArena#allocateDeletable(bfcfa4d6b7f7ef64).(size_t size) |
| 91 | { |
| 92 | ParserArenaDeletablecxx . . $ QTJSC/ParserArenaDeletable#* deletable = static_cast<ParserArenaDeletablecxx . . $ QTJSC/ParserArenaDeletable#*>(fastMalloccxx . . $ fastMalloc(bfcfa4d6b7f7ef64).(size)); |
| 93 | m_deletableObjects.append(deletable); |
| 94 | return deletable; |
| 95 | } |
| 96 | |
| 97 | void derefWithArenacxx . . $ QTJSC/ParserArena#derefWithArena(3aef64cf7318c06b).(PassRefPtrcxx . . $ PassRefPtr#<ParserArenaRefCountedcxx . . $ QTJSC/ParserArenaRefCounted#>); |
| 98 | bool containscxx . . $ QTJSC/ParserArena#contains(5d1479b942b35ee4).(ParserArenaRefCountedcxx . . $ QTJSC/ParserArenaRefCounted#*) const; |
| 99 | ParserArenaRefCountedcxx . . $ QTJSC/ParserArenaRefCounted#* lastcxx . . $ QTJSC/ParserArena#last(4b97ee4dd7d43417).() const; |
| 100 | void removeLastcxx . . $ QTJSC/ParserArena#removeLast(49f6e7a06ebc5aa8).(); |
| 101 | |
| 102 | bool isEmptycxx . . $ QTJSC/ParserArena#isEmpty(50ce9a9e25b4a850).() const; |
| 103 | void resetcxx . . $ QTJSC/ParserArena#reset(49f6e7a06ebc5aa8).(); |
| 104 | |
| 105 | IdentifierArenacxx . . $ QTJSC/IdentifierArena#& identifierArenacxx . . $ QTJSC/ParserArena#identifierArena(a2b2bd4d27f4ae7b).() { return *m_identifierArena; } |
| 106 | |
| 107 | private: |
| 108 | static const size_t freeablePoolSizecxx . . $ QTJSC/ParserArena#freeablePoolSize. = 8000; |
| 109 | |
| 110 | static size_t alignSizecxx . . $ QTJSC/ParserArena#alignSize(ecdaa1632f49f591).(size_t size) |
| 111 | { |
| 112 | return (size + sizeof(WTFcxx . . $ `<built-in>:467:9`!::AllocAlignmentIntegercxx . . $ QTWTF/AllocAlignmentInteger#) - 1) & ~(sizeof(WTFcxx . . $ `<built-in>:467:9`!::AllocAlignmentIntegercxx . . $ QTWTF/AllocAlignmentInteger#) - 1); |
| 113 | } |
| 114 | |
| 115 | void* freeablePoolcxx . . $ QTJSC/ParserArena#freeablePool(50c7df7de5344ebb).(); |
| 116 | void allocateFreeablePoolcxx . . $ QTJSC/ParserArena#allocateFreeablePool(49f6e7a06ebc5aa8).(); |
| 117 | void deallocateObjectscxx . . $ QTJSC/ParserArena#deallocateObjects(49f6e7a06ebc5aa8).(); |
| 118 | |
| 119 | char* m_freeableMemorycxx . . $ QTJSC/ParserArena#m_freeableMemory.; |
| 120 | char* m_freeablePoolEndcxx . . $ QTJSC/ParserArena#m_freeablePoolEnd.; |
| 121 | |
| 122 | OwnPtrcxx . . $ OwnPtr#<IdentifierArenacxx . . $ QTJSC/IdentifierArena#> m_identifierArenacxx . . $ QTJSC/ParserArena#m_identifierArena.; |
| 123 | Vector<void*> m_freeablePoolscxx . . $ QTJSC/ParserArena#m_freeablePools.; |
| 124 | Vector<ParserArenaDeletable*> m_deletableObjectscxx . . $ QTJSC/ParserArena#m_deletableObjects.; |
| 125 | Vector<RefPtr<ParserArenaRefCounted> > m_refCountedObjectscxx . . $ QTJSC/ParserArena#m_refCountedObjects.; |
| 126 | }; |
| 127 | |
| 128 | } |
| 129 | |
| 130 | #endif |