Bug 1339029 - Remove unused parameter from internal DataView read/write methods. r=evilpie draft
authorAndré Bargull <andre.bargull@gmail.com>
Mon, 13 Feb 2017 03:05:23 -0800
changeset 485855 803d903c70b8f1c351baf2dce12e9031bcce3047
parent 485854 d25dfe2153253eeae8c70681ae5c2e9764ec6cf2
child 485856 7bd0f8792a50240d6b0eb1ebf93c38829d6b03c4
push id45870
push userbmo:kechen@mozilla.com
push dateFri, 17 Feb 2017 09:36:54 +0000
reviewersevilpie
bugs1339029
milestone54.0a1
Bug 1339029 - Remove unused parameter from internal DataView read/write methods. r=evilpie
js/src/builtin/DataViewObject.cpp
js/src/builtin/DataViewObject.h
--- a/js/src/builtin/DataViewObject.cpp
+++ b/js/src/builtin/DataViewObject.cpp
@@ -426,18 +426,18 @@ struct DataViewIO
         if (wantSwap)
             temp = swapBytes(temp);
         Memcpy(unalignedBuffer, (uint8_t*) &temp, sizeof(ReadWriteType));
     }
 };
 
 template<typename NativeType>
 /* static */ bool
-DataViewObject::read(JSContext* cx, Handle<DataViewObject*> obj,
-                     const CallArgs& args, NativeType* val, const char* method)
+DataViewObject::read(JSContext* cx, Handle<DataViewObject*> obj, const CallArgs& args,
+                     NativeType* val)
 {
     // Steps 1-2. done by the caller
     // Step 3. unnecessary assert
 
     // Step 4.
     uint64_t getIndex;
     if (!ToIndex(cx, args.get(0), &getIndex))
         return false;
@@ -498,18 +498,17 @@ template <>
 inline bool
 WebIDLCast<double>(JSContext* cx, HandleValue value, double* out)
 {
     return ToNumber(cx, value, out);
 }
 
 template<typename NativeType>
 /* static */ bool
-DataViewObject::write(JSContext* cx, Handle<DataViewObject*> obj,
-                      const CallArgs& args, const char* method)
+DataViewObject::write(JSContext* cx, Handle<DataViewObject*> obj, const CallArgs& args)
 {
     // Steps 1-2. done by the caller
     // Step 3. unnecessary assert
 
     // Step 4.
     uint64_t getIndex;
     if (!ToIndex(cx, args.get(0), &getIndex))
         return false;
@@ -555,17 +554,17 @@ DataViewObject::write(JSContext* cx, Han
 bool
 DataViewObject::getInt8Impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
 
     int8_t val;
-    if (!read(cx, thisView, args, &val, "getInt8"))
+    if (!read(cx, thisView, args, &val))
         return false;
     args.rval().setInt32(val);
     return true;
 }
 
 bool
 DataViewObject::fun_getInt8(JSContext* cx, unsigned argc, Value* vp)
 {
@@ -576,17 +575,17 @@ DataViewObject::fun_getInt8(JSContext* c
 bool
 DataViewObject::getUint8Impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
 
     uint8_t val;
-    if (!read(cx, thisView, args, &val, "getUint8"))
+    if (!read(cx, thisView, args, &val))
         return false;
     args.rval().setInt32(val);
     return true;
 }
 
 bool
 DataViewObject::fun_getUint8(JSContext* cx, unsigned argc, Value* vp)
 {
@@ -597,17 +596,17 @@ DataViewObject::fun_getUint8(JSContext* 
 bool
 DataViewObject::getInt16Impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
 
     int16_t val;
-    if (!read(cx, thisView, args, &val, "getInt16"))
+    if (!read(cx, thisView, args, &val))
         return false;
     args.rval().setInt32(val);
     return true;
 }
 
 bool
 DataViewObject::fun_getInt16(JSContext* cx, unsigned argc, Value* vp)
 {
@@ -618,17 +617,17 @@ DataViewObject::fun_getInt16(JSContext* 
 bool
 DataViewObject::getUint16Impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
 
     uint16_t val;
-    if (!read(cx, thisView, args, &val, "getUint16"))
+    if (!read(cx, thisView, args, &val))
         return false;
     args.rval().setInt32(val);
     return true;
 }
 
 bool
 DataViewObject::fun_getUint16(JSContext* cx, unsigned argc, Value* vp)
 {
@@ -639,17 +638,17 @@ DataViewObject::fun_getUint16(JSContext*
 bool
 DataViewObject::getInt32Impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
 
     int32_t val;
-    if (!read(cx, thisView, args, &val, "getInt32"))
+    if (!read(cx, thisView, args, &val))
         return false;
     args.rval().setInt32(val);
     return true;
 }
 
 bool
 DataViewObject::fun_getInt32(JSContext* cx, unsigned argc, Value* vp)
 {
@@ -660,17 +659,17 @@ DataViewObject::fun_getInt32(JSContext* 
 bool
 DataViewObject::getUint32Impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
 
     uint32_t val;
-    if (!read(cx, thisView, args, &val, "getUint32"))
+    if (!read(cx, thisView, args, &val))
         return false;
     args.rval().setNumber(val);
     return true;
 }
 
 bool
 DataViewObject::fun_getUint32(JSContext* cx, unsigned argc, Value* vp)
 {
@@ -681,17 +680,17 @@ DataViewObject::fun_getUint32(JSContext*
 bool
 DataViewObject::getFloat32Impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
 
     float val;
-    if (!read(cx, thisView, args, &val, "getFloat32"))
+    if (!read(cx, thisView, args, &val))
         return false;
 
     args.rval().setDouble(CanonicalizeNaN(val));
     return true;
 }
 
 bool
 DataViewObject::fun_getFloat32(JSContext* cx, unsigned argc, Value* vp)
@@ -703,17 +702,17 @@ DataViewObject::fun_getFloat32(JSContext
 bool
 DataViewObject::getFloat64Impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
 
     double val;
-    if (!read(cx, thisView, args, &val, "getFloat64"))
+    if (!read(cx, thisView, args, &val))
         return false;
 
     args.rval().setDouble(CanonicalizeNaN(val));
     return true;
 }
 
 bool
 DataViewObject::fun_getFloat64(JSContext* cx, unsigned argc, Value* vp)
@@ -724,17 +723,17 @@ DataViewObject::fun_getFloat64(JSContext
 
 bool
 DataViewObject::setInt8Impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
 
-    if (!write<int8_t>(cx, thisView, args, "setInt8"))
+    if (!write<int8_t>(cx, thisView, args))
         return false;
     args.rval().setUndefined();
     return true;
 }
 
 bool
 DataViewObject::fun_setInt8(JSContext* cx, unsigned argc, Value* vp)
 {
@@ -744,17 +743,17 @@ DataViewObject::fun_setInt8(JSContext* c
 
 bool
 DataViewObject::setUint8Impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
 
-    if (!write<uint8_t>(cx, thisView, args, "setUint8"))
+    if (!write<uint8_t>(cx, thisView, args))
         return false;
     args.rval().setUndefined();
     return true;
 }
 
 bool
 DataViewObject::fun_setUint8(JSContext* cx, unsigned argc, Value* vp)
 {
@@ -764,17 +763,17 @@ DataViewObject::fun_setUint8(JSContext* 
 
 bool
 DataViewObject::setInt16Impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
 
-    if (!write<int16_t>(cx, thisView, args, "setInt16"))
+    if (!write<int16_t>(cx, thisView, args))
         return false;
     args.rval().setUndefined();
     return true;
 }
 
 bool
 DataViewObject::fun_setInt16(JSContext* cx, unsigned argc, Value* vp)
 {
@@ -784,17 +783,17 @@ DataViewObject::fun_setInt16(JSContext* 
 
 bool
 DataViewObject::setUint16Impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
 
-    if (!write<uint16_t>(cx, thisView, args, "setUint16"))
+    if (!write<uint16_t>(cx, thisView, args))
         return false;
     args.rval().setUndefined();
     return true;
 }
 
 bool
 DataViewObject::fun_setUint16(JSContext* cx, unsigned argc, Value* vp)
 {
@@ -804,17 +803,17 @@ DataViewObject::fun_setUint16(JSContext*
 
 bool
 DataViewObject::setInt32Impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
 
-    if (!write<int32_t>(cx, thisView, args, "setInt32"))
+    if (!write<int32_t>(cx, thisView, args))
         return false;
     args.rval().setUndefined();
     return true;
 }
 
 bool
 DataViewObject::fun_setInt32(JSContext* cx, unsigned argc, Value* vp)
 {
@@ -824,17 +823,17 @@ DataViewObject::fun_setInt32(JSContext* 
 
 bool
 DataViewObject::setUint32Impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
 
-    if (!write<uint32_t>(cx, thisView, args, "setUint32"))
+    if (!write<uint32_t>(cx, thisView, args))
         return false;
     args.rval().setUndefined();
     return true;
 }
 
 bool
 DataViewObject::fun_setUint32(JSContext* cx, unsigned argc, Value* vp)
 {
@@ -844,17 +843,17 @@ DataViewObject::fun_setUint32(JSContext*
 
 bool
 DataViewObject::setFloat32Impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
 
-    if (!write<float>(cx, thisView, args, "setFloat32"))
+    if (!write<float>(cx, thisView, args))
         return false;
     args.rval().setUndefined();
     return true;
 }
 
 bool
 DataViewObject::fun_setFloat32(JSContext* cx, unsigned argc, Value* vp)
 {
@@ -864,17 +863,17 @@ DataViewObject::fun_setFloat32(JSContext
 
 bool
 DataViewObject::setFloat64Impl(JSContext* cx, const CallArgs& args)
 {
     MOZ_ASSERT(is(args.thisv()));
 
     Rooted<DataViewObject*> thisView(cx, &args.thisv().toObject().as<DataViewObject>());
 
-    if (!write<double>(cx, thisView, args, "setFloat64"))
+    if (!write<double>(cx, thisView, args))
         return false;
     args.rval().setUndefined();
     return true;
 }
 
 bool
 DataViewObject::fun_setFloat64(JSContext* cx, unsigned argc, Value* vp)
 {
--- a/js/src/builtin/DataViewObject.h
+++ b/js/src/builtin/DataViewObject.h
@@ -156,21 +156,20 @@ class DataViewObject : public NativeObje
     static bool fun_setFloat32(JSContext* cx, unsigned argc, Value* vp);
 
     static bool setFloat64Impl(JSContext* cx, const CallArgs& args);
     static bool fun_setFloat64(JSContext* cx, unsigned argc, Value* vp);
 
     static bool initClass(JSContext* cx);
     static void notifyBufferDetached(JSObject* view);
     template<typename NativeType>
-    static bool read(JSContext* cx, Handle<DataViewObject*> obj,
-                     const CallArgs& args, NativeType* val, const char* method);
+    static bool read(JSContext* cx, Handle<DataViewObject*> obj, const CallArgs& args,
+                     NativeType* val);
     template<typename NativeType>
-    static bool write(JSContext* cx, Handle<DataViewObject*> obj,
-                      const CallArgs& args, const char* method);
+    static bool write(JSContext* cx, Handle<DataViewObject*> obj, const CallArgs& args);
 
     void notifyBufferDetached(void* newData);
 
   private:
     static const JSFunctionSpec methods[];
     static const JSPropertySpec properties[];
 };