static v8::Handle<v8::Value> setUint32Callback(const v8::Arguments& args) { INC_STATS("DOM.DataView.setUint32"); if (args.Length() < 2) return throwError("Not enough arguments", V8Proxy::TypeError); DataView* imp = V8DataView::toNative(args.Holder()); ExceptionCode ec = 0; { EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))); EXCEPTION_BLOCK(unsigned, value, toUInt32(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined))); if (args.Length() <= 2) { imp->setUint32(byteOffset, value, ec); if (UNLIKELY(ec)) goto fail; return v8::Handle<v8::Value>(); } EXCEPTION_BLOCK(bool, littleEndian, MAYBE_MISSING_PARAMETER(args, 2, MissingIsUndefined)->BooleanValue()); imp->setUint32(byteOffset, value, littleEndian, ec); if (UNLIKELY(ec)) goto fail; return v8::Handle<v8::Value>(); } fail: V8Proxy::setDOMException(ec); return v8::Handle<v8::Value>(); }
EncodedJSValue JSC_HOST_CALL jsDataViewPrototypeFunctionSetUint32(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSDataView::s_info)) return throwVMTypeError(exec); JSDataView* castedThis = static_cast<JSDataView*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDataView::s_info); DataView* imp = static_cast<DataView*>(castedThis->impl()); if (exec->argumentCount() < 2) return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); ExceptionCode ec = 0; unsigned byteOffset(exec->argument(0).toUInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); unsigned value(exec->argument(1).toUInt32(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); int argsCount = exec->argumentCount(); if (argsCount <= 2) { imp->setUint32(byteOffset, value, ec); setDOMException(exec, ec); return JSValue::encode(jsUndefined()); } bool littleEndian(exec->argument(2).toBoolean(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); imp->setUint32(byteOffset, value, littleEndian, ec); setDOMException(exec, ec); return JSValue::encode(jsUndefined()); }