2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
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.
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.
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.
22 #include "JSDataView.h"
25 #include "ExceptionCode.h"
26 #include "JSDOMBinding.h"
27 #include <runtime/Error.h>
28 #include <wtf/GetPtr.h>
34 ASSERT_CLASS_FITS_IN_CELL(JSDataView);
38 #define THUNK_GENERATOR(generator) , generator
40 #define THUNK_GENERATOR(generator)
43 #define INTRINSIC(intrinsic) , intrinsic
45 #define INTRINSIC(intrinsic)
48 static const HashTableValue JSDataViewTableValues[] =
50 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDataViewConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
51 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
54 #undef THUNK_GENERATOR
55 static const HashTable JSDataViewTable = { 2, 1, JSDataViewTableValues, 0 };
56 /* Hash table for constructor */
58 #define THUNK_GENERATOR(generator) , generator
60 #define THUNK_GENERATOR(generator)
63 #define INTRINSIC(intrinsic) , intrinsic
65 #define INTRINSIC(intrinsic)
68 static const HashTableValue JSDataViewConstructorTableValues[] =
70 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
73 #undef THUNK_GENERATOR
74 static const HashTable JSDataViewConstructorTable = { 1, 0, JSDataViewConstructorTableValues, 0 };
75 const ClassInfo JSDataViewConstructor::s_info = { "DataViewConstructor", &DOMConstructorObject::s_info, &JSDataViewConstructorTable, 0, CREATE_METHOD_TABLE(JSDataViewConstructor) };
77 JSDataViewConstructor::JSDataViewConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
78 : DOMConstructorObject(structure, globalObject)
82 void JSDataViewConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
84 Base::finishCreation(exec->globalData());
85 ASSERT(inherits(&s_info));
86 putDirect(exec->globalData(), exec->propertyNames().prototype, JSDataViewPrototype::self(exec, globalObject), DontDelete | ReadOnly);
89 bool JSDataViewConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
91 return getStaticValueSlot<JSDataViewConstructor, JSDOMWrapper>(exec, &JSDataViewConstructorTable, static_cast<JSDataViewConstructor*>(cell), propertyName, slot);
94 bool JSDataViewConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
96 return getStaticValueDescriptor<JSDataViewConstructor, JSDOMWrapper>(exec, &JSDataViewConstructorTable, static_cast<JSDataViewConstructor*>(object), propertyName, descriptor);
99 ConstructType JSDataViewConstructor::getConstructData(JSCell*, ConstructData& constructData)
101 constructData.native.function = constructJSDataView;
102 return ConstructTypeHost;
105 /* Hash table for prototype */
107 #define THUNK_GENERATOR(generator) , generator
109 #define THUNK_GENERATOR(generator)
112 #define INTRINSIC(intrinsic) , intrinsic
114 #define INTRINSIC(intrinsic)
117 static const HashTableValue JSDataViewPrototypeTableValues[] =
119 { "getInt8", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDataViewPrototypeFunctionGetInt8), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
120 { "getUint8", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDataViewPrototypeFunctionGetUint8), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
121 { "getInt16", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDataViewPrototypeFunctionGetInt16), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
122 { "getUint16", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDataViewPrototypeFunctionGetUint16), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
123 { "getInt32", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDataViewPrototypeFunctionGetInt32), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
124 { "getUint32", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDataViewPrototypeFunctionGetUint32), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
125 { "getFloat32", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDataViewPrototypeFunctionGetFloat32), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
126 { "getFloat64", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDataViewPrototypeFunctionGetFloat64), (intptr_t)2 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
127 { "setInt8", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDataViewPrototypeFunctionSetInt8), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
128 { "setUint8", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDataViewPrototypeFunctionSetUint8), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
129 { "setInt16", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDataViewPrototypeFunctionSetInt16), (intptr_t)3 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
130 { "setUint16", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDataViewPrototypeFunctionSetUint16), (intptr_t)3 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
131 { "setInt32", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDataViewPrototypeFunctionSetInt32), (intptr_t)3 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
132 { "setUint32", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDataViewPrototypeFunctionSetUint32), (intptr_t)3 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
133 { "setFloat32", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDataViewPrototypeFunctionSetFloat32), (intptr_t)3 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
134 { "setFloat64", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDataViewPrototypeFunctionSetFloat64), (intptr_t)3 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
135 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
138 #undef THUNK_GENERATOR
139 static const HashTable JSDataViewPrototypeTable = { 37, 31, JSDataViewPrototypeTableValues, 0 };
140 static const HashTable* getJSDataViewPrototypeTable(ExecState* exec)
142 return getHashTableForGlobalData(exec->globalData(), &JSDataViewPrototypeTable);
145 const ClassInfo JSDataViewPrototype::s_info = { "DataViewPrototype", &JSC::JSNonFinalObject::s_info, 0, getJSDataViewPrototypeTable, CREATE_METHOD_TABLE(JSDataViewPrototype) };
147 JSObject* JSDataViewPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
149 return getDOMPrototype<JSDataView>(exec, globalObject);
152 bool JSDataViewPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
154 JSDataViewPrototype* thisObject = jsCast<JSDataViewPrototype*>(cell);
155 return getStaticFunctionSlot<JSObject>(exec, getJSDataViewPrototypeTable(exec), thisObject, propertyName, slot);
158 bool JSDataViewPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
160 JSDataViewPrototype* thisObject = jsCast<JSDataViewPrototype*>(object);
161 return getStaticFunctionDescriptor<JSObject>(exec, getJSDataViewPrototypeTable(exec), thisObject, propertyName, descriptor);
164 static const HashTable* getJSDataViewTable(ExecState* exec)
166 return getHashTableForGlobalData(exec->globalData(), &JSDataViewTable);
169 const ClassInfo JSDataView::s_info = { "DataView", &JSArrayBufferView::s_info, 0, getJSDataViewTable , CREATE_METHOD_TABLE(JSDataView) };
171 JSDataView::JSDataView(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<DataView> impl)
172 : JSArrayBufferView(structure, globalObject, impl)
176 void JSDataView::finishCreation(JSGlobalData& globalData)
178 Base::finishCreation(globalData);
179 ASSERT(inherits(&s_info));
182 JSObject* JSDataView::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
184 return JSDataViewPrototype::create(exec->globalData(), globalObject, JSDataViewPrototype::createStructure(exec->globalData(), globalObject, JSArrayBufferViewPrototype::self(exec, globalObject)));
187 bool JSDataView::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
189 JSDataView* thisObject = jsCast<JSDataView*>(cell);
190 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
191 return getStaticValueSlot<JSDataView, Base>(exec, getJSDataViewTable(exec), thisObject, propertyName, slot);
194 bool JSDataView::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
196 JSDataView* thisObject = jsCast<JSDataView*>(object);
197 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
198 return getStaticValueDescriptor<JSDataView, Base>(exec, getJSDataViewTable(exec), thisObject, propertyName, descriptor);
201 JSValue jsDataViewConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
203 JSDataView* domObject = static_cast<JSDataView*>(asObject(slotBase));
204 return JSDataView::getConstructor(exec, domObject->globalObject());
207 JSValue JSDataView::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
209 return getDOMConstructor<JSDataViewConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
212 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionGetInt8(ExecState* exec)
214 JSValue thisValue = exec->hostThisValue();
215 if (!thisValue.inherits(&JSDataView::s_info))
216 return throwVMTypeError(exec);
217 JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
218 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info);
219 return JSValue::encode(castedThis->getInt8(exec));
222 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionGetUint8(ExecState* exec)
224 JSValue thisValue = exec->hostThisValue();
225 if (!thisValue.inherits(&JSDataView::s_info))
226 return throwVMTypeError(exec);
227 JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
228 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info);
229 return JSValue::encode(castedThis->getUint8(exec));
232 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionGetInt16(ExecState* exec)
234 JSValue thisValue = exec->hostThisValue();
235 if (!thisValue.inherits(&JSDataView::s_info))
236 return throwVMTypeError(exec);
237 JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
238 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info);
239 DataView* imp = static_cast<DataView*>(castedThis->impl());
240 if (exec->argumentCount() < 1)
241 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
242 ExceptionCode ec = 0;
243 unsigned byteOffset(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
244 if (exec->hadException())
245 return JSValue::encode(jsUndefined());
247 size_t argsCount = exec->argumentCount();
248 if (argsCount <= 1) {
250 JSC::JSValue result = jsNumber(imp->getInt16(byteOffset, ec));
251 setDOMException(exec, ec);
252 return JSValue::encode(result);
255 bool littleEndian(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toBoolean(exec));
256 if (exec->hadException())
257 return JSValue::encode(jsUndefined());
259 JSC::JSValue result = jsNumber(imp->getInt16(byteOffset, littleEndian, ec));
260 setDOMException(exec, ec);
261 return JSValue::encode(result);
264 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionGetUint16(ExecState* exec)
266 JSValue thisValue = exec->hostThisValue();
267 if (!thisValue.inherits(&JSDataView::s_info))
268 return throwVMTypeError(exec);
269 JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
270 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info);
271 DataView* imp = static_cast<DataView*>(castedThis->impl());
272 if (exec->argumentCount() < 1)
273 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
274 ExceptionCode ec = 0;
275 unsigned byteOffset(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
276 if (exec->hadException())
277 return JSValue::encode(jsUndefined());
279 size_t argsCount = exec->argumentCount();
280 if (argsCount <= 1) {
282 JSC::JSValue result = jsNumber(imp->getUint16(byteOffset, ec));
283 setDOMException(exec, ec);
284 return JSValue::encode(result);
287 bool littleEndian(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toBoolean(exec));
288 if (exec->hadException())
289 return JSValue::encode(jsUndefined());
291 JSC::JSValue result = jsNumber(imp->getUint16(byteOffset, littleEndian, ec));
292 setDOMException(exec, ec);
293 return JSValue::encode(result);
296 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionGetInt32(ExecState* exec)
298 JSValue thisValue = exec->hostThisValue();
299 if (!thisValue.inherits(&JSDataView::s_info))
300 return throwVMTypeError(exec);
301 JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
302 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info);
303 DataView* imp = static_cast<DataView*>(castedThis->impl());
304 if (exec->argumentCount() < 1)
305 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
306 ExceptionCode ec = 0;
307 unsigned byteOffset(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
308 if (exec->hadException())
309 return JSValue::encode(jsUndefined());
311 size_t argsCount = exec->argumentCount();
312 if (argsCount <= 1) {
314 JSC::JSValue result = jsNumber(imp->getInt32(byteOffset, ec));
315 setDOMException(exec, ec);
316 return JSValue::encode(result);
319 bool littleEndian(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toBoolean(exec));
320 if (exec->hadException())
321 return JSValue::encode(jsUndefined());
323 JSC::JSValue result = jsNumber(imp->getInt32(byteOffset, littleEndian, ec));
324 setDOMException(exec, ec);
325 return JSValue::encode(result);
328 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionGetUint32(ExecState* exec)
330 JSValue thisValue = exec->hostThisValue();
331 if (!thisValue.inherits(&JSDataView::s_info))
332 return throwVMTypeError(exec);
333 JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
334 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info);
335 DataView* imp = static_cast<DataView*>(castedThis->impl());
336 if (exec->argumentCount() < 1)
337 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
338 ExceptionCode ec = 0;
339 unsigned byteOffset(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
340 if (exec->hadException())
341 return JSValue::encode(jsUndefined());
343 size_t argsCount = exec->argumentCount();
344 if (argsCount <= 1) {
346 JSC::JSValue result = jsNumber(imp->getUint32(byteOffset, ec));
347 setDOMException(exec, ec);
348 return JSValue::encode(result);
351 bool littleEndian(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toBoolean(exec));
352 if (exec->hadException())
353 return JSValue::encode(jsUndefined());
355 JSC::JSValue result = jsNumber(imp->getUint32(byteOffset, littleEndian, ec));
356 setDOMException(exec, ec);
357 return JSValue::encode(result);
360 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionGetFloat32(ExecState* exec)
362 JSValue thisValue = exec->hostThisValue();
363 if (!thisValue.inherits(&JSDataView::s_info))
364 return throwVMTypeError(exec);
365 JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
366 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info);
367 return JSValue::encode(castedThis->getFloat32(exec));
370 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionGetFloat64(ExecState* exec)
372 JSValue thisValue = exec->hostThisValue();
373 if (!thisValue.inherits(&JSDataView::s_info))
374 return throwVMTypeError(exec);
375 JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
376 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info);
377 return JSValue::encode(castedThis->getFloat64(exec));
380 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetInt8(ExecState* exec)
382 JSValue thisValue = exec->hostThisValue();
383 if (!thisValue.inherits(&JSDataView::s_info))
384 return throwVMTypeError(exec);
385 JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
386 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info);
387 return JSValue::encode(castedThis->setInt8(exec));
390 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetUint8(ExecState* exec)
392 JSValue thisValue = exec->hostThisValue();
393 if (!thisValue.inherits(&JSDataView::s_info))
394 return throwVMTypeError(exec);
395 JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
396 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info);
397 return JSValue::encode(castedThis->setUint8(exec));
400 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetInt16(ExecState* exec)
402 JSValue thisValue = exec->hostThisValue();
403 if (!thisValue.inherits(&JSDataView::s_info))
404 return throwVMTypeError(exec);
405 JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
406 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info);
407 DataView* imp = static_cast<DataView*>(castedThis->impl());
408 if (exec->argumentCount() < 2)
409 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
410 ExceptionCode ec = 0;
411 unsigned byteOffset(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
412 if (exec->hadException())
413 return JSValue::encode(jsUndefined());
414 short value(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toInt32(exec));
415 if (exec->hadException())
416 return JSValue::encode(jsUndefined());
418 size_t argsCount = exec->argumentCount();
419 if (argsCount <= 2) {
420 imp->setInt16(byteOffset, value, ec);
421 setDOMException(exec, ec);
422 return JSValue::encode(jsUndefined());
425 bool littleEndian(MAYBE_MISSING_PARAMETER(exec, 2, MissingIsUndefined).toBoolean(exec));
426 if (exec->hadException())
427 return JSValue::encode(jsUndefined());
428 imp->setInt16(byteOffset, value, littleEndian, ec);
429 setDOMException(exec, ec);
430 return JSValue::encode(jsUndefined());
433 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetUint16(ExecState* exec)
435 JSValue thisValue = exec->hostThisValue();
436 if (!thisValue.inherits(&JSDataView::s_info))
437 return throwVMTypeError(exec);
438 JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
439 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info);
440 DataView* imp = static_cast<DataView*>(castedThis->impl());
441 if (exec->argumentCount() < 2)
442 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
443 ExceptionCode ec = 0;
444 unsigned byteOffset(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
445 if (exec->hadException())
446 return JSValue::encode(jsUndefined());
447 unsigned short value(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toUInt32(exec));
448 if (exec->hadException())
449 return JSValue::encode(jsUndefined());
451 size_t argsCount = exec->argumentCount();
452 if (argsCount <= 2) {
453 imp->setUint16(byteOffset, value, ec);
454 setDOMException(exec, ec);
455 return JSValue::encode(jsUndefined());
458 bool littleEndian(MAYBE_MISSING_PARAMETER(exec, 2, MissingIsUndefined).toBoolean(exec));
459 if (exec->hadException())
460 return JSValue::encode(jsUndefined());
461 imp->setUint16(byteOffset, value, littleEndian, ec);
462 setDOMException(exec, ec);
463 return JSValue::encode(jsUndefined());
466 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetInt32(ExecState* exec)
468 JSValue thisValue = exec->hostThisValue();
469 if (!thisValue.inherits(&JSDataView::s_info))
470 return throwVMTypeError(exec);
471 JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
472 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info);
473 DataView* imp = static_cast<DataView*>(castedThis->impl());
474 if (exec->argumentCount() < 2)
475 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
476 ExceptionCode ec = 0;
477 unsigned byteOffset(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
478 if (exec->hadException())
479 return JSValue::encode(jsUndefined());
480 int value(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toInt32(exec));
481 if (exec->hadException())
482 return JSValue::encode(jsUndefined());
484 size_t argsCount = exec->argumentCount();
485 if (argsCount <= 2) {
486 imp->setInt32(byteOffset, value, ec);
487 setDOMException(exec, ec);
488 return JSValue::encode(jsUndefined());
491 bool littleEndian(MAYBE_MISSING_PARAMETER(exec, 2, MissingIsUndefined).toBoolean(exec));
492 if (exec->hadException())
493 return JSValue::encode(jsUndefined());
494 imp->setInt32(byteOffset, value, littleEndian, ec);
495 setDOMException(exec, ec);
496 return JSValue::encode(jsUndefined());
499 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetUint32(ExecState* exec)
501 JSValue thisValue = exec->hostThisValue();
502 if (!thisValue.inherits(&JSDataView::s_info))
503 return throwVMTypeError(exec);
504 JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
505 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info);
506 DataView* imp = static_cast<DataView*>(castedThis->impl());
507 if (exec->argumentCount() < 2)
508 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
509 ExceptionCode ec = 0;
510 unsigned byteOffset(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
511 if (exec->hadException())
512 return JSValue::encode(jsUndefined());
513 unsigned value(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toUInt32(exec));
514 if (exec->hadException())
515 return JSValue::encode(jsUndefined());
517 size_t argsCount = exec->argumentCount();
518 if (argsCount <= 2) {
519 imp->setUint32(byteOffset, value, ec);
520 setDOMException(exec, ec);
521 return JSValue::encode(jsUndefined());
524 bool littleEndian(MAYBE_MISSING_PARAMETER(exec, 2, MissingIsUndefined).toBoolean(exec));
525 if (exec->hadException())
526 return JSValue::encode(jsUndefined());
527 imp->setUint32(byteOffset, value, littleEndian, ec);
528 setDOMException(exec, ec);
529 return JSValue::encode(jsUndefined());
532 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetFloat32(ExecState* exec)
534 JSValue thisValue = exec->hostThisValue();
535 if (!thisValue.inherits(&JSDataView::s_info))
536 return throwVMTypeError(exec);
537 JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
538 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info);
539 DataView* imp = static_cast<DataView*>(castedThis->impl());
540 if (exec->argumentCount() < 2)
541 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
542 ExceptionCode ec = 0;
543 unsigned byteOffset(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
544 if (exec->hadException())
545 return JSValue::encode(jsUndefined());
546 float value(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toFloat(exec));
547 if (exec->hadException())
548 return JSValue::encode(jsUndefined());
550 size_t argsCount = exec->argumentCount();
551 if (argsCount <= 2) {
552 imp->setFloat32(byteOffset, value, ec);
553 setDOMException(exec, ec);
554 return JSValue::encode(jsUndefined());
557 bool littleEndian(MAYBE_MISSING_PARAMETER(exec, 2, MissingIsUndefined).toBoolean(exec));
558 if (exec->hadException())
559 return JSValue::encode(jsUndefined());
560 imp->setFloat32(byteOffset, value, littleEndian, ec);
561 setDOMException(exec, ec);
562 return JSValue::encode(jsUndefined());
565 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetFloat64(ExecState* exec)
567 JSValue thisValue = exec->hostThisValue();
568 if (!thisValue.inherits(&JSDataView::s_info))
569 return throwVMTypeError(exec);
570 JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue));
571 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info);
572 DataView* imp = static_cast<DataView*>(castedThis->impl());
573 if (exec->argumentCount() < 2)
574 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
575 ExceptionCode ec = 0;
576 unsigned byteOffset(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
577 if (exec->hadException())
578 return JSValue::encode(jsUndefined());
579 double value(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toNumber(exec));
580 if (exec->hadException())
581 return JSValue::encode(jsUndefined());
583 size_t argsCount = exec->argumentCount();
584 if (argsCount <= 2) {
585 imp->setFloat64(byteOffset, value, ec);
586 setDOMException(exec, ec);
587 return JSValue::encode(jsUndefined());
590 bool littleEndian(MAYBE_MISSING_PARAMETER(exec, 2, MissingIsUndefined).toBoolean(exec));
591 if (exec->hadException())
592 return JSValue::encode(jsUndefined());
593 imp->setFloat64(byteOffset, value, littleEndian, ec);
594 setDOMException(exec, ec);
595 return JSValue::encode(jsUndefined());