| 1 | /* |
| 2 | * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Library General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Library General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Library General Public License |
| 15 | * along with this library; see the file COPYING.LIB. If not, write to |
| 16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 | * Boston, MA 02110-1301, USA. |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #ifndef PropertyMapHashTable_h |
| 22 | #define PropertyMapHashTable_hcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/runtime/PropertyMapHashTable.h:22:9`! |
| 23 | |
| 24 | #include "UString.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/UString.h`/ |
| 25 | #include <wtf/Vector.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Vector.h`/ |
| 26 | |
| 27 | namespace JSCcxx . . $ `<built-in>:463:9`! { |
| 28 | |
| 29 | struct PropertyMapEntrycxx . . $ QTJSC/PropertyMapEntry# { |
| 30 | UStringcxx . . $ QTJSC/UString#::Repcxx . . $ QTJSC/UString#Rep#* keycxx . . $ QTJSC/PropertyMapEntry#key.; |
| 31 | unsigned offsetcxx . . $ QTJSC/PropertyMapEntry#offset.; |
| 32 | unsigned attributescxx . . $ QTJSC/PropertyMapEntry#attributes.; |
| 33 | JSCellcxx . . $ QTJSC/JSCell#* specificValuecxx . . $ QTJSC/PropertyMapEntry#specificValue.; |
| 34 | unsigned indexcxx . . $ QTJSC/PropertyMapEntry#index.; |
| 35 | |
| 36 | PropertyMapEntrycxx . . $ QTJSC/PropertyMapEntry#PropertyMapEntry(b3d037c7290fac02).(UStringcxx . . $ QTJSC/UString#::Repcxx . . $ QTJSC/UString#Rep#* key, unsigned attributes, JSCellcxx . . $ QTJSC/JSCell#* specificValue) |
| 37 | : keycxx . . $ QTJSC/PropertyMapEntry#key.(key) |
| 38 | , offsetcxx . . $ QTJSC/PropertyMapEntry#offset.(0) |
| 39 | , attributescxx . . $ QTJSC/PropertyMapEntry#attributes.(attributes) |
| 40 | , specificValuecxx . . $ QTJSC/PropertyMapEntry#specificValue.(specificValue) |
| 41 | , indexcxx . . $ QTJSC/PropertyMapEntry#index.(0) |
| 42 | { |
| 43 | } |
| 44 | |
| 45 | PropertyMapEntrycxx . . $ QTJSC/PropertyMapEntry#PropertyMapEntry(ac6bdb1be4250733).(UStringcxx . . $ QTJSC/UString#::Repcxx . . $ QTJSC/UString#Rep#* key, unsigned offset, unsigned attributes, JSCellcxx . . $ QTJSC/JSCell#* specificValue, unsigned index) |
| 46 | : keycxx . . $ QTJSC/PropertyMapEntry#key.(key) |
| 47 | , offsetcxx . . $ QTJSC/PropertyMapEntry#offset.(offset) |
| 48 | , attributescxx . . $ QTJSC/PropertyMapEntry#attributes.(attributes) |
| 49 | , specificValuecxx . . $ QTJSC/PropertyMapEntry#specificValue.(specificValue) |
| 50 | , indexcxx . . $ QTJSC/PropertyMapEntry#index.(index) |
| 51 | { |
| 52 | } |
| 53 | }; |
| 54 | |
| 55 | // lastIndexUsed is an ever-increasing index used to identify the order items |
| 56 | // were inserted into the property map. It's required that getEnumerablePropertyNames |
| 57 | // return the properties in the order they were added for compatibility with other |
| 58 | // browsers' JavaScript implementations. |
| 59 | struct PropertyMapHashTablecxx . . $ QTJSC/PropertyMapHashTable# { |
| 60 | unsigned sizeMaskcxx . . $ QTJSC/PropertyMapHashTable#sizeMask.; |
| 61 | unsigned sizecxx . . $ QTJSC/PropertyMapHashTable#size.; |
| 62 | unsigned keyCountcxx . . $ QTJSC/PropertyMapHashTable#keyCount.; |
| 63 | unsigned deletedSentinelCountcxx . . $ QTJSC/PropertyMapHashTable#deletedSentinelCount.; |
| 64 | unsigned anonymousSlotCountcxx . . $ QTJSC/PropertyMapHashTable#anonymousSlotCount.; |
| 65 | unsigned lastIndexUsedcxx . . $ QTJSC/PropertyMapHashTable#lastIndexUsed.; |
| 66 | Vector<unsigned>* deletedOffsetscxx . . $ QTJSC/PropertyMapHashTable#deletedOffsets.; |
| 67 | unsigned entryIndicescxx . . $ QTJSC/PropertyMapHashTable#entryIndices.[1]; |
| 68 | |
| 69 | PropertyMapEntrycxx . . $ QTJSC/PropertyMapEntry#* entriescxx . . $ QTJSC/PropertyMapHashTable#entries(c756222fc8ee585c).() |
| 70 | { |
| 71 | // The entries vector comes after the indices vector. |
| 72 | // The 0th item in the entries vector is not really used; it has to |
| 73 | // have a 0 in its key to allow the hash table lookup to handle deleted |
| 74 | // sentinels without any special-case code, but the other fields are unused. |
| 75 | return reinterpret_cast<PropertyMapEntrycxx . . $ QTJSC/PropertyMapEntry#*>(&entryIndicescxx . . $ QTJSC/PropertyMapHashTable#entryIndices.[sizecxx . . $ QTJSC/PropertyMapHashTable#size.]); |
| 76 | } |
| 77 | |
| 78 | static size_t allocationSizecxx . . $ QTJSC/PropertyMapHashTable#allocationSize(1892545c1754497d).(unsigned size) |
| 79 | { |
| 80 | // We never let a hash table get more than half full, |
| 81 | // So the number of indices we need is the size of the hash table. |
| 82 | // But the number of entries is half that (plus one for the deleted sentinel). |
| 83 | return sizeof(PropertyMapHashTablecxx . . $ QTJSC/PropertyMapHashTable#) |
| 84 | + (size - 1) * sizeof(unsigned) |
| 85 | + (1 + size / 2) * sizeof(PropertyMapEntrycxx . . $ QTJSC/PropertyMapEntry#); |
| 86 | } |
| 87 | }; |
| 88 | |
| 89 | } // namespace JSC |
| 90 | |
| 91 | #endif // PropertyMapHashTable_h |