| /* |
| This file is part of the WebKit open source project. |
| This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
| |
| This library is free software; you can redistribute it and/or |
| modify it under the terms of the GNU Library General Public |
| License as published by the Free Software Foundation; either |
| version 2 of the License, or (at your option) any later version. |
| |
| This library is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| Library General Public License for more details. |
| |
| You should have received a copy of the GNU Library General Public License |
| along with this library; see the file COPYING.LIB. If not, write to |
| the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| Boston, MA 02110-1301, USA. |
| */ |
| |
| #include "config.h" |
| #include "JSFloat64Array.h" |
| |
| #include "ExceptionCode.h" |
| #include "JSDOMBinding.h" |
| #include "JSFloat32Array.h" |
| #include <runtime/Error.h> |
| #include <runtime/PropertyNameArray.h> |
| #include <wtf/Float64Array.h> |
| #include <wtf/GetPtr.h> |
| |
| using namespace JSC; |
| |
| namespace WebCore { |
| |
| ASSERT_CLASS_FITS_IN_CELL(JSFloat64Array); |
| |
| /* Hash table */ |
| #if ENABLE(JIT) |
| #define THUNK_GENERATOR(generator) , generator |
| #else |
| #define THUNK_GENERATOR(generator) |
| #endif |
| #if ENABLE(DFG_JIT) |
| #define INTRINSIC(intrinsic) , intrinsic |
| #else |
| #define INTRINSIC(intrinsic) |
| #endif |
| |
| static const HashTableValue JSFloat64ArrayTableValues[] = |
| { |
| { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsFloat64ArrayConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }, |
| { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) } |
| }; |
| |
| #undef THUNK_GENERATOR |
| static const HashTable JSFloat64ArrayTable = { 2, 1, JSFloat64ArrayTableValues, 0 }; |
| /* Hash table for constructor */ |
| #if ENABLE(JIT) |
| #define THUNK_GENERATOR(generator) , generator |
| #else |
| #define THUNK_GENERATOR(generator) |
| #endif |
| #if ENABLE(DFG_JIT) |
| #define INTRINSIC(intrinsic) , intrinsic |
| #else |
| #define INTRINSIC(intrinsic) |
| #endif |
| |
| static const HashTableValue JSFloat64ArrayConstructorTableValues[] = |
| { |
| { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) } |
| }; |
| |
| #undef THUNK_GENERATOR |
| static const HashTable JSFloat64ArrayConstructorTable = { 1, 0, JSFloat64ArrayConstructorTableValues, 0 }; |
| const ClassInfo JSFloat64ArrayConstructor::s_info = { "Float64ArrayConstructor", &DOMConstructorObject::s_info, &JSFloat64ArrayConstructorTable, 0, CREATE_METHOD_TABLE(JSFloat64ArrayConstructor) }; |
| |
| JSFloat64ArrayConstructor::JSFloat64ArrayConstructor(Structure* structure, JSDOMGlobalObject* globalObject) |
| : DOMConstructorObject(structure, globalObject) |
| { |
| } |
| |
| void JSFloat64ArrayConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject) |
| { |
| Base::finishCreation(exec->globalData()); |
| ASSERT(inherits(&s_info)); |
| putDirect(exec->globalData(), exec->propertyNames().prototype, JSFloat64ArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
| } |
| |
| bool JSFloat64ArrayConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
| { |
| return getStaticValueSlot<JSFloat64ArrayConstructor, JSDOMWrapper>(exec, &JSFloat64ArrayConstructorTable, static_cast<JSFloat64ArrayConstructor*>(cell), propertyName, slot); |
| } |
| |
| bool JSFloat64ArrayConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
| { |
| return getStaticValueDescriptor<JSFloat64ArrayConstructor, JSDOMWrapper>(exec, &JSFloat64ArrayConstructorTable, static_cast<JSFloat64ArrayConstructor*>(object), propertyName, descriptor); |
| } |
| |
| ConstructType JSFloat64ArrayConstructor::getConstructData(JSCell*, ConstructData& constructData) |
| { |
| constructData.native.function = constructJSFloat64Array; |
| return ConstructTypeHost; |
| } |
| |
| /* Hash table for prototype */ |
| #if ENABLE(JIT) |
| #define THUNK_GENERATOR(generator) , generator |
| #else |
| #define THUNK_GENERATOR(generator) |
| #endif |
| #if ENABLE(DFG_JIT) |
| #define INTRINSIC(intrinsic) , intrinsic |
| #else |
| #define INTRINSIC(intrinsic) |
| #endif |
| |
| static const HashTableValue JSFloat64ArrayPrototypeTableValues[] = |
| { |
| { "foo", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsFloat64ArrayPrototypeFunctionFoo), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }, |
| { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) } |
| }; |
| |
| #undef THUNK_GENERATOR |
| static const HashTable JSFloat64ArrayPrototypeTable = { 2, 1, JSFloat64ArrayPrototypeTableValues, 0 }; |
| static const HashTable* getJSFloat64ArrayPrototypeTable(ExecState* exec) |
| { |
| return getHashTableForGlobalData(exec->globalData(), &JSFloat64ArrayPrototypeTable); |
| } |
| |
| const ClassInfo JSFloat64ArrayPrototype::s_info = { "Float64ArrayPrototype", &JSC::JSNonFinalObject::s_info, 0, getJSFloat64ArrayPrototypeTable, CREATE_METHOD_TABLE(JSFloat64ArrayPrototype) }; |
| |
| JSObject* JSFloat64ArrayPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
| { |
| return getDOMPrototype<JSFloat64Array>(exec, globalObject); |
| } |
| |
| bool JSFloat64ArrayPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
| { |
| JSFloat64ArrayPrototype* thisObject = jsCast<JSFloat64ArrayPrototype*>(cell); |
| return getStaticFunctionSlot<JSObject>(exec, getJSFloat64ArrayPrototypeTable(exec), thisObject, propertyName, slot); |
| } |
| |
| bool JSFloat64ArrayPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
| { |
| JSFloat64ArrayPrototype* thisObject = jsCast<JSFloat64ArrayPrototype*>(object); |
| return getStaticFunctionDescriptor<JSObject>(exec, getJSFloat64ArrayPrototypeTable(exec), thisObject, propertyName, descriptor); |
| } |
| |
| static const HashTable* getJSFloat64ArrayTable(ExecState* exec) |
| { |
| return getHashTableForGlobalData(exec->globalData(), &JSFloat64ArrayTable); |
| } |
| |
| const ClassInfo JSFloat64Array::s_info = { "Float64Array", &JSArrayBufferView::s_info, 0, getJSFloat64ArrayTable , CREATE_METHOD_TABLE(JSFloat64Array) }; |
| |
| JSFloat64Array::JSFloat64Array(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<Float64Array> impl) |
| : JSArrayBufferView(structure, globalObject, impl) |
| { |
| } |
| |
| void JSFloat64Array::finishCreation(JSGlobalData& globalData) |
| { |
| Base::finishCreation(globalData); |
| ASSERT(inherits(&s_info)); |
| } |
| |
| JSObject* JSFloat64Array::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
| { |
| return JSFloat64ArrayPrototype::create(exec->globalData(), globalObject, JSFloat64ArrayPrototype::createStructure(exec->globalData(), globalObject, JSArrayBufferViewPrototype::self(exec, globalObject))); |
| } |
| |
| bool JSFloat64Array::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
| { |
| JSFloat64Array* thisObject = jsCast<JSFloat64Array*>(cell); |
| ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); |
| bool ok; |
| unsigned index = propertyName.toUInt32(ok); |
| if (ok && index < static_cast<Float64Array*>(thisObject->impl())->length()) { |
| slot.setValue(thisObject->getByIndex(exec, index)); |
| return true; |
| } |
| return getStaticValueSlot<JSFloat64Array, Base>(exec, getJSFloat64ArrayTable(exec), thisObject, propertyName, slot); |
| } |
| |
| bool JSFloat64Array::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
| { |
| JSFloat64Array* thisObject = jsCast<JSFloat64Array*>(object); |
| ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); |
| bool ok; |
| unsigned index = propertyName.toUInt32(ok); |
| if (ok && index < static_cast<Float64Array*>(thisObject->impl())->length()) { |
| descriptor.setDescriptor(thisObject->getByIndex(exec, index), DontDelete); |
| return true; |
| } |
| return getStaticValueDescriptor<JSFloat64Array, Base>(exec, getJSFloat64ArrayTable(exec), thisObject, propertyName, descriptor); |
| } |
| |
| bool JSFloat64Array::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot) |
| { |
| JSFloat64Array* thisObject = jsCast<JSFloat64Array*>(cell); |
| ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); |
| if (propertyName < static_cast<Float64Array*>(thisObject->impl())->length()) { |
| slot.setValue(thisObject->getByIndex(exec, propertyName)); |
| return true; |
| } |
| return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot); |
| } |
| |
| JSValue jsFloat64ArrayConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
| { |
| JSFloat64Array* domObject = static_cast<JSFloat64Array*>(asObject(slotBase)); |
| return JSFloat64Array::getConstructor(exec, domObject->globalObject()); |
| } |
| |
| void JSFloat64Array::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) |
| { |
| JSFloat64Array* thisObject = jsCast<JSFloat64Array*>(cell); |
| ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); |
| bool ok; |
| unsigned index = propertyName.toUInt32(ok); |
| if (ok) { |
| thisObject->indexSetter(exec, index, value); |
| return; |
| } |
| Base::put(thisObject, exec, propertyName, value, slot); |
| } |
| |
| void JSFloat64Array::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value) |
| { |
| JSFloat64Array* thisObject = jsCast<JSFloat64Array*>(cell); |
| ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); |
| thisObject->indexSetter(exec, propertyName, value); |
| return; |
| } |
| |
| void JSFloat64Array::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) |
| { |
| JSFloat64Array* thisObject = jsCast<JSFloat64Array*>(object); |
| ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); |
| for (unsigned i = 0; i < static_cast<Float64Array*>(thisObject->impl())->length(); ++i) |
| propertyNames.add(Identifier::from(exec, i)); |
| Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode); |
| } |
| |
| JSValue JSFloat64Array::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
| { |
| return getDOMConstructor<JSFloat64ArrayConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsFloat64ArrayPrototypeFunctionFoo(ExecState* exec) |
| { |
| JSValue thisValue = exec->hostThisValue(); |
| if (!thisValue.inherits(&JSFloat64Array::s_info)) |
| return throwVMTypeError(exec); |
| JSFloat64Array* castedThis = static_cast<JSFloat64Array*>(asObject(thisValue)); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, &JSFloat64Array::s_info); |
| Float64Array* imp = static_cast<Float64Array*>(castedThis->impl()); |
| if (exec->argumentCount() < 1) |
| return throwVMError(exec, createTypeError(exec, "Not enough arguments")); |
| Float32Array* array(toFloat32Array(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined))); |
| if (exec->hadException()) |
| return JSValue::encode(jsUndefined()); |
| imp->foo(array); |
| return JSValue::encode(jsUndefined()); |
| } |
| |
| |
| JSValue JSFloat64Array::getByIndex(ExecState*, unsigned index) |
| { |
| ASSERT_GC_OBJECT_INHERITS(this, &s_info); |
| double result = static_cast<Float64Array*>(impl())->item(index); |
| if (isnan(result)) |
| return jsNaN(); |
| return JSValue(result); |
| } |
| |
| Float64Array* toFloat64Array(JSC::JSValue value) |
| { |
| return value.inherits(&JSFloat64Array::s_info) ? static_cast<JSFloat64Array*>(asObject(value))->impl() : 0; |
| } |
| |
| } |