| 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 | #include "config.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/config.h`/ |
| 27 | #include "JSByteArray.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSByteArray.h`/ |
| 28 | |
| 29 | #include "JSGlobalObject.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObject.h`/ |
| 30 | #include "PropertyNameArray.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/PropertyNameArray.h`/ |
| 31 | |
| 32 | using namespace WTFcxx . . $ `<built-in>:467:9`!; |
| 33 | |
| 34 | namespace JSCcxx . . $ `<built-in>:463:9`! { |
| 35 | |
| 36 | const ClassInfocxx . . $ QTJSC/ClassInfo# JSByteArraycxx . . $ QTJSC/JSByteArray#::s_defaultInfocxx . . $ QTJSC/JSByteArray#s_defaultInfo. = { "ByteArray", 0, 0, 0 }; |
| 37 | |
| 38 | JSByteArraycxx . . $ QTJSC/JSByteArray#::JSByteArraycxx . . $ QTJSC/JSByteArray#JSByteArray(7360081306676c36).(ExecStatecxx . . $ QTJSC/ExecState#* exec, NonNullPassRefPtrcxx . . $ NonNullPassRefPtr#<Structurecxx . . $ QTJSC/Structure#> structure, ByteArraycxx . . $ QTWTF/ByteArray#* storage, const JSCcxx . . $ `<built-in>:463:9`!::ClassInfocxx . . $ QTJSC/ClassInfo#* classInfo) |
| 39 | : JSObjectcxx . . $ QTJSC/JSObject#(structure) |
| 40 | , m_storage(storage) |
| 41 | , m_classInfocxx . . $ QTJSC/JSByteArray#m_classInfo.(classInfo) |
| 42 | { |
| 43 | putDirectcxx . . $ QTJSC/JSObject#putDirect(ced585bb6c91af73).(exec->globalDatacxx . . $ QTJSC/ExecState#globalData(ae00a65ac2fd4a61).().propertyNamescxx . . $ QTJSC/JSGlobalData#propertyNames.->length, jsNumbercxx . . $ QTJSC/jsNumber(88e66938454912cb).(exec, m_storage->length()), ReadOnlycxx . . $ QTJSC/ReadOnly. | DontDeletecxx . . $ QTJSC/DontDelete.); |
| 44 | } |
| 45 | |
| 46 | #if !ASSERT_DISABLEDcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:71:9`! |
| 47 | JSByteArray::~JSByteArray() |
| 48 | { |
| 49 | ASSERT(vptr() == JSGlobalData::jsByteArrayVPtr); |
| 50 | } |
| 51 | #endif |
| 52 | |
| 53 | |
| 54 | PassRefPtrcxx . . $ PassRefPtr#<Structurecxx . . $ QTJSC/Structure#> JSByteArraycxx . . $ QTJSC/JSByteArray#::createStructurecxx . . $ QTJSC/JSByteArray#createStructure(da75fbe5e97e240f).(JSValuecxx . . $ QTJSC/JSValue# prototype) |
| 55 | { |
| 56 | PassRefPtrcxx . . $ PassRefPtr#<Structurecxx . . $ QTJSC/Structure#> result = Structure::create(prototype, TypeInfo(ObjectType, StructureFlags)); |
| 57 | return result; |
| 58 | } |
| 59 | |
| 60 | bool JSByteArraycxx . . $ QTJSC/JSByteArray#::getOwnPropertySlotcxx . . $ QTJSC/JSByteArray#getOwnPropertySlot(6f4ef3dbfe7d5ab9).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const Identifiercxx . . $ QTJSC/Identifier#& propertyName, PropertySlotcxx . . $ QTJSC/PropertySlot#& slot) |
| 61 | { |
| 62 | bool ok; |
| 63 | unsigned index = propertyName.toUInt32cxx . . $ QTJSC/Identifier#toUInt32(7e25dc0896afbd5b).(&ok, false); |
| 64 | if (ok && canAccessIndexcxx . . $ QTJSC/JSByteArray#canAccessIndex(dfa6e707f7696010).(index)) { |
| 65 | slot.setValuecxx . . $ QTJSC/PropertySlot#setValue(5c2ac18db087b3e6).(getIndexcxx . . $ QTJSC/JSByteArray#getIndex(bf7e02f8c8245e31).(exec, index)); |
| 66 | return true; |
| 67 | } |
| 68 | return JSObjectcxx . . $ QTJSC/JSObject#::getOwnPropertySlotcxx . . $ QTJSC/JSByteArray#getOwnPropertySlot(6f4ef3dbfe7d5ab9).(exec, propertyName, slot); |
| 69 | } |
| 70 | |
| 71 | bool JSByteArraycxx . . $ QTJSC/JSByteArray#::getOwnPropertyDescriptorcxx . . $ QTJSC/JSByteArray#getOwnPropertyDescriptor(dce4ef7012294c32).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const Identifiercxx . . $ QTJSC/Identifier#& propertyName, PropertyDescriptorcxx . . $ QTJSC/PropertyDescriptor#& descriptor) |
| 72 | { |
| 73 | bool ok; |
| 74 | unsigned index = propertyName.toUInt32cxx . . $ QTJSC/Identifier#toUInt32(7e25dc0896afbd5b).(&ok, false); |
| 75 | if (ok && canAccessIndexcxx . . $ QTJSC/JSByteArray#canAccessIndex(dfa6e707f7696010).(index)) { |
| 76 | descriptor.setDescriptorcxx . . $ QTJSC/PropertyDescriptor#setDescriptor(48358939f851dacc).(getIndexcxx . . $ QTJSC/JSByteArray#getIndex(bf7e02f8c8245e31).(exec, index), DontDeletecxx . . $ QTJSC/DontDelete.); |
| 77 | return true; |
| 78 | } |
| 79 | return JSObjectcxx . . $ QTJSC/JSObject#::getOwnPropertyDescriptorcxx . . $ QTJSC/JSObject#getOwnPropertyDescriptor(dce4ef7012294c32).(exec, propertyName, descriptor); |
| 80 | } |
| 81 | |
| 82 | bool JSByteArraycxx . . $ QTJSC/JSByteArray#::getOwnPropertySlotcxx . . $ QTJSC/JSByteArray#getOwnPropertySlot(d57d1c8d4b24d235).(ExecStatecxx . . $ QTJSC/ExecState#* exec, unsigned propertyName, PropertySlotcxx . . $ QTJSC/PropertySlot#& slot) |
| 83 | { |
| 84 | if (canAccessIndexcxx . . $ QTJSC/JSByteArray#canAccessIndex(dfa6e707f7696010).(propertyName)) { |
| 85 | slot.setValuecxx . . $ QTJSC/PropertySlot#setValue(5c2ac18db087b3e6).(getIndexcxx . . $ QTJSC/JSByteArray#getIndex(bf7e02f8c8245e31).(exec, propertyName)); |
| 86 | return true; |
| 87 | } |
| 88 | return JSObjectcxx . . $ QTJSC/JSObject#::getOwnPropertySlotcxx . . $ QTJSC/JSByteArray#getOwnPropertySlot(6f4ef3dbfe7d5ab9).(exec, Identifiercxx . . $ QTJSC/Identifier#::fromcxx . . $ QTJSC/Identifier#from(d1afedae20629715).(exec, propertyName), slot); |
| 89 | } |
| 90 | |
| 91 | void JSByteArraycxx . . $ QTJSC/JSByteArray#::putcxx . . $ QTJSC/JSByteArray#put(dfb3133dafbe9ff4).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const Identifiercxx . . $ QTJSC/Identifier#& propertyName, JSValuecxx . . $ QTJSC/JSValue# value, PutPropertySlotcxx . . $ QTJSC/PutPropertySlot#& slot) |
| 92 | { |
| 93 | bool ok; |
| 94 | unsigned index = propertyName.toUInt32cxx . . $ QTJSC/Identifier#toUInt32(7e25dc0896afbd5b).(&ok, false); |
| 95 | if (ok) { |
| 96 | setIndexcxx . . $ QTJSC/JSByteArray#setIndex(b1b60585cf3bb95).(exec, index, value); |
| 97 | return; |
| 98 | } |
| 99 | JSObjectcxx . . $ QTJSC/JSObject#::putcxx . . $ QTJSC/JSByteArray#put(dfb3133dafbe9ff4).(exec, propertyName, value, slot); |
| 100 | } |
| 101 | |
| 102 | void JSByteArraycxx . . $ QTJSC/JSByteArray#::putcxx . . $ QTJSC/JSByteArray#put(b1b60585cf3bb95).(ExecStatecxx . . $ QTJSC/ExecState#* exec, unsigned propertyName, JSValuecxx . . $ QTJSC/JSValue# value) |
| 103 | { |
| 104 | setIndexcxx . . $ QTJSC/JSByteArray#setIndex(b1b60585cf3bb95).(exec, propertyName, value); |
| 105 | } |
| 106 | |
| 107 | void JSByteArraycxx . . $ QTJSC/JSByteArray#::getOwnPropertyNamescxx . . $ QTJSC/JSByteArray#getOwnPropertyNames(2f9e3f18de200b4e).(ExecStatecxx . . $ QTJSC/ExecState#* exec, PropertyNameArraycxx . . $ QTJSC/PropertyNameArray#& propertyNames, EnumerationModecxx . . $ QTJSC/EnumerationMode# mode) |
| 108 | { |
| 109 | unsigned length = m_storage->length(); |
| 110 | for (unsigned i = 0; i < length; ++i) |
| 111 | propertyNames.addcxx . . $ QTJSC/PropertyNameArray#add(d7ed36c5537ed570).(Identifiercxx . . $ QTJSC/Identifier#::fromcxx . . $ QTJSC/Identifier#from(d1afedae20629715).(exec, i)); |
| 112 | JSObjectcxx . . $ QTJSC/JSObject#::getOwnPropertyNamescxx . . $ QTJSC/JSObject#getOwnPropertyNames(2f9e3f18de200b4e).(exec, propertyNames, mode); |
| 113 | } |
| 114 | |
| 115 | } |
| 116 |