Bug 793076 (part 4) - In jsdate.cpp, exactly root remaining JSObject* pointers. r=jwalden.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 20 Sep 2012 23:23:54 -0700
changeset 109597 8381c97c65d685b4b55264e162ab711584e4fc5b
parent 109596 11868442cc39ca566113da4fd4d7c6d420563ce1
child 109598 2c7698ae61949c8e17281c4fa0bbba3afaee2b3b
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 4) - In jsdate.cpp, exactly root remaining JSObject* pointers. r=jwalden.
js/src/jsdate.cpp
js/src/jsdate.h
--- a/js/src/jsdate.cpp
+++ b/js/src/jsdate.cpp
@@ -1260,45 +1260,45 @@ 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
-SetUTCTime(JSObject *obj, double t, Value *vp = NULL)
+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(JSObject *obj, Value *vp = NULL)
+SetDateToNaN(RawObject obj, Value *vp = NULL)
 {
     SetUTCTime(obj, js_NaN, vp);
 }
 
 /*
  * Cache the local time, year, month, and so forth of the object.
  * If UTC time is not finite (e.g., NaN), the local time
  * slots will be set to the UTC time without conversion.
  */
 static bool
-CacheLocalTime(DSTOffsetCache *dstOffsetCache, JSObject *obj)
+CacheLocalTime(DSTOffsetCache *dstOffsetCache, RawObject obj)
 {
     JS_ASSERT(obj->isDate());
 
     /* Check if the cache is already populated. */
     if (!obj->getSlot(JSObject::JSSLOT_DATE_LOCAL_TIME).isUndefined() &&
         obj->getSlot(JSObject::JSSLOT_DATE_TZA).toDouble() == LocalTZA)
     {
         return true;
@@ -1425,17 +1425,17 @@ CacheLocalTime(DSTOffsetCache *dstOffset
 
     int hours = (yearSeconds / (60 * 60)) % 24;
     obj->setSlot(JSObject::JSSLOT_DATE_LOCAL_HOURS, Int32Value(hours));
 
     return true;
 }
 
 inline bool
-GetCachedLocalTime(DSTOffsetCache *dstOffsetCache, JSObject *obj, double *time)
+GetCachedLocalTime(DSTOffsetCache *dstOffsetCache, RawObject obj, double *time)
 {
     if (!obj || !CacheLocalTime(dstOffsetCache, obj))
         return false;
 
     *time = obj->getSlot(JSObject::JSSLOT_DATE_LOCAL_TIME).toDouble();
     return true;
 }
 
@@ -2334,26 +2334,26 @@ date_setUTCMonth_impl(JSContext *cx, Cal
 static JSBool
 date_setUTCMonth(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     return CallNonGenericMethod<IsDate, date_setUTCMonth_impl>(cx, args);
 }
 
 static double
-ThisLocalTimeOrZero(Handle<JSObject*> date, DSTOffsetCache *dstOffsetCache)
+ThisLocalTimeOrZero(HandleObject date, DSTOffsetCache *dstOffsetCache)
 {
     double t = date->getDateUTCTime().toNumber();
     if (MOZ_DOUBLE_IS_NaN(t))
         return +0;
     return LocalTime(t, dstOffsetCache);
 }
 
 static double
-ThisUTCTimeOrZero(Handle<JSObject*> date)
+ThisUTCTimeOrZero(HandleObject date)
 {
     double t = date->getDateUTCTime().toNumber();
     return MOZ_DOUBLE_IS_NaN(t) ? +0 : t;
 }
 
 /* ES5 15.9.5.40. */
 JS_ALWAYS_INLINE bool
 date_setFullYear_impl(JSContext *cx, CallArgs args)
@@ -2770,17 +2770,17 @@ date_format(JSContext *cx, double date, 
     str = JS_NewStringCopyZ(cx, buf);
     if (!str)
         return JS_FALSE;
     call.rval().setString(str);
     return JS_TRUE;
 }
 
 static bool
-ToLocaleHelper(JSContext *cx, CallReceiver call, JSObject *obj, const char *format)
+ToLocaleHelper(JSContext *cx, CallReceiver call, HandleObject obj, const char *format)
 {
     double utctime = obj->getDateUTCTime().toNumber();
 
     char buf[100];
     if (!MOZ_DOUBLE_IS_FINITE(utctime)) {
         JS_snprintf(buf, sizeof buf, js_NaN_date_str);
     } else {
         int result_len;
@@ -2816,17 +2816,17 @@ ToLocaleHelper(JSContext *cx, CallReceiv
     JSString *str = JS_NewStringCopyZ(cx, buf);
     if (!str)
         return false;
     call.rval().setString(str);
     return true;
 }
 
 static bool
-ToLocaleStringHelper(JSContext *cx, CallReceiver call, Handle<JSObject*> thisObj)
+ToLocaleStringHelper(JSContext *cx, CallReceiver call, HandleObject thisObj)
 {
     /*
      * Use '%#c' for windows, because '%c' is backward-compatible and non-y2k
      * with msvc; '%#c' requests that a full year be used in the result string.
      */
     return ToLocaleHelper(cx, call, thisObj,
 #if defined(_WIN32) && !defined(__MWERKS__)
                           "%#c"
@@ -3132,17 +3132,17 @@ js_Date(JSContext *cx, unsigned argc, Va
 
         if (MOZ_DOUBLE_IS_FINITE(msec_time)) {
             msec_time = UTC(msec_time, &cx->dstOffsetCache);
             msec_time = TimeClip(msec_time);
         }
         d = msec_time;
     }
 
-    JSObject *obj = js_NewDateObjectMsec(cx, d);
+    RawObject obj = js_NewDateObjectMsec(cx, d);
     if (!obj)
         return false;
 
     args.rval().setObject(*obj);
     return true;
 }
 
 JSObject *
@@ -3191,17 +3191,17 @@ js_InitDateClass(JSContext *cx, HandleOb
         return NULL;
 
     return dateProto;
 }
 
 JS_FRIEND_API(JSObject *)
 js_NewDateObjectMsec(JSContext *cx, double msec_time)
 {
-    JSObject *obj = NewBuiltinClassInstance(cx, &DateClass);
+    RawObject obj = NewBuiltinClassInstance(cx, &DateClass);
     if (!obj)
         return NULL;
     if (!SetUTCTime(obj, msec_time))
         return NULL;
     return obj;
 }
 
 JS_FRIEND_API(JSObject *)
@@ -3215,79 +3215,79 @@ js_NewDateObject(JSContext *cx, int year
 
 void
 js_ClearDateCaches()
 {
     UpdateLocalTZA();
 }
 
 JS_FRIEND_API(JSBool)
-js_DateIsValid(JSObject* obj)
+js_DateIsValid(RawObject obj)
 {
     return obj->isDate() && !MOZ_DOUBLE_IS_NaN(obj->getDateUTCTime().toNumber());
 }
 
 JS_FRIEND_API(int)
-js_DateGetYear(JSContext *cx, JSObject* obj)
+js_DateGetYear(JSContext *cx, RawObject obj)
 {
     double localtime;
 
     /* Preserve legacy API behavior of returning 0 for invalid dates. */
     if (!GetCachedLocalTime(&cx->dstOffsetCache, obj, &localtime) || MOZ_DOUBLE_IS_NaN(localtime))
         return 0;
 
     return (int) YearFromTime(localtime);
 }
 
 JS_FRIEND_API(int)
-js_DateGetMonth(JSContext *cx, JSObject* obj)
+js_DateGetMonth(JSContext *cx, RawObject obj)
 {
     double localtime;
 
     if (!GetCachedLocalTime(&cx->dstOffsetCache, obj, &localtime) || MOZ_DOUBLE_IS_NaN(localtime))
         return 0;
 
     return (int) MonthFromTime(localtime);
 }
 
 JS_FRIEND_API(int)
-js_DateGetDate(JSContext *cx, JSObject* obj)
+js_DateGetDate(JSContext *cx, RawObject obj)
 {
     double localtime;
 
     if (!GetCachedLocalTime(&cx->dstOffsetCache, obj, &localtime) || MOZ_DOUBLE_IS_NaN(localtime))
         return 0;
 
     return (int) DateFromTime(localtime);
 }
 
 JS_FRIEND_API(int)
-js_DateGetHours(JSContext *cx, JSObject* obj)
+js_DateGetHours(JSContext *cx, RawObject obj)
 {
     double localtime;
 
     if (!GetCachedLocalTime(&cx->dstOffsetCache, obj, &localtime) || MOZ_DOUBLE_IS_NaN(localtime))
         return 0;
 
     return (int) HourFromTime(localtime);
 }
 
 JS_FRIEND_API(int)
-js_DateGetMinutes(JSContext *cx, JSObject* obj)
+js_DateGetMinutes(JSContext *cx, RawObject obj)
 {
     double localtime;
 
     if (!GetCachedLocalTime(&cx->dstOffsetCache, obj, &localtime) || MOZ_DOUBLE_IS_NaN(localtime))
         return 0;
 
     return (int) MinFromTime(localtime);
 }
 
 JS_FRIEND_API(int)
-js_DateGetSeconds(JSObject* obj)
+js_DateGetSeconds(RawObject obj)
 {
     if (!obj->isDate())
         return 0;
 
     double utctime = obj->getDateUTCTime().toNumber();
     if (MOZ_DOUBLE_IS_NaN(utctime))
         return 0;
     return (int) SecFromTime(utctime);
--- a/js/src/jsdate.h
+++ b/js/src/jsdate.h
@@ -46,48 +46,48 @@ js_InitDateClass(JSContext *cx, js::Hand
 /*
  * These functions provide a C interface to the date/time object
  */
 
 /*
  * Construct a new Date Object from a time value given in milliseconds UTC
  * since the epoch.
  */
-extern JS_FRIEND_API(JSObject*)
+extern JS_FRIEND_API(JSObject *)
 js_NewDateObjectMsec(JSContext* cx, double msec_time);
 
 /*
  * Construct a new Date Object from an exploded local time value.
  *
  * Assert that mon < 12 to help catch off-by-one user errors, which are common
  * due to the 0-based month numbering copied into JS from Java (java.util.Date
  * in 1995).
  */
-extern JS_FRIEND_API(JSObject*)
+extern JS_FRIEND_API(JSObject *)
 js_NewDateObject(JSContext* cx, int year, int mon, int mday,
                  int hour, int min, int sec);
 
 extern void
 js_ClearDateCaches();
 
 extern JS_FRIEND_API(int)
-js_DateGetYear(JSContext *cx, JSObject* obj);
+js_DateGetYear(JSContext *cx, JSRawObject obj);
 
 extern JS_FRIEND_API(int)
-js_DateGetMonth(JSContext *cx, JSObject* obj);
+js_DateGetMonth(JSContext *cx, JSRawObject obj);
 
 extern JS_FRIEND_API(int)
-js_DateGetDate(JSContext *cx, JSObject* obj);
+js_DateGetDate(JSContext *cx, JSRawObject obj);
 
 extern JS_FRIEND_API(int)
-js_DateGetHours(JSContext *cx, JSObject* obj);
+js_DateGetHours(JSContext *cx, JSRawObject obj);
 
 extern JS_FRIEND_API(int)
-js_DateGetMinutes(JSContext *cx, JSObject* obj);
+js_DateGetMinutes(JSContext *cx, JSRawObject obj);
 
 extern JS_FRIEND_API(int)
-js_DateGetSeconds(JSObject* obj);
+js_DateGetSeconds(JSRawObject obj);
 
 /* Date constructor native. Exposed only so the JIT can know its address. */
 JSBool
 js_Date(JSContext *cx, unsigned argc, js::Value *vp);
 
 #endif /* jsdate_h___ */