Bug 1008473 - Make Value::toGCThing() return a Cell pointer rather than void* r=terrence
authorJon Coppeard <jcoppeard@mozilla.com>
Mon, 02 Jun 2014 16:10:53 +0100
changeset 205392 ac7043963695f9404427d7c6c4a4cf6594d54d63
parent 205391 d70a6a2ddfd2b0a82feaafd4273258b3e1ef38bf
child 205393 bff5585f1b9b47a2fc424f916e295a2fda81880a
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs1008473
milestone32.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 1008473 - Make Value::toGCThing() return a Cell pointer rather than void* r=terrence
js/public/Value.h
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -249,16 +249,17 @@ typedef union jsval_layout
     uint64_t asBits;
     struct {
         union {
             int32_t        i32;
             uint32_t       u32;
             uint32_t       boo;     // Don't use |bool| -- it must be four bytes.
             JSString       *str;
             JSObject       *obj;
+            js::gc::Cell   *cell;
             void           *ptr;
             JSWhyMagic     why;
             size_t         word;
             uintptr_t      uintptr;
         } payload;
         JSValueTag tag;
     } s;
     double asDouble;
@@ -556,20 +557,20 @@ JSVAL_TO_PRIVATE_PTR_IMPL(jsval_layout l
 
 static inline bool
 JSVAL_IS_GCTHING_IMPL(jsval_layout l)
 {
     /* gcc sometimes generates signed < without explicit casts. */
     return (uint32_t)l.s.tag >= (uint32_t)JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET;
 }
 
-static inline void *
+static inline js::gc::Cell *
 JSVAL_TO_GCTHING_IMPL(jsval_layout l)
 {
-    return l.s.payload.ptr;
+    return l.s.payload.cell;
 }
 
 static inline bool
 JSVAL_IS_TRACEABLE_IMPL(jsval_layout l)
 {
     return l.s.tag == JSVAL_TAG_STRING || l.s.tag == JSVAL_TAG_OBJECT;
 }
 
@@ -772,22 +773,22 @@ JSVAL_IS_NULL_IMPL(jsval_layout l)
 }
 
 static inline bool
 JSVAL_IS_GCTHING_IMPL(jsval_layout l)
 {
     return l.asBits >= JSVAL_LOWER_INCL_SHIFTED_TAG_OF_GCTHING_SET;
 }
 
-static inline void *
+static inline js::gc::Cell *
 JSVAL_TO_GCTHING_IMPL(jsval_layout l)
 {
     uint64_t ptrBits = l.asBits & JSVAL_PAYLOAD_MASK;
     MOZ_ASSERT((ptrBits & 0x7) == 0);
-    return (void *)ptrBits;
+    return reinterpret_cast<js::gc::Cell *>(ptrBits);
 }
 
 static inline bool
 JSVAL_IS_TRACEABLE_IMPL(jsval_layout l)
 {
     return JSVAL_IS_GCTHING_IMPL(l) && !JSVAL_IS_NULL_IMPL(l);
 }
 
@@ -1155,17 +1156,17 @@ class Value
         return *JSVAL_TO_OBJECT_IMPL(data);
     }
 
     JSObject *toObjectOrNull() const {
         MOZ_ASSERT(isObjectOrNull());
         return JSVAL_TO_OBJECT_IMPL(data);
     }
 
-    void *toGCThing() const {
+    js::gc::Cell *toGCThing() const {
         MOZ_ASSERT(isGCThing());
         return JSVAL_TO_GCTHING_IMPL(data);
     }
 
     bool toBoolean() const {
         MOZ_ASSERT(isBoolean());
         return JSVAL_TO_BOOLEAN_IMPL(data);
     }