| 1 | /* |
| 2 | * Copyright (C) 2007, 2008 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 | * |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of |
| 14 | * its contributors may be used to endorse or promote products derived |
| 15 | * from this software without specific prior written permission. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
| 18 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 20 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #ifndef JSVariableObject_h |
| 30 | #define JSVariableObject_hcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSVariableObject.h:30:9`! |
| 31 | |
| 32 | #include "JSObject.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.h`/ |
| 33 | #include "Register.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Register.h`/ |
| 34 | #include "SymbolTable.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/SymbolTable.h`/ |
| 35 | #include "UnusedParam.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/UnusedParam.h`/ |
| 36 | #include <wtf/OwnArrayPtr.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/OwnArrayPtr.h`/ |
| 37 | #include <wtf/UnusedParam.h>cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/wtf/UnusedParam.h`/ |
| 38 | |
| 39 | namespace JSCcxx . . $ `<built-in>:463:9`! { |
| 40 | |
| 41 | class Registercxx . . $ QTJSC/Register#; |
| 42 | |
| 43 | class JSVariableObjectcxx . . $ QTJSC/JSVariableObject# : public JSObjectcxx . . $ QTJSC/JSObject# { |
| 44 | friend class JITcxx . . $ QTJSC/JIT#; |
| 45 | |
| 46 | public: |
| 47 | SymbolTablecxx . . $ QTJSC/SymbolTable#& symbolTablecxx . . $ QTJSC/JSVariableObject#symbolTable(322f943048330fa4).() const { return *dcxx . . $ QTJSC/JSVariableObject#d.->symbolTablecxx . . $ QTJSC/JSVariableObject#JSVariableObjectData#symbolTable.; } |
| 48 | |
| 49 | virtual void putWithAttributescxx . . $ QTJSC/JSVariableObject#putWithAttributes(3dd2e6313723688d).(ExecStatecxx . . $ QTJSC/ExecState#*, const Identifiercxx . . $ QTJSC/Identifier#&, JSValuecxx . . $ QTJSC/JSValue#, unsigned attributes) = 0; |
| 50 | |
| 51 | virtual bool deletePropertycxx . . $ QTJSC/JSVariableObject#deleteProperty(13154ef9bddc9416).(ExecStatecxx . . $ QTJSC/ExecState#*, const Identifiercxx . . $ QTJSC/Identifier#&); |
| 52 | virtual void getOwnPropertyNamescxx . . $ QTJSC/JSVariableObject#getOwnPropertyNames(2f9e3f18de200b4e).(ExecStatecxx . . $ QTJSC/ExecState#*, PropertyNameArraycxx . . $ QTJSC/PropertyNameArray#&, EnumerationModecxx . . $ QTJSC/EnumerationMode# mode = ExcludeDontEnumPropertiescxx . . $ QTJSC/ExcludeDontEnumProperties.); |
| 53 | |
| 54 | virtual bool isVariableObjectcxx . . $ QTJSC/JSVariableObject#isVariableObject(50ce9a9e25b4a850).() const; |
| 55 | virtual bool isDynamicScopecxx . . $ QTJSC/JSVariableObject#isDynamicScope(50ce9a9e25b4a850).() const = 0; |
| 56 | |
| 57 | Registercxx . . $ QTJSC/Register#& registerAtcxx . . $ QTJSC/JSVariableObject#registerAt(a26ae29072816692).(int index) const { return dcxx . . $ QTJSC/JSVariableObject#d.->registerscxx . . $ QTJSC/JSVariableObject#JSVariableObjectData#registers.[index]; } |
| 58 | |
| 59 | static PassRefPtrcxx . . $ PassRefPtr#<Structurecxx . . $ QTJSC/Structure#> createStructurecxx . . $ QTJSC/JSVariableObject#createStructure(da75fbe5e97e240f).(JSValuecxx . . $ QTJSC/JSValue# prototype) |
| 60 | { |
| 61 | return Structure::create(prototype, TypeInfocxx . . $ QTJSC/TypeInfo#TypeInfo(85e540a0e5560fef).(ObjectTypecxx . . $ QTJSC/ObjectType., StructureFlagscxx . . $ QTJSC/JSVariableObject#StructureFlags.)); |
| 62 | } |
| 63 | |
| 64 | protected: |
| 65 | static const unsigned StructureFlagscxx . . $ QTJSC/JSVariableObject#StructureFlags. = OverridesGetPropertyNamescxx . . $ QTJSC/OverridesGetPropertyNames. | JSObjectcxx . . $ QTJSC/JSObject#::StructureFlagscxx . . $ QTJSC/JSObject#StructureFlags.; |
| 66 | // Subclasses of JSVariableObject can subclass this struct to add data |
| 67 | // without increasing their own size (since there's a hard limit on the |
| 68 | // size of a JSCell). |
| 69 | struct JSVariableObjectDatacxx . . $ QTJSC/JSVariableObject#JSVariableObjectData# { |
| 70 | JSVariableObjectDatacxx . . $ QTJSC/JSVariableObject#JSVariableObjectData#JSVariableObjectData(5f52b9e7b04f3c40).(SymbolTablecxx . . $ QTJSC/SymbolTable#* symbolTable, Registercxx . . $ QTJSC/Register#* registers) |
| 71 | : symbolTablecxx . . $ QTJSC/JSVariableObject#JSVariableObjectData#symbolTable.(symbolTable) |
| 72 | , registerscxx . . $ QTJSC/JSVariableObject#JSVariableObjectData#registers.(registers) |
| 73 | { |
| 74 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(symbolTable); |
| 75 | } |
| 76 | |
| 77 | SymbolTablecxx . . $ QTJSC/SymbolTable#* symbolTablecxx . . $ QTJSC/JSVariableObject#JSVariableObjectData#symbolTable.; // Maps name -> offset from "r" in register file. |
| 78 | Registercxx . . $ QTJSC/Register#* registerscxx . . $ QTJSC/JSVariableObject#JSVariableObjectData#registers.; // "r" in the register file. |
| 79 | OwnArrayPtrcxx . . $ OwnArrayPtr#<Registercxx . . $ QTJSC/Register#> registerArraycxx . . $ QTJSC/JSVariableObject#JSVariableObjectData#registerArray.; // Independent copy of registers, used when a variable object copies its registers out of the register file. |
| 80 | |
| 81 | private: |
| 82 | JSVariableObjectDatacxx . . $ QTJSC/JSVariableObject#JSVariableObjectData#JSVariableObjectData(b38a3a525f274178).(const JSVariableObjectDatacxx . . $ QTJSC/JSVariableObject#JSVariableObjectData#&); |
| 83 | JSVariableObjectDatacxx . . $ QTJSC/JSVariableObject#JSVariableObjectData#& operatorcxx . . $ QTJSC/JSVariableObject#JSVariableObjectData#`operator=`(effdf31488bcfce7).=(const JSVariableObjectDatacxx . . $ QTJSC/JSVariableObject#JSVariableObjectData#&); |
| 84 | }; |
| 85 | |
| 86 | JSVariableObjectcxx . . $ QTJSC/JSVariableObject#JSVariableObject(46e2e3a17c483808).(NonNullPassRefPtrcxx . . $ NonNullPassRefPtr#<Structurecxx . . $ QTJSC/Structure#> structure, JSVariableObjectDatacxx . . $ QTJSC/JSVariableObject#JSVariableObjectData#* data) |
| 87 | : JSObjectcxx . . $ QTJSC/JSObject#(structure) |
| 88 | , dcxx . . $ QTJSC/JSVariableObject#d.(data) // Subclass owns this pointer. |
| 89 | { |
| 90 | } |
| 91 | |
| 92 | Registercxx . . $ QTJSC/Register#* copyRegisterArraycxx . . $ QTJSC/JSVariableObject#copyRegisterArray(f138834e99c40dca).(Registercxx . . $ QTJSC/Register#* src, size_tcxx . . $ size_t# count); |
| 93 | void setRegisterscxx . . $ QTJSC/JSVariableObject#setRegisters(db765aed4a7dcca8).(Registercxx . . $ QTJSC/Register#* r, Registercxx . . $ QTJSC/Register#* registerArray); |
| 94 | |
| 95 | bool symbolTableGetcxx . . $ QTJSC/JSVariableObject#symbolTableGet(391045bfc0f9285).(const Identifiercxx . . $ QTJSC/Identifier#&, PropertySlotcxx . . $ QTJSC/PropertySlot#&); |
| 96 | bool symbolTableGetcxx . . $ QTJSC/JSVariableObject#symbolTableGet(731403b11dc42711).(const Identifiercxx . . $ QTJSC/Identifier#&, PropertyDescriptorcxx . . $ QTJSC/PropertyDescriptor#&); |
| 97 | bool symbolTableGetcxx . . $ QTJSC/JSVariableObject#symbolTableGet(2e9eebcaebd87d2b).(const Identifiercxx . . $ QTJSC/Identifier#&, PropertySlotcxx . . $ QTJSC/PropertySlot#&, bool& slotIsWriteable); |
| 98 | bool symbolTablePutcxx . . $ QTJSC/JSVariableObject#symbolTablePut(fed57b58e1b3b689).(const Identifiercxx . . $ QTJSC/Identifier#&, JSValuecxx . . $ QTJSC/JSValue#); |
| 99 | bool symbolTablePutWithAttributescxx . . $ QTJSC/JSVariableObject#symbolTablePutWithAttributes(689229d65cb128e1).(const Identifiercxx . . $ QTJSC/Identifier#&, JSValuecxx . . $ QTJSC/JSValue#, unsigned attributes); |
| 100 | |
| 101 | JSVariableObjectDatacxx . . $ QTJSC/JSVariableObject#JSVariableObjectData#* dcxx . . $ QTJSC/JSVariableObject#d.; |
| 102 | }; |
| 103 | |
| 104 | inline bool JSVariableObjectcxx . . $ QTJSC/JSVariableObject#::symbolTableGetcxx . . $ QTJSC/JSVariableObject#symbolTableGet(391045bfc0f9285).(const Identifiercxx . . $ QTJSC/Identifier#& propertyName, PropertySlotcxx . . $ QTJSC/PropertySlot#& slot) |
| 105 | { |
| 106 | SymbolTableEntrycxx . . $ QTJSC/SymbolTableEntry# entry = symbolTablecxx . . $ QTJSC/JSVariableObject#symbolTable(322f943048330fa4).().inlineGet(propertyName.ustringcxx . . $ QTJSC/Identifier#ustring(de21ee9ecbd506fd).().repcxx . . $ QTJSC/UString#rep(eff8ac5d0836371c).()); |
| 107 | if (!entry.isNullcxx . . $ QTJSC/SymbolTableEntry#isNull(50ce9a9e25b4a850).()) { |
| 108 | slot.setRegisterSlotcxx . . $ QTJSC/PropertySlot#setRegisterSlot(2654b274bd0f5c24).(®isterAtcxx . . $ QTJSC/JSVariableObject#registerAt(a26ae29072816692).(entry.getIndexcxx . . $ QTJSC/SymbolTableEntry#getIndex(455f465bc33b4cdf).())); |
| 109 | return true; |
| 110 | } |
| 111 | return false; |
| 112 | } |
| 113 | |
| 114 | inline bool JSVariableObjectcxx . . $ QTJSC/JSVariableObject#::symbolTableGetcxx . . $ QTJSC/JSVariableObject#symbolTableGet(2e9eebcaebd87d2b).(const Identifiercxx . . $ QTJSC/Identifier#& propertyName, PropertySlotcxx . . $ QTJSC/PropertySlot#& slot, bool& slotIsWriteable) |
| 115 | { |
| 116 | SymbolTableEntrycxx . . $ QTJSC/SymbolTableEntry# entry = symbolTablecxx . . $ QTJSC/JSVariableObject#symbolTable(322f943048330fa4).().inlineGet(propertyName.ustringcxx . . $ QTJSC/Identifier#ustring(de21ee9ecbd506fd).().repcxx . . $ QTJSC/UString#rep(eff8ac5d0836371c).()); |
| 117 | if (!entry.isNullcxx . . $ QTJSC/SymbolTableEntry#isNull(50ce9a9e25b4a850).()) { |
| 118 | slot.setRegisterSlotcxx . . $ QTJSC/PropertySlot#setRegisterSlot(2654b274bd0f5c24).(®isterAtcxx . . $ QTJSC/JSVariableObject#registerAt(a26ae29072816692).(entry.getIndexcxx . . $ QTJSC/SymbolTableEntry#getIndex(455f465bc33b4cdf).())); |
| 119 | slotIsWriteable = !entry.isReadOnlycxx . . $ QTJSC/SymbolTableEntry#isReadOnly(50ce9a9e25b4a850).(); |
| 120 | return true; |
| 121 | } |
| 122 | return false; |
| 123 | } |
| 124 | |
| 125 | inline bool JSVariableObjectcxx . . $ QTJSC/JSVariableObject#::symbolTablePutcxx . . $ QTJSC/JSVariableObject#symbolTablePut(fed57b58e1b3b689).(const Identifiercxx . . $ QTJSC/Identifier#& propertyName, JSValuecxx . . $ QTJSC/JSValue# value) |
| 126 | { |
| 127 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); |
| 128 | |
| 129 | SymbolTableEntrycxx . . $ QTJSC/SymbolTableEntry# entry = symbolTablecxx . . $ QTJSC/JSVariableObject#symbolTable(322f943048330fa4).().inlineGet(propertyName.ustringcxx . . $ QTJSC/Identifier#ustring(de21ee9ecbd506fd).().repcxx . . $ QTJSC/UString#rep(eff8ac5d0836371c).()); |
| 130 | if (entry.isNullcxx . . $ QTJSC/SymbolTableEntry#isNull(50ce9a9e25b4a850).()) |
| 131 | return false; |
| 132 | if (entry.isReadOnlycxx . . $ QTJSC/SymbolTableEntry#isReadOnly(50ce9a9e25b4a850).()) |
| 133 | return true; |
| 134 | registerAtcxx . . $ QTJSC/JSVariableObject#registerAt(a26ae29072816692).(entry.getIndexcxx . . $ QTJSC/SymbolTableEntry#getIndex(455f465bc33b4cdf).()) =cxx . . $ QTJSC/Register#`operator=`(812d218e081e87f4). value; |
| 135 | return true; |
| 136 | } |
| 137 | |
| 138 | inline bool JSVariableObjectcxx . . $ QTJSC/JSVariableObject#::symbolTablePutWithAttributescxx . . $ QTJSC/JSVariableObject#symbolTablePutWithAttributes(689229d65cb128e1).(const Identifiercxx . . $ QTJSC/Identifier#& propertyName, JSValuecxx . . $ QTJSC/JSValue# value, unsigned attributes) |
| 139 | { |
| 140 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); |
| 141 | |
| 142 | SymbolTable::iterator iter = symbolTablecxx . . $ QTJSC/JSVariableObject#symbolTable(322f943048330fa4).().find(propertyName.ustringcxx . . $ QTJSC/Identifier#ustring(de21ee9ecbd506fd).().repcxx . . $ QTJSC/UString#rep(eff8ac5d0836371c).()); |
| 143 | if (iter ==cxx . . $ QTJSC/`operator==`(bc6534faf07112b1). symbolTablecxx . . $ QTJSC/JSVariableObject#symbolTable(322f943048330fa4).().end()) |
| 144 | return false; |
| 145 | SymbolTableEntrycxx . . $ QTJSC/SymbolTableEntry#& entry = iter->second; |
| 146 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(!entry.isNull()); |
| 147 | entry.setAttributescxx . . $ QTJSC/SymbolTableEntry#setAttributes(cb2f890c2fdad230).(attributes); |
| 148 | registerAtcxx . . $ QTJSC/JSVariableObject#registerAt(a26ae29072816692).(entry.getIndexcxx . . $ QTJSC/SymbolTableEntry#getIndex(455f465bc33b4cdf).()) =cxx . . $ QTJSC/Register#`operator=`(812d218e081e87f4). value; |
| 149 | return true; |
| 150 | } |
| 151 | |
| 152 | inline Registercxx . . $ QTJSC/Register#* JSVariableObjectcxx . . $ QTJSC/JSVariableObject#::copyRegisterArraycxx . . $ QTJSC/JSVariableObject#copyRegisterArray(f138834e99c40dca).(Registercxx . . $ QTJSC/Register#* src, size_tcxx . . $ size_t# count) |
| 153 | { |
| 154 | Registercxx . . $ QTJSC/Register#* registerArray = new Registercxx . . $ QTJSC/Register#[count]; |
| 155 | memcpy(registerArray, src, count * sizeof(Registercxx . . $ QTJSC/Register#)); |
| 156 | |
| 157 | return registerArray; |
| 158 | } |
| 159 | |
| 160 | inline void JSVariableObjectcxx . . $ QTJSC/JSVariableObject#::setRegisterscxx . . $ QTJSC/JSVariableObject#setRegisters(db765aed4a7dcca8).(Registercxx . . $ QTJSC/Register#* registers, Registercxx . . $ QTJSC/Register#* registerArray) |
| 161 | { |
| 162 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(registerArray != d->registerArray.get()); |
| 163 | dcxx . . $ QTJSC/JSVariableObject#d.->registerArray.set(registerArray); |
| 164 | dcxx . . $ QTJSC/JSVariableObject#d.->registerscxx . . $ QTJSC/JSVariableObject#JSVariableObjectData#registers. = registers; |
| 165 | } |
| 166 | |
| 167 | } // namespace JSC |
| 168 | |
| 169 | #endif // JSVariableObject_h |