WebCore/generated/JSInt16Array.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     1 /*
       
     2     This file is part of the WebKit open source project.
       
     3     This file has been generated by generate-bindings.pl. DO NOT MODIFY!
       
     4 
       
     5     This library is free software; you can redistribute it and/or
       
     6     modify it under the terms of the GNU Library 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     Library General Public License for more details.
       
    14 
       
    15     You should have received a copy of the GNU Library General Public License
       
    16     along with this library; see the file COPYING.LIB.  If not, write to
       
    17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
       
    18     Boston, MA 02110-1301, USA.
       
    19 */
       
    20 
       
    21 #include "config.h"
       
    22 
       
    23 #if ENABLE(3D_CANVAS)
       
    24 
       
    25 #include "JSInt16Array.h"
       
    26 
       
    27 #include "Int16Array.h"
       
    28 #include <runtime/Error.h>
       
    29 #include <runtime/PropertyNameArray.h>
       
    30 #include <wtf/GetPtr.h>
       
    31 
       
    32 using namespace JSC;
       
    33 
       
    34 namespace WebCore {
       
    35 
       
    36 ASSERT_CLASS_FITS_IN_CELL(JSInt16Array);
       
    37 
       
    38 /* Hash table */
       
    39 #if ENABLE(JIT)
       
    40 #define THUNK_GENERATOR(generator) , generator
       
    41 #else
       
    42 #define THUNK_GENERATOR(generator)
       
    43 #endif
       
    44 
       
    45 static const HashTableValue JSInt16ArrayTableValues[2] =
       
    46 {
       
    47     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsInt16ArrayConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
       
    48     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    49 };
       
    50 
       
    51 #undef THUNK_GENERATOR
       
    52 static JSC_CONST_HASHTABLE HashTable JSInt16ArrayTable = { 2, 1, JSInt16ArrayTableValues, 0 };
       
    53 /* Hash table for constructor */
       
    54 #if ENABLE(JIT)
       
    55 #define THUNK_GENERATOR(generator) , generator
       
    56 #else
       
    57 #define THUNK_GENERATOR(generator)
       
    58 #endif
       
    59 
       
    60 static const HashTableValue JSInt16ArrayConstructorTableValues[2] =
       
    61 {
       
    62     { "BYTES_PER_ELEMENT", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsInt16ArrayBYTES_PER_ELEMENT), (intptr_t)0 THUNK_GENERATOR(0) },
       
    63     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    64 };
       
    65 
       
    66 #undef THUNK_GENERATOR
       
    67 static JSC_CONST_HASHTABLE HashTable JSInt16ArrayConstructorTable = { 2, 1, JSInt16ArrayConstructorTableValues, 0 };
       
    68 const ClassInfo JSInt16ArrayConstructor::s_info = { "Int16ArrayConstructor", 0, &JSInt16ArrayConstructorTable, 0 };
       
    69 
       
    70 JSInt16ArrayConstructor::JSInt16ArrayConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
       
    71     : DOMConstructorObject(JSInt16ArrayConstructor::createStructure(globalObject->objectPrototype()), globalObject)
       
    72 {
       
    73     putDirect(exec->propertyNames().prototype, JSInt16ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly);
       
    74 }
       
    75 
       
    76 bool JSInt16ArrayConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    77 {
       
    78     return getStaticValueSlot<JSInt16ArrayConstructor, DOMObject>(exec, &JSInt16ArrayConstructorTable, this, propertyName, slot);
       
    79 }
       
    80 
       
    81 bool JSInt16ArrayConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
    82 {
       
    83     return getStaticValueDescriptor<JSInt16ArrayConstructor, DOMObject>(exec, &JSInt16ArrayConstructorTable, this, propertyName, descriptor);
       
    84 }
       
    85 
       
    86 ConstructType JSInt16ArrayConstructor::getConstructData(ConstructData& constructData)
       
    87 {
       
    88     constructData.native.function = constructJSInt16Array;
       
    89     return ConstructTypeHost;
       
    90 }
       
    91 
       
    92 /* Hash table for prototype */
       
    93 #if ENABLE(JIT)
       
    94 #define THUNK_GENERATOR(generator) , generator
       
    95 #else
       
    96 #define THUNK_GENERATOR(generator)
       
    97 #endif
       
    98 
       
    99 static const HashTableValue JSInt16ArrayPrototypeTableValues[3] =
       
   100 {
       
   101     { "BYTES_PER_ELEMENT", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsInt16ArrayBYTES_PER_ELEMENT), (intptr_t)0 THUNK_GENERATOR(0) },
       
   102     { "set", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsInt16ArrayPrototypeFunctionSet), (intptr_t)0 THUNK_GENERATOR(0) },
       
   103     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
   104 };
       
   105 
       
   106 #undef THUNK_GENERATOR
       
   107 static JSC_CONST_HASHTABLE HashTable JSInt16ArrayPrototypeTable = { 4, 3, JSInt16ArrayPrototypeTableValues, 0 };
       
   108 const ClassInfo JSInt16ArrayPrototype::s_info = { "Int16ArrayPrototype", 0, &JSInt16ArrayPrototypeTable, 0 };
       
   109 
       
   110 JSObject* JSInt16ArrayPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
   111 {
       
   112     return getDOMPrototype<JSInt16Array>(exec, globalObject);
       
   113 }
       
   114 
       
   115 bool JSInt16ArrayPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   116 {
       
   117     return getStaticPropertySlot<JSInt16ArrayPrototype, JSObject>(exec, &JSInt16ArrayPrototypeTable, this, propertyName, slot);
       
   118 }
       
   119 
       
   120 bool JSInt16ArrayPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   121 {
       
   122     return getStaticPropertyDescriptor<JSInt16ArrayPrototype, JSObject>(exec, &JSInt16ArrayPrototypeTable, this, propertyName, descriptor);
       
   123 }
       
   124 
       
   125 const ClassInfo JSInt16Array::s_info = { "Int16Array", &JSArrayBufferView::s_info, &JSInt16ArrayTable, 0 };
       
   126 
       
   127 JSInt16Array::JSInt16Array(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<Int16Array> impl)
       
   128     : JSArrayBufferView(structure, globalObject, impl)
       
   129 {
       
   130 }
       
   131 
       
   132 JSObject* JSInt16Array::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   133 {
       
   134     return new (exec) JSInt16ArrayPrototype(globalObject, JSInt16ArrayPrototype::createStructure(JSArrayBufferViewPrototype::self(exec, globalObject)));
       
   135 }
       
   136 
       
   137 bool JSInt16Array::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   138 {
       
   139     bool ok;
       
   140     unsigned index = propertyName.toUInt32(&ok, false);
       
   141     if (ok && index < static_cast<Int16Array*>(impl())->length()) {
       
   142         slot.setValue(getByIndex(exec, index));
       
   143         return true;
       
   144     }
       
   145     return getStaticValueSlot<JSInt16Array, Base>(exec, &JSInt16ArrayTable, this, propertyName, slot);
       
   146 }
       
   147 
       
   148 bool JSInt16Array::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   149 {
       
   150     bool ok;
       
   151     unsigned index = propertyName.toUInt32(&ok, false);
       
   152     if (ok && index < static_cast<Int16Array*>(impl())->length()) {
       
   153         descriptor.setDescriptor(getByIndex(exec, index), DontDelete);
       
   154         return true;
       
   155     }
       
   156     return getStaticValueDescriptor<JSInt16Array, Base>(exec, &JSInt16ArrayTable, this, propertyName, descriptor);
       
   157 }
       
   158 
       
   159 bool JSInt16Array::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
       
   160 {
       
   161     if (propertyName < static_cast<Int16Array*>(impl())->length()) {
       
   162         slot.setValue(getByIndex(exec, propertyName));
       
   163         return true;
       
   164     }
       
   165     return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
       
   166 }
       
   167 
       
   168 JSValue jsInt16ArrayConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   169 {
       
   170     JSInt16Array* domObject = static_cast<JSInt16Array*>(asObject(slotBase));
       
   171     return JSInt16Array::getConstructor(exec, domObject->globalObject());
       
   172 }
       
   173 void JSInt16Array::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
       
   174 {
       
   175     bool ok;
       
   176     unsigned index = propertyName.toUInt32(&ok, false);
       
   177     if (ok) {
       
   178         indexSetter(exec, index, value);
       
   179         return;
       
   180     }
       
   181     Base::put(exec, propertyName, value, slot);
       
   182 }
       
   183 
       
   184 void JSInt16Array::put(ExecState* exec, unsigned propertyName, JSValue value)
       
   185 {
       
   186     indexSetter(exec, propertyName, value);
       
   187     return;
       
   188 }
       
   189 
       
   190 void JSInt16Array::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
       
   191 {
       
   192     for (unsigned i = 0; i < static_cast<Int16Array*>(impl())->length(); ++i)
       
   193         propertyNames.add(Identifier::from(exec, i));
       
   194      Base::getOwnPropertyNames(exec, propertyNames, mode);
       
   195 }
       
   196 
       
   197 JSValue JSInt16Array::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
       
   198 {
       
   199     return getDOMConstructor<JSInt16ArrayConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
       
   200 }
       
   201 
       
   202 EncodedJSValue JSC_HOST_CALL jsInt16ArrayPrototypeFunctionSet(ExecState* exec)
       
   203 {
       
   204     JSValue thisValue = exec->hostThisValue();
       
   205     if (!thisValue.inherits(&JSInt16Array::s_info))
       
   206         return throwVMTypeError(exec);
       
   207     JSInt16Array* castedThis = static_cast<JSInt16Array*>(asObject(thisValue));
       
   208     return JSValue::encode(castedThis->set(exec));
       
   209 }
       
   210 
       
   211 // Constant getters
       
   212 
       
   213 JSValue jsInt16ArrayBYTES_PER_ELEMENT(ExecState* exec, JSValue, const Identifier&)
       
   214 {
       
   215     return jsNumber(exec, static_cast<int>(2));
       
   216 }
       
   217 
       
   218 
       
   219 JSValue JSInt16Array::getByIndex(ExecState* exec, unsigned index)
       
   220 {
       
   221     return jsNumber(exec, static_cast<Int16Array*>(impl())->item(index));
       
   222 }
       
   223 Int16Array* toInt16Array(JSC::JSValue value)
       
   224 {
       
   225     return value.inherits(&JSInt16Array::s_info) ? static_cast<JSInt16Array*>(asObject(value))->impl() : 0;
       
   226 }
       
   227 
       
   228 }
       
   229 
       
   230 #endif // ENABLE(3D_CANVAS)