Bug 793076 (part 5) - Change SetUTCTime()'s return type from bool to void. r=jwalden.
authorNicholas Nethercote <nnethercote@mozilla.com>
Sun, 07 Oct 2012 18:01:35 -0700
changeset 109598 2c7698ae61949c8e17281c4fa0bbba3afaee2b3b
parent 109597 8381c97c65d685b4b55264e162ab711584e4fc5b
child 109599 0a0f23cf7a7a7dbb8b5f8e37d1abc813a69f2f57
push id23636
push usergsharp@mozilla.com
push dateMon, 08 Oct 2012 08:08:19 +0000
treeherdermozilla-central@24cf40690042 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs793076
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 793076 (part 5) - Change SetUTCTime()'s return type from bool to void. r=jwalden.
js/src/jsdate.cpp
--- a/js/src/jsdate.cpp
+++ b/js/src/jsdate.cpp
@@ -1259,31 +1259,30 @@ date_now(JSContext *cx, unsigned argc, V
 {
     vp->setDouble(NowAsMillis());
     return JS_TRUE;
 }
 
 /*
  * Set UTC time to a given time and invalidate cached local time.
  */
-static JSBool
+static void
 SetUTCTime(RawObject obj, double t, Value *vp = NULL)
 {
     JS_ASSERT(obj->isDate());
 
     for (size_t ind = JSObject::JSSLOT_DATE_COMPONENTS_START;
          ind < JSObject::DATE_CLASS_RESERVED_SLOTS;
          ind++) {
         obj->setSlot(ind, UndefinedValue());
     }
 
     obj->setDateUTCTime(DoubleValue(t));
     if (vp)
         vp->setDouble(t);
-    return true;
 }
 
 static void
 SetDateToNaN(RawObject obj, Value *vp = NULL)
 {
     SetUTCTime(obj, js_NaN, vp);
 }
 
@@ -1811,17 +1810,18 @@ date_setTime_impl(JSContext *cx, CallArg
         SetDateToNaN(thisObj, args.rval().address());
         return true;
     }
 
     double result;
     if (!ToNumber(cx, args[0], &result))
         return false;
 
-    return SetUTCTime(thisObj, TimeClip(result), args.rval().address());
+    SetUTCTime(thisObj, TimeClip(result), args.rval().address());
+    return true;
 }
 
 static JSBool
 date_setTime(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setTime_impl>(cx, args);
 }
@@ -1872,17 +1872,18 @@ date_setMilliseconds_impl(JSContext *cx,
     if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &milli))
         return false;
     double time = MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), milli);
 
     /* Step 3. */
     double u = TimeClip(UTC(MakeDate(Day(t), time), &cx->dstOffsetCache));
 
     /* Steps 4-5. */
-    return SetUTCTime(thisObj, u, args.rval().address());
+    SetUTCTime(thisObj, u, args.rval().address());
+    return true;
 }
 
 static JSBool
 date_setMilliseconds(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setMilliseconds_impl>(cx, args);
 }
@@ -1903,17 +1904,18 @@ date_setUTCMilliseconds_impl(JSContext *
     if (!ToNumber(cx, args.length() > 0 ? args[0] : UndefinedValue(), &milli))
         return false;
     double time = MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), milli);
 
     /* Step 3. */
     double v = TimeClip(MakeDate(Day(t), time));
 
     /* Steps 4-5. */
-    return SetUTCTime(thisObj, v, args.rval().address());
+    SetUTCTime(thisObj, v, args.rval().address());
+    return true;
 }
 
 static JSBool
 date_setUTCMilliseconds(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setUTCMilliseconds_impl>(cx, args);
 }
@@ -1941,17 +1943,18 @@ date_setSeconds_impl(JSContext *cx, Call
 
     /* Step 4. */
     double date = MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), s, milli));
 
     /* Step 5. */
     double u = TimeClip(UTC(date, &cx->dstOffsetCache));
 
     /* Steps 6-7. */
-    return SetUTCTime(thisObj, u, args.rval().address());
+    SetUTCTime(thisObj, u, args.rval().address());
+    return true;
 }
 
 /* ES5 15.9.5.31. */
 static JSBool
 date_setSeconds(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setSeconds_impl>(cx, args);
@@ -1979,17 +1982,18 @@ date_setUTCSeconds_impl(JSContext *cx, C
 
     /* Step 4. */
     double date = MakeDate(Day(t), MakeTime(HourFromTime(t), MinFromTime(t), s, milli));
 
     /* Step 5. */
     double v = TimeClip(date);
 
     /* Steps 6-7. */
-    return SetUTCTime(thisObj, v, args.rval().address());
+    SetUTCTime(thisObj, v, args.rval().address());
+    return true;
 }
 
 /* ES5 15.9.5.32. */
 static JSBool
 date_setUTCSeconds(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setUTCSeconds_impl>(cx, args);
@@ -2022,17 +2026,18 @@ date_setMinutes_impl(JSContext *cx, Call
 
     /* Step 5. */
     double date = MakeDate(Day(t), MakeTime(HourFromTime(t), m, s, milli));
 
     /* Step 6. */
     double u = TimeClip(UTC(date, &cx->dstOffsetCache));
 
     /* Steps 7-8. */
-    return SetUTCTime(thisObj, u, args.rval().address());
+    SetUTCTime(thisObj, u, args.rval().address());
+    return true;
 }
 
 /* ES5 15.9.5.33. */
 static JSBool
 date_setMinutes(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setMinutes_impl>(cx, args);
@@ -2065,17 +2070,18 @@ date_setUTCMinutes_impl(JSContext *cx, C
 
     /* Step 5. */
     double date = MakeDate(Day(t), MakeTime(HourFromTime(t), m, s, milli));
 
     /* Step 6. */
     double v = TimeClip(date);
 
     /* Steps 7-8. */
-    return SetUTCTime(thisObj, v, args.rval().address());
+    SetUTCTime(thisObj, v, args.rval().address());
+    return true;
 }
 
 /* ES5 15.9.5.34. */
 static JSBool
 date_setUTCMinutes(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setUTCMinutes_impl>(cx, args);
@@ -2113,17 +2119,18 @@ date_setHours_impl(JSContext *cx, CallAr
 
     /* Step 6. */
     double date = MakeDate(Day(t), MakeTime(h, m, s, milli));
 
     /* Step 6. */
     double u = TimeClip(UTC(date, &cx->dstOffsetCache));
 
     /* Steps 7-8. */
-    return SetUTCTime(thisObj, u, args.rval().address());
+    SetUTCTime(thisObj, u, args.rval().address());
+    return true;
 }
 
 /* ES5 15.9.5.35. */
 static JSBool
 date_setHours(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setHours_impl>(cx, args);
@@ -2161,17 +2168,18 @@ date_setUTCHours_impl(JSContext *cx, Cal
 
     /* Step 6. */
     double newDate = MakeDate(Day(t), MakeTime(h, m, s, milli));
 
     /* Step 7. */
     double v = TimeClip(newDate);
 
     /* Steps 8-9. */
-    return SetUTCTime(thisObj, v, args.rval().address());
+    SetUTCTime(thisObj, v, args.rval().address());
+    return true;
 }
 
 /* ES5 15.9.5.36. */
 static JSBool
 date_setUTCHours(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setUTCHours_impl>(cx, args);
@@ -2194,17 +2202,18 @@ date_setDate_impl(JSContext *cx, CallArg
 
     /* Step 3. */
     double newDate = MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), TimeWithinDay(t));
 
     /* Step 4. */
     double u = TimeClip(UTC(newDate, &cx->dstOffsetCache));
 
     /* Steps 5-6. */
-    return SetUTCTime(thisObj, u, args.rval().address());
+    SetUTCTime(thisObj, u, args.rval().address());
+    return true;
 }
 
 /* ES5 15.9.5.37. */
 static JSBool
 date_setDate(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setDate_impl>(cx, args);
@@ -2227,17 +2236,18 @@ date_setUTCDate_impl(JSContext *cx, Call
 
     /* Step 3. */
     double newDate = MakeDate(MakeDay(YearFromTime(t), MonthFromTime(t), dt), TimeWithinDay(t));
 
     /* Step 4. */
     double v = TimeClip(newDate);
 
     /* Steps 5-6. */
-    return SetUTCTime(thisObj, v, args.rval().address());
+    SetUTCTime(thisObj, v, args.rval().address());
+    return true;
 }
 
 static JSBool
 date_setUTCDate(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setUTCDate_impl>(cx, args);
 }
@@ -2285,17 +2295,18 @@ date_setMonth_impl(JSContext *cx, CallAr
 
     /* Step 4. */
     double newDate = MakeDate(MakeDay(YearFromTime(t), m, dt), TimeWithinDay(t));
 
     /* Step 5. */
     double u = TimeClip(UTC(newDate, &cx->dstOffsetCache));
 
     /* Steps 6-7. */
-    return SetUTCTime(thisObj, u, args.rval().address());
+    SetUTCTime(thisObj, u, args.rval().address());
+    return true;
 }
 
 static JSBool
 date_setMonth(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setMonth_impl>(cx, args);
 }
@@ -2323,17 +2334,18 @@ date_setUTCMonth_impl(JSContext *cx, Cal
 
     /* Step 4. */
     double newDate = MakeDate(MakeDay(YearFromTime(t), m, dt), TimeWithinDay(t));
 
     /* Step 5. */
     double v = TimeClip(newDate);
 
     /* Steps 6-7. */
-    return SetUTCTime(thisObj, v, args.rval().address());
+    SetUTCTime(thisObj, v, args.rval().address());
+    return true;
 }
 
 static JSBool
 date_setUTCMonth(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setUTCMonth_impl>(cx, args);
 }
@@ -2382,17 +2394,18 @@ date_setFullYear_impl(JSContext *cx, Cal
 
     /* Step 5. */
     double newDate = MakeDate(MakeDay(y, m, dt), TimeWithinDay(t));
 
     /* Step 6. */
     double u = TimeClip(UTC(newDate, &cx->dstOffsetCache));
 
     /* Steps 7-8. */
-    return SetUTCTime(thisObj, u, args.rval().address());
+    SetUTCTime(thisObj, u, args.rval().address());
+    return true;
 }
 
 static JSBool
 date_setFullYear(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setFullYear_impl>(cx, args);
 }
@@ -2425,17 +2438,18 @@ date_setUTCFullYear_impl(JSContext *cx, 
 
     /* Step 5. */
     double newDate = MakeDate(MakeDay(y, m, dt), TimeWithinDay(t));
 
     /* Step 6. */
     double v = TimeClip(newDate);
 
     /* Steps 7-8. */
-    return SetUTCTime(thisObj, v, args.rval().address());
+    SetUTCTime(thisObj, v, args.rval().address());
+    return true;
 }
 
 static JSBool
 date_setUTCFullYear(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setUTCFullYear_impl>(cx, args);
 }
@@ -2469,17 +2483,18 @@ date_setYear_impl(JSContext *cx, CallArg
 
     /* Step 5. */
     double day = MakeDay(yint, MonthFromTime(t), DateFromTime(t));
 
     /* Step 6. */
     double u = UTC(MakeDate(day, TimeWithinDay(t)), &cx->dstOffsetCache);
 
     /* Steps 7-8. */
-    return SetUTCTime(thisObj, TimeClip(u), args.rval().address());
+    SetUTCTime(thisObj, TimeClip(u), args.rval().address());
+    return true;
 }
 
 static JSBool
 date_setYear(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setYear_impl>(cx, args);
 }
@@ -3194,18 +3209,17 @@ js_InitDateClass(JSContext *cx, HandleOb
 }
 
 JS_FRIEND_API(JSObject *)
 js_NewDateObjectMsec(JSContext *cx, double msec_time)
 {
     RawObject obj = NewBuiltinClassInstance(cx, &DateClass);
     if (!obj)
         return NULL;
-    if (!SetUTCTime(obj, msec_time))
-        return NULL;
+    SetUTCTime(obj, msec_time);
     return obj;
 }
 
 JS_FRIEND_API(JSObject *)
 js_NewDateObject(JSContext *cx, int year, int mon, int mday,
                  int hour, int min, int sec)
 {
     JS_ASSERT(mon < 12);