| 1 | /* |
| 2 | * Copyright (C) 1999-2000 Harri Porten ([email protected]) |
| 3 | * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #ifndef Lookup_h |
| 22 | #define Lookup_hcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/runtime/Lookup.h:22:9`! |
| 23 | |
| 24 | #include "CallFrame.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrame.h`/ |
| 25 | #include "Identifier.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Identifier.h`/ |
| 26 | #include "JSGlobalObject.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.h`/ |
| 27 | #include "JSObject.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.h`/ |
| 28 | #include "PropertySlot.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/PropertySlot.h`/ |
| 29 | #include <stdio.h> |
| 30 | #include <wtf/Assertions.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h`/ |
| 31 | |
| 32 | // Bug #26843: Work around Metrowerks compiler bug |
| 33 | #if COMPILERcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h:39:9`!(WINSCW) |
| 34 | #define JSC_CONST_HASHTABLE |
| 35 | #else |
| 36 | #define JSC_CONST_HASHTABLEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/runtime/Lookup.h:36:9`! const |
| 37 | #endif |
| 38 | |
| 39 | namespace JSCcxx . . $ QTJSC/ { |
| 40 | |
| 41 | // Hash table generated by the create_hash_table script. |
| 42 | struct HashTableValuecxx . . $ QTJSC/HashTableValue# { |
| 43 | const char* keycxx . . $ QTJSC/HashTableValue#key.; // property name |
| 44 | unsigned char attributescxx . . $ QTJSC/HashTableValue#attributes.; // JSObject attributes |
| 45 | intptr_tcxx . . $ intptr_t# value1cxx . . $ QTJSC/HashTableValue#value1.; |
| 46 | intptr_tcxx . . $ intptr_t# value2cxx . . $ QTJSC/HashTableValue#value2.; |
| 47 | }; |
| 48 | |
| 49 | // FIXME: There is no reason this get function can't be simpler. |
| 50 | // ie. typedef JSValue (*GetFunction)(ExecState*, JSObject* baseObject) |
| 51 | typedef PropertySlotcxx . . $ QTJSC/PropertySlot#::GetValueFunccxx . . $ QTJSC/PropertySlot#GetValueFunc# GetFunctioncxx . . $ QTJSC/GetFunction#; |
| 52 | typedef void (*PutFunctioncxx . . $ QTJSC/PutFunction#)(ExecStatecxx . . $ QTJSC/ExecState#*, JSObjectcxx . . $ QTJSC/JSObject#* baseObject, JSValuecxx . . $ QTJSC/JSValue# value); |
| 53 | |
| 54 | class HashEntrycxx . . $ QTJSC/HashEntry# : public FastAllocBasecxx . . $ FastAllocBase# { |
| 55 | public: |
| 56 | void initializecxx . . $ QTJSC/HashEntry#initialize(f5bf2deaa008411d).(UStringcxx . . $ QTJSC/UString#::Repcxx . . $ QTJSC/UString#Rep#* key, unsigned char attributes, intptr_tcxx . . $ intptr_t# v1, intptr_tcxx . . $ intptr_t# v2) |
| 57 | { |
| 58 | m_keycxx . . $ QTJSC/HashEntry#m_key. = key; |
| 59 | m_attributescxx . . $ QTJSC/HashEntry#m_attributes. = attributes; |
| 60 | m_ucxx . . $ QTJSC/HashEntry#m_u..storecxx . . $ QTJSC/HashEntry#$anonymous_type_0#store..value1cxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_1#value1. = v1; |
| 61 | m_ucxx . . $ QTJSC/HashEntry#m_u..storecxx . . $ QTJSC/HashEntry#$anonymous_type_0#store..value2cxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_1#value2. = v2; |
| 62 | m_nextcxx . . $ QTJSC/HashEntry#m_next. = 0; |
| 63 | } |
| 64 | |
| 65 | void setKeycxx . . $ QTJSC/HashEntry#setKey(f38096febece923b).(UStringcxx . . $ QTJSC/UString#::Repcxx . . $ QTJSC/UString#Rep#* key) { m_keycxx . . $ QTJSC/HashEntry#m_key. = key; } |
| 66 | UStringcxx . . $ QTJSC/UString#::Repcxx . . $ QTJSC/UString#Rep#* keycxx . . $ QTJSC/HashEntry#key(eff8ac5d0836371c).() const { return m_keycxx . . $ QTJSC/HashEntry#m_key.; } |
| 67 | |
| 68 | unsigned char attributescxx . . $ QTJSC/HashEntry#attributes(bd807b21b9713a30).() const { return m_attributescxx . . $ QTJSC/HashEntry#m_attributes.; } |
| 69 | |
| 70 | NativeFunctioncxx . . $ QTJSC/NativeFunction# functioncxx . . $ QTJSC/HashEntry#function(44211026f4305b67).() const { ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(m_attributes & Function); return m_ucxx . . $ QTJSC/HashEntry#m_u..functioncxx . . $ QTJSC/HashEntry#$anonymous_type_0#function..functionValuecxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_2#functionValue.; } |
| 71 | unsigned char functionLengthcxx . . $ QTJSC/HashEntry#functionLength(bd807b21b9713a30).() const { ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(m_attributes & Function); return static_cast<unsigned char>(m_ucxx . . $ QTJSC/HashEntry#m_u..functioncxx . . $ QTJSC/HashEntry#$anonymous_type_0#function..lengthcxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_2#length.); } |
| 72 | |
| 73 | GetFunctioncxx . . $ QTJSC/GetFunction# propertyGettercxx . . $ QTJSC/HashEntry#propertyGetter(fb6093d131f5da5e).() const { ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(!(m_attributes & Function)); return m_ucxx . . $ QTJSC/HashEntry#m_u..propertycxx . . $ QTJSC/HashEntry#$anonymous_type_0#property..getcxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_3#get.; } |
| 74 | PutFunctioncxx . . $ QTJSC/PutFunction# propertyPuttercxx . . $ QTJSC/HashEntry#propertyPutter(60049c78a79ba87).() const { ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(!(m_attributes & Function)); return m_ucxx . . $ QTJSC/HashEntry#m_u..propertycxx . . $ QTJSC/HashEntry#$anonymous_type_0#property..putcxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_3#put.; } |
| 75 | |
| 76 | intptr_tcxx . . $ intptr_t# lexerValuecxx . . $ QTJSC/HashEntry#lexerValue(57a65ae535d7db84).() const { ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(!m_attributes); return m_ucxx . . $ QTJSC/HashEntry#m_u..lexercxx . . $ QTJSC/HashEntry#$anonymous_type_0#lexer..valuecxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_4#value.; } |
| 77 | |
| 78 | void setNextcxx . . $ QTJSC/HashEntry#setNext(cfc321a836b2656e).(HashEntrycxx . . $ QTJSC/HashEntry# *next) { m_nextcxx . . $ QTJSC/HashEntry#m_next. = next; } |
| 79 | HashEntrycxx . . $ QTJSC/HashEntry#* nextcxx . . $ QTJSC/HashEntry#next(f830c77705987d82).() const { return m_nextcxx . . $ QTJSC/HashEntry#m_next.; } |
| 80 | |
| 81 | private: |
| 82 | UStringcxx . . $ QTJSC/UString#::Repcxx . . $ QTJSC/UString#Rep#* m_keycxx . . $ QTJSC/HashEntry#m_key.; |
| 83 | unsigned char m_attributescxx . . $ QTJSC/HashEntry#m_attributes.; // JSObject attributes |
| 84 | |
| 85 | unioncxx . . $ QTJSC/HashEntry#$anonymous_type_0# { |
| 86 | structcxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_1# { |
| 87 | intptr_tcxx . . $ intptr_t# value1cxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_1#value1.; |
| 88 | intptr_tcxx . . $ intptr_t# value2cxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_1#value2.; |
| 89 | } storecxx . . $ QTJSC/HashEntry#$anonymous_type_0#store.; |
| 90 | structcxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_2# { |
| 91 | NativeFunctioncxx . . $ QTJSC/NativeFunction# functionValuecxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_2#functionValue.; |
| 92 | intptr_tcxx . . $ intptr_t# lengthcxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_2#length.; // number of arguments for function |
| 93 | } functioncxx . . $ QTJSC/HashEntry#$anonymous_type_0#function.; |
| 94 | structcxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_3# { |
| 95 | GetFunctioncxx . . $ QTJSC/GetFunction# getcxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_3#get.; |
| 96 | PutFunctioncxx . . $ QTJSC/PutFunction# putcxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_3#put.; |
| 97 | } propertycxx . . $ QTJSC/HashEntry#$anonymous_type_0#property.; |
| 98 | structcxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_4# { |
| 99 | intptr_tcxx . . $ intptr_t# valuecxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_4#value.; |
| 100 | intptr_tcxx . . $ intptr_t# unusedcxx . . $ QTJSC/HashEntry#$anonymous_type_0#$anonymous_type_4#unused.; |
| 101 | } lexercxx . . $ QTJSC/HashEntry#$anonymous_type_0#lexer.; |
| 102 | } m_ucxx . . $ QTJSC/HashEntry#m_u.; |
| 103 | |
| 104 | HashEntrycxx . . $ QTJSC/HashEntry#* m_nextcxx . . $ QTJSC/HashEntry#m_next.; |
| 105 | }; |
| 106 | |
| 107 | struct HashTablecxx . . $ QTJSC/HashTable# { |
| 108 | |
| 109 | int compactSizecxx . . $ QTJSC/HashTable#compactSize.; |
| 110 | int compactHashSizeMaskcxx . . $ QTJSC/HashTable#compactHashSizeMask.; |
| 111 | |
| 112 | const HashTableValuecxx . . $ QTJSC/HashTableValue#* valuescxx . . $ QTJSC/HashTable#values.; // Fixed values generated by script. |
| 113 | mutable const HashEntrycxx . . $ QTJSC/HashEntry#* tablecxx . . $ QTJSC/HashTable#table.; // Table allocated at runtime. |
| 114 | |
| 115 | ALWAYS_INLINEcxx . . $ `../3rdparty/javascriptcore/JavaScriptCore/wtf/AlwaysInline.h:25:9`! void initializeIfNeededcxx . . $ QTJSC/HashTable#initializeIfNeeded(cacade0566098a58).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData) const |
| 116 | { |
| 117 | if (!tablecxx . . $ QTJSC/HashTable#table.) |
| 118 | createTablecxx . . $ QTJSC/HashTable#createTable(cacade0566098a58).(globalData); |
| 119 | } |
| 120 | |
| 121 | ALWAYS_INLINEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/AlwaysInline.h:25:9`! void initializeIfNeededcxx . . $ QTJSC/HashTable#initializeIfNeeded(31a096c468e6ff8e).(ExecStatecxx . . $ QTJSC/ExecState#* exec) const |
| 122 | { |
| 123 | if (!tablecxx . . $ QTJSC/HashTable#table.) |
| 124 | createTablecxx . . $ QTJSC/HashTable#createTable(cacade0566098a58).(&exec->globalDatacxx . . $ QTJSC/ExecState#globalData(ae00a65ac2fd4a61).()); |
| 125 | } |
| 126 | |
| 127 | void deleteTablecxx . . $ QTJSC/HashTable#deleteTable(83f5f38750778ac8).() const; |
| 128 | |
| 129 | // Find an entry in the table, and return the entry. |
| 130 | ALWAYS_INLINEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/AlwaysInline.h:25:9`! const HashEntrycxx . . $ QTJSC/HashEntry#* entrycxx . . $ QTJSC/HashTable#entry(1cda2242ccd6fb66).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData, const Identifiercxx . . $ QTJSC/Identifier#& identifier) const |
| 131 | { |
| 132 | initializeIfNeededcxx . . $ QTJSC/HashTable#initializeIfNeeded(cacade0566098a58).(globalData); |
| 133 | return entrycxx . . $ QTJSC/HashTable#entry(40c39f61e8b4ff42).(identifier); |
| 134 | } |
| 135 | |
| 136 | ALWAYS_INLINEcxx . . $ `../3rdparty/javascriptcore/JavaScriptCore/wtf/AlwaysInline.h:25:9`! const HashEntrycxx . . $ QTJSC/HashEntry#* entrycxx . . $ QTJSC/HashTable#entry(9d28b986369f6e8f).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const Identifiercxx . . $ QTJSC/Identifier#& identifier) const |
| 137 | { |
| 138 | initializeIfNeededcxx . . $ QTJSC/HashTable#initializeIfNeeded(31a096c468e6ff8e).(exec); |
| 139 | return entrycxx . . $ QTJSC/HashTable#entry(40c39f61e8b4ff42).(identifier); |
| 140 | } |
| 141 | |
| 142 | private: |
| 143 | ALWAYS_INLINEcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/AlwaysInline.h:25:9`! const HashEntrycxx . . $ QTJSC/HashEntry#* entrycxx . . $ QTJSC/HashTable#entry(40c39f61e8b4ff42).(const Identifiercxx . . $ QTJSC/Identifier#& identifier) const |
| 144 | { |
| 145 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(table); |
| 146 | |
| 147 | const HashEntrycxx . . $ QTJSC/HashEntry#* entry = &tablecxx . . $ QTJSC/HashTable#table.[identifier.ustringcxx . . $ QTJSC/Identifier#ustring(de21ee9ecbd506fd).().repcxx . . $ QTJSC/UString#rep(eff8ac5d0836371c).()->existingHashcxx . . $ QTJSC/UStringImpl#existingHash(ddd8539a2fcdd4ce).() & compactHashSizeMaskcxx . . $ QTJSC/HashTable#compactHashSizeMask.]; |
| 148 | |
| 149 | if (!entry->keycxx . . $ QTJSC/HashEntry#key(eff8ac5d0836371c).()) |
| 150 | return 0; |
| 151 | |
| 152 | do { |
| 153 | if (entry->keycxx . . $ QTJSC/HashEntry#key(eff8ac5d0836371c).() == identifier.ustringcxx . . $ QTJSC/Identifier#ustring(de21ee9ecbd506fd).().repcxx . . $ QTJSC/UString#rep(eff8ac5d0836371c).()) |
| 154 | return entry; |
| 155 | entry = entry->nextcxx . . $ QTJSC/HashEntry#next(f830c77705987d82).(); |
| 156 | } while (entry); |
| 157 | |
| 158 | return 0; |
| 159 | } |
| 160 | |
| 161 | // Convert the hash table keys to identifiers. |
| 162 | void createTablecxx . . $ QTJSC/HashTable#createTable(cacade0566098a58).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#*) const; |
| 163 | }; |
| 164 | |
| 165 | void setUpStaticFunctionSlotcxx . . $ QTJSC/setUpStaticFunctionSlot(62de5135612538c0).(ExecStatecxx . . $ QTJSC/ExecState#*, const HashEntrycxx . . $ QTJSC/HashEntry#*, JSObjectcxx . . $ QTJSC/JSObject#* thisObject, const Identifiercxx . . $ QTJSC/Identifier#& propertyName, PropertySlotcxx . . $ QTJSC/PropertySlot#&); |
| 166 | |
| 167 | /** |
| 168 | * This method does it all (looking in the hashtable, checking for function |
| 169 | * overrides, creating the function or retrieving from cache, calling |
| 170 | * getValueProperty in case of a non-function property, forwarding to parent if |
| 171 | * unknown property). |
| 172 | */ |
| 173 | template <class ThisImp, class ParentImp> |
| 174 | inline bool getStaticPropertySlotcxx . . $ QTJSC/getStaticPropertySlot(e862481916033870).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const HashTablecxx . . $ QTJSC/HashTable#* table, ThisImp* thisObj, const Identifiercxx . . $ QTJSC/Identifier#& propertyName, PropertySlotcxx . . $ QTJSC/PropertySlot#& slot) |
| 175 | { |
| 176 | const HashEntrycxx . . $ QTJSC/HashEntry#* entry = table->entrycxx . . $ QTJSC/HashTable#entry(9d28b986369f6e8f).(exec, propertyName); |
| 177 | |
| 178 | if (!entry) // not found, forward to parent |
| 179 | return thisObj->ParentImp::getOwnPropertySlot(exec, propertyName, slot); |
| 180 | |
| 181 | if (entry->attributescxx . . $ QTJSC/HashEntry#attributes(bd807b21b9713a30).() & Functioncxx . . $ QTJSC/Function.) |
| 182 | setUpStaticFunctionSlotcxx . . $ QTJSC/setUpStaticFunctionSlot(62de5135612538c0).(exec, entry, thisObj, propertyName, slot); |
| 183 | else |
| 184 | slot.setCustomcxx . . $ QTJSC/PropertySlot#setCustom(201c6ee79e352ec7).(thisObj, entry->propertyGettercxx . . $ QTJSC/HashEntry#propertyGetter(fb6093d131f5da5e).()); |
| 185 | |
| 186 | return true; |
| 187 | } |
| 188 | |
| 189 | template <class ThisImp, class ParentImp> |
| 190 | inline bool getStaticPropertyDescriptorcxx . . $ QTJSC/getStaticPropertyDescriptor(f314e86693912e6d).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const HashTablecxx . . $ QTJSC/HashTable#* table, ThisImp* thisObj, const Identifiercxx . . $ QTJSC/Identifier#& propertyName, PropertyDescriptorcxx . . $ QTJSC/PropertyDescriptor#& descriptor) |
| 191 | { |
| 192 | const HashEntrycxx . . $ QTJSC/HashEntry#* entry = table->entrycxx . . $ QTJSC/HashTable#entry(9d28b986369f6e8f).(exec, propertyName); |
| 193 | |
| 194 | if (!entry) // not found, forward to parent |
| 195 | return thisObj->ParentImp::getOwnPropertyDescriptor(exec, propertyName, descriptor); |
| 196 | |
| 197 | PropertySlotcxx . . $ QTJSC/PropertySlot# slotcxx . . $ QTJSC/PropertySlot#PropertySlot(49f6e7a06ebc5aa8).; |
| 198 | if (entry->attributescxx . . $ QTJSC/HashEntry#attributes(bd807b21b9713a30).() & Functioncxx . . $ QTJSC/Function.) |
| 199 | setUpStaticFunctionSlotcxx . . $ QTJSC/setUpStaticFunctionSlot(62de5135612538c0).(exec, entry, thisObj, propertyName, slot); |
| 200 | else |
| 201 | slot.setCustomcxx . . $ QTJSC/PropertySlot#setCustom(201c6ee79e352ec7).(thisObj, entry->propertyGettercxx . . $ QTJSC/HashEntry#propertyGetter(fb6093d131f5da5e).()); |
| 202 | |
| 203 | descriptor.setDescriptorcxx . . $ QTJSC/PropertyDescriptor#setDescriptor(48358939f851dacc).(slot.getValuecxx . . $ QTJSC/PropertySlot#getValue(ccadc8db5e9d2977).(exec, propertyName), entry->attributescxx . . $ QTJSC/HashEntry#attributes(bd807b21b9713a30).()); |
| 204 | return true; |
| 205 | } |
| 206 | |
| 207 | /** |
| 208 | * Simplified version of getStaticPropertySlot in case there are only functions. |
| 209 | * Using this instead of getStaticPropertySlot allows 'this' to avoid implementing |
| 210 | * a dummy getValueProperty. |
| 211 | */ |
| 212 | template <class ParentImp> |
| 213 | inline bool getStaticFunctionSlotcxx . . $ QTJSC/getStaticFunctionSlot(98ddb1a8b0302336).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const HashTablecxx . . $ QTJSC/HashTable#* table, JSObjectcxx . . $ QTJSC/JSObject#* thisObj, const Identifiercxx . . $ QTJSC/Identifier#& propertyName, PropertySlotcxx . . $ QTJSC/PropertySlot#& slot) |
| 214 | { |
| 215 | if (static_cast<ParentImp*>(thisObj)->ParentImp::getOwnPropertySlot(exec, propertyName, slot)) |
| 216 | return true; |
| 217 | |
| 218 | const HashEntrycxx . . $ QTJSC/HashEntry#* entry = table->entrycxx . . $ QTJSC/HashTable#entry(9d28b986369f6e8f).(exec, propertyName); |
| 219 | if (!entry) |
| 220 | return false; |
| 221 | |
| 222 | setUpStaticFunctionSlotcxx . . $ QTJSC/setUpStaticFunctionSlot(62de5135612538c0).(exec, entry, thisObj, propertyName, slot); |
| 223 | return true; |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * Simplified version of getStaticPropertyDescriptor in case there are only functions. |
| 228 | * Using this instead of getStaticPropertyDescriptor allows 'this' to avoid implementing |
| 229 | * a dummy getValueProperty. |
| 230 | */ |
| 231 | template <class ParentImp> |
| 232 | inline bool getStaticFunctionDescriptorcxx . . $ QTJSC/getStaticFunctionDescriptor(e0f361285c53e82f).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const HashTablecxx . . $ QTJSC/HashTable#* table, JSObjectcxx . . $ QTJSC/JSObject#* thisObj, const Identifiercxx . . $ QTJSC/Identifier#& propertyName, PropertyDescriptorcxx . . $ QTJSC/PropertyDescriptor#& descriptor) |
| 233 | { |
| 234 | if (static_cast<ParentImp*>(thisObj)->ParentImp::getOwnPropertyDescriptor(exec, propertyName, descriptor)) |
| 235 | return true; |
| 236 | |
| 237 | const HashEntrycxx . . $ QTJSC/HashEntry#* entry = table->entrycxx . . $ QTJSC/HashTable#entry(9d28b986369f6e8f).(exec, propertyName); |
| 238 | if (!entry) |
| 239 | return false; |
| 240 | |
| 241 | PropertySlotcxx . . $ QTJSC/PropertySlot# slotcxx . . $ QTJSC/PropertySlot#PropertySlot(49f6e7a06ebc5aa8).; |
| 242 | setUpStaticFunctionSlotcxx . . $ QTJSC/setUpStaticFunctionSlot(62de5135612538c0).(exec, entry, thisObj, propertyName, slot); |
| 243 | descriptor.setDescriptorcxx . . $ QTJSC/PropertyDescriptor#setDescriptor(48358939f851dacc).(slot.getValuecxx . . $ QTJSC/PropertySlot#getValue(ccadc8db5e9d2977).(exec, propertyName), entry->attributescxx . . $ QTJSC/HashEntry#attributes(bd807b21b9713a30).()); |
| 244 | return true; |
| 245 | } |
| 246 | |
| 247 | /** |
| 248 | * Simplified version of getStaticPropertySlot in case there are no functions, only "values". |
| 249 | * Using this instead of getStaticPropertySlot removes the need for a FuncImp class. |
| 250 | */ |
| 251 | template <class ThisImp, class ParentImp> |
| 252 | inline bool getStaticValueSlotcxx . . $ QTJSC/getStaticValueSlot(e862481916033870).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const HashTablecxx . . $ QTJSC/HashTable#* table, ThisImp* thisObj, const Identifiercxx . . $ QTJSC/Identifier#& propertyName, PropertySlotcxx . . $ QTJSC/PropertySlot#& slot) |
| 253 | { |
| 254 | const HashEntrycxx . . $ QTJSC/HashEntry#* entry = table->entrycxx . . $ QTJSC/HashTable#entry(9d28b986369f6e8f).(exec, propertyName); |
| 255 | |
| 256 | if (!entry) // not found, forward to parent |
| 257 | return thisObj->ParentImp::getOwnPropertySlot(exec, propertyName, slot); |
| 258 | |
| 259 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(!(entry->attributes() & Function)); |
| 260 | |
| 261 | slot.setCustomcxx . . $ QTJSC/PropertySlot#setCustom(201c6ee79e352ec7).(thisObj, entry->propertyGettercxx . . $ QTJSC/HashEntry#propertyGetter(fb6093d131f5da5e).()); |
| 262 | return true; |
| 263 | } |
| 264 | |
| 265 | /** |
| 266 | * Simplified version of getStaticPropertyDescriptor in case there are no functions, only "values". |
| 267 | * Using this instead of getStaticPropertyDescriptor removes the need for a FuncImp class. |
| 268 | */ |
| 269 | template <class ThisImp, class ParentImp> |
| 270 | inline bool getStaticValueDescriptorcxx . . $ QTJSC/getStaticValueDescriptor(f314e86693912e6d).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const HashTablecxx . . $ QTJSC/HashTable#* table, ThisImp* thisObj, const Identifiercxx . . $ QTJSC/Identifier#& propertyName, PropertyDescriptorcxx . . $ QTJSC/PropertyDescriptor#& descriptor) |
| 271 | { |
| 272 | const HashEntrycxx . . $ QTJSC/HashEntry#* entry = table->entrycxx . . $ QTJSC/HashTable#entry(9d28b986369f6e8f).(exec, propertyName); |
| 273 | |
| 274 | if (!entry) // not found, forward to parent |
| 275 | return thisObj->ParentImp::getOwnPropertyDescriptor(exec, propertyName, descriptor); |
| 276 | |
| 277 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(!(entry->attributes() & Function)); |
| 278 | PropertySlotcxx . . $ QTJSC/PropertySlot# slotcxx . . $ QTJSC/PropertySlot#PropertySlot(49f6e7a06ebc5aa8).; |
| 279 | slot.setCustomcxx . . $ QTJSC/PropertySlot#setCustom(201c6ee79e352ec7).(thisObj, entry->propertyGettercxx . . $ QTJSC/HashEntry#propertyGetter(fb6093d131f5da5e).()); |
| 280 | descriptor.setDescriptorcxx . . $ QTJSC/PropertyDescriptor#setDescriptor(48358939f851dacc).(slot.getValuecxx . . $ QTJSC/PropertySlot#getValue(ccadc8db5e9d2977).(exec, propertyName), entry->attributescxx . . $ QTJSC/HashEntry#attributes(bd807b21b9713a30).()); |
| 281 | return true; |
| 282 | } |
| 283 | |
| 284 | /** |
| 285 | * This one is for "put". |
| 286 | * It looks up a hash entry for the property to be set. If an entry |
| 287 | * is found it sets the value and returns true, else it returns false. |
| 288 | */ |
| 289 | template <class ThisImp> |
| 290 | inline bool lookupPutcxx . . $ QTJSC/lookupPut(a71e883b485a30dd).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const Identifiercxx . . $ QTJSC/Identifier#& propertyName, JSValuecxx . . $ QTJSC/JSValue# value, const HashTablecxx . . $ QTJSC/HashTable#* table, ThisImp* thisObj) |
| 291 | { |
| 292 | const HashEntrycxx . . $ QTJSC/HashEntry#* entry = table->entrycxx . . $ QTJSC/HashTable#entry(9d28b986369f6e8f).(exec, propertyName); |
| 293 | |
| 294 | if (!entry) |
| 295 | return false; |
| 296 | |
| 297 | if (entry->attributescxx . . $ QTJSC/HashEntry#attributes(bd807b21b9713a30).() & Functioncxx . . $ QTJSC/Function.) { // function: put as override property |
| 298 | if (LIKELYcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/AlwaysInline.h:53:9`!(value.isCell())) |
| 299 | thisObj->putDirectFunction(propertyName, value.asCellcxx . . $ QTJSC/JSValue#asCell(60510463d9a84528).()); |
| 300 | else |
| 301 | thisObj->putDirect(propertyName, value); |
| 302 | } else if (!(entry->attributescxx . . $ QTJSC/HashEntry#attributes(bd807b21b9713a30).() & ReadOnlycxx . . $ QTJSC/ReadOnly.)) |
| 303 | entry->propertyPuttercxx . . $ QTJSC/HashEntry#propertyPutter(60049c78a79ba87).()(exec, thisObj, value); |
| 304 | |
| 305 | return true; |
| 306 | } |
| 307 | |
| 308 | /** |
| 309 | * This one is for "put". |
| 310 | * It calls lookupPut<ThisImp>() to set the value. If that call |
| 311 | * returns false (meaning no entry in the hash table was found), |
| 312 | * then it calls put() on the ParentImp class. |
| 313 | */ |
| 314 | template <class ThisImp, class ParentImp> |
| 315 | inline void lookupPutcxx . . $ QTJSC/lookupPut(fb57046370dd2a66).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const Identifiercxx . . $ QTJSC/Identifier#& propertyName, JSValuecxx . . $ QTJSC/JSValue# value, const HashTablecxx . . $ QTJSC/HashTable#* table, ThisImp* thisObj, PutPropertySlotcxx . . $ QTJSC/PutPropertySlot#& slot) |
| 316 | { |
| 317 | if (!lookupPutcxx . . $ QTJSC/lookupPut(fb57046370dd2a66).<ThisImp>(exec, propertyName, value, table, thisObj)) |
| 318 | thisObj->ParentImp::put(exec, propertyName, value, slot); // not found: forward to parent |
| 319 | } |
| 320 | |
| 321 | } // namespace JSC |
| 322 | |
| 323 | #endif // Lookup_h |