tizen beta release
[framework/web/webkit-efl.git] / DerivedSources / WebCore / JSDataView.cpp
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 #include "JSDataView.h"
23
24 #include "DataView.h"
25 #include "ExceptionCode.h"
26 #include "JSDOMBinding.h"
27 #include <runtime/Error.h>
28 #include <wtf/GetPtr.h>
29
30 using namespace JSC;
31
32 namespace WebCore {
33
34 ASSERT_CLASS_FITS_IN_CELL(JSDataView);
35
36 /* Hash table */
37 #if ENABLE(JIT)
38 #define THUNK_GENERATOR(generator) , generator
39 #else
40 #define THUNK_GENERATOR(generator)
41 #endif
42 #if ENABLE(DFG_JIT)
43 #define INTRINSIC(intrinsic) , intrinsic
44 #else
45 #define INTRINSIC(intrinsic)
46 #endif
47
48 static const HashTableValue JSDataViewTableValues[] =
49 {
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) }
52 };
53
54 #undef THUNK_GENERATOR
55 static const HashTable JSDataViewTable = { 2, 1, JSDataViewTableValues, 0 };
56 /* Hash table for constructor */
57 #if ENABLE(JIT)
58 #define THUNK_GENERATOR(generator) , generator
59 #else
60 #define THUNK_GENERATOR(generator)
61 #endif
62 #if ENABLE(DFG_JIT)
63 #define INTRINSIC(intrinsic) , intrinsic
64 #else
65 #define INTRINSIC(intrinsic)
66 #endif
67
68 static const HashTableValue JSDataViewConstructorTableValues[] =
69 {
70     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
71 };
72
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) };
76
77 JSDataViewConstructor::JSDataViewConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
78     : DOMConstructorObject(structure, globalObject)
79 {
80 }
81
82 void JSDataViewConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
83 {
84     Base::finishCreation(exec->globalData());
85     ASSERT(inherits(&s_info));
86     putDirect(exec->globalData(), exec->propertyNames().prototype, JSDataViewPrototype::self(exec, globalObject), DontDelete | ReadOnly);
87 }
88
89 bool JSDataViewConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
90 {
91     return getStaticValueSlot<JSDataViewConstructor, JSDOMWrapper>(exec, &JSDataViewConstructorTable, static_cast<JSDataViewConstructor*>(cell), propertyName, slot);
92 }
93
94 bool JSDataViewConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
95 {
96     return getStaticValueDescriptor<JSDataViewConstructor, JSDOMWrapper>(exec, &JSDataViewConstructorTable, static_cast<JSDataViewConstructor*>(object), propertyName, descriptor);
97 }
98
99 ConstructType JSDataViewConstructor::getConstructData(JSCell*, ConstructData& constructData)
100 {
101     constructData.native.function = constructJSDataView;
102     return ConstructTypeHost;
103 }
104
105 /* Hash table for prototype */
106 #if ENABLE(JIT)
107 #define THUNK_GENERATOR(generator) , generator
108 #else
109 #define THUNK_GENERATOR(generator)
110 #endif
111 #if ENABLE(DFG_JIT)
112 #define INTRINSIC(intrinsic) , intrinsic
113 #else
114 #define INTRINSIC(intrinsic)
115 #endif
116
117 static const HashTableValue JSDataViewPrototypeTableValues[] =
118 {
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) }
136 };
137
138 #undef THUNK_GENERATOR
139 static const HashTable JSDataViewPrototypeTable = { 37, 31, JSDataViewPrototypeTableValues, 0 };
140 static const HashTable* getJSDataViewPrototypeTable(ExecState* exec)
141 {
142     return getHashTableForGlobalData(exec->globalData(), &JSDataViewPrototypeTable);
143 }
144
145 const ClassInfo JSDataViewPrototype::s_info = { "DataViewPrototype", &JSC::JSNonFinalObject::s_info, 0, getJSDataViewPrototypeTable, CREATE_METHOD_TABLE(JSDataViewPrototype) };
146
147 JSObject* JSDataViewPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
148 {
149     return getDOMPrototype<JSDataView>(exec, globalObject);
150 }
151
152 bool JSDataViewPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
153 {
154     JSDataViewPrototype* thisObject = jsCast<JSDataViewPrototype*>(cell);
155     return getStaticFunctionSlot<JSObject>(exec, getJSDataViewPrototypeTable(exec), thisObject, propertyName, slot);
156 }
157
158 bool JSDataViewPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
159 {
160     JSDataViewPrototype* thisObject = jsCast<JSDataViewPrototype*>(object);
161     return getStaticFunctionDescriptor<JSObject>(exec, getJSDataViewPrototypeTable(exec), thisObject, propertyName, descriptor);
162 }
163
164 static const HashTable* getJSDataViewTable(ExecState* exec)
165 {
166     return getHashTableForGlobalData(exec->globalData(), &JSDataViewTable);
167 }
168
169 const ClassInfo JSDataView::s_info = { "DataView", &JSArrayBufferView::s_info, 0, getJSDataViewTable , CREATE_METHOD_TABLE(JSDataView) };
170
171 JSDataView::JSDataView(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<DataView> impl)
172     : JSArrayBufferView(structure, globalObject, impl)
173 {
174 }
175
176 void JSDataView::finishCreation(JSGlobalData& globalData)
177 {
178     Base::finishCreation(globalData);
179     ASSERT(inherits(&s_info));
180 }
181
182 JSObject* JSDataView::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
183 {
184     return JSDataViewPrototype::create(exec->globalData(), globalObject, JSDataViewPrototype::createStructure(exec->globalData(), globalObject, JSArrayBufferViewPrototype::self(exec, globalObject)));
185 }
186
187 bool JSDataView::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
188 {
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);
192 }
193
194 bool JSDataView::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
195 {
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);
199 }
200
201 JSValue jsDataViewConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
202 {
203     JSDataView* domObject = static_cast<JSDataView*>(asObject(slotBase));
204     return JSDataView::getConstructor(exec, domObject->globalObject());
205 }
206
207 JSValue JSDataView::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
208 {
209     return getDOMConstructor<JSDataViewConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
210 }
211
212 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionGetInt8(ExecState* exec)
213 {
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));
220 }
221
222 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionGetUint8(ExecState* exec)
223 {
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));
230 }
231
232 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionGetInt16(ExecState* exec)
233 {
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());
246
247     size_t argsCount = exec->argumentCount();
248     if (argsCount <= 1) {
249
250         JSC::JSValue result = jsNumber(imp->getInt16(byteOffset, ec));
251         setDOMException(exec, ec);
252         return JSValue::encode(result);
253     }
254
255     bool littleEndian(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toBoolean(exec));
256     if (exec->hadException())
257         return JSValue::encode(jsUndefined());
258
259     JSC::JSValue result = jsNumber(imp->getInt16(byteOffset, littleEndian, ec));
260     setDOMException(exec, ec);
261     return JSValue::encode(result);
262 }
263
264 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionGetUint16(ExecState* exec)
265 {
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());
278
279     size_t argsCount = exec->argumentCount();
280     if (argsCount <= 1) {
281
282         JSC::JSValue result = jsNumber(imp->getUint16(byteOffset, ec));
283         setDOMException(exec, ec);
284         return JSValue::encode(result);
285     }
286
287     bool littleEndian(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toBoolean(exec));
288     if (exec->hadException())
289         return JSValue::encode(jsUndefined());
290
291     JSC::JSValue result = jsNumber(imp->getUint16(byteOffset, littleEndian, ec));
292     setDOMException(exec, ec);
293     return JSValue::encode(result);
294 }
295
296 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionGetInt32(ExecState* exec)
297 {
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());
310
311     size_t argsCount = exec->argumentCount();
312     if (argsCount <= 1) {
313
314         JSC::JSValue result = jsNumber(imp->getInt32(byteOffset, ec));
315         setDOMException(exec, ec);
316         return JSValue::encode(result);
317     }
318
319     bool littleEndian(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toBoolean(exec));
320     if (exec->hadException())
321         return JSValue::encode(jsUndefined());
322
323     JSC::JSValue result = jsNumber(imp->getInt32(byteOffset, littleEndian, ec));
324     setDOMException(exec, ec);
325     return JSValue::encode(result);
326 }
327
328 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionGetUint32(ExecState* exec)
329 {
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());
342
343     size_t argsCount = exec->argumentCount();
344     if (argsCount <= 1) {
345
346         JSC::JSValue result = jsNumber(imp->getUint32(byteOffset, ec));
347         setDOMException(exec, ec);
348         return JSValue::encode(result);
349     }
350
351     bool littleEndian(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toBoolean(exec));
352     if (exec->hadException())
353         return JSValue::encode(jsUndefined());
354
355     JSC::JSValue result = jsNumber(imp->getUint32(byteOffset, littleEndian, ec));
356     setDOMException(exec, ec);
357     return JSValue::encode(result);
358 }
359
360 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionGetFloat32(ExecState* exec)
361 {
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));
368 }
369
370 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionGetFloat64(ExecState* exec)
371 {
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));
378 }
379
380 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetInt8(ExecState* exec)
381 {
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));
388 }
389
390 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetUint8(ExecState* exec)
391 {
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));
398 }
399
400 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetInt16(ExecState* exec)
401 {
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());
417
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());
423     }
424
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());
431 }
432
433 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetUint16(ExecState* exec)
434 {
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());
450
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());
456     }
457
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());
464 }
465
466 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetInt32(ExecState* exec)
467 {
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());
483
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());
489     }
490
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());
497 }
498
499 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetUint32(ExecState* exec)
500 {
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());
516
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());
522     }
523
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());
530 }
531
532 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetFloat32(ExecState* exec)
533 {
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());
549
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());
555     }
556
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());
563 }
564
565 EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetFloat64(ExecState* exec)
566 {
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());
582
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());
588     }
589
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());
596 }
597
598
599 }