Bug 958471 - Assert range of Object/String Values' payload. r=jandem
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Thu, 16 Jan 2014 03:06:31 -0800
changeset 163684 41a1598f3c024d9a4a5bfa13ed6609741162db89
parent 163683 5302ee051b865fb943b88a520f29686bcb2f882c
child 163685 cbfac99adeef4acd03ead0ec132b6898b2622ba8
push id38539
push usernpierron@mozilla.com
push dateThu, 16 Jan 2014 11:07:04 +0000
treeherdermozilla-inbound@41a1598f3c02 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs958471
milestone29.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 958471 - Assert range of Object/String Values' payload. r=jandem
js/public/Value.h
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -451,17 +451,17 @@ JSVAL_IS_STRING_IMPL(jsval_layout l)
 {
     return l.s.tag == JSVAL_TAG_STRING;
 }
 
 static inline jsval_layout
 STRING_TO_JSVAL_IMPL(JSString *str)
 {
     jsval_layout l;
-    MOZ_ASSERT(str);
+    MOZ_ASSERT(uintptr_t(str) > 0x1000);
     l.s.tag = JSVAL_TAG_STRING;
     l.s.payload.str = str;
     return l;
 }
 
 static inline JSString *
 JSVAL_TO_STRING_IMPL(jsval_layout l)
 {
@@ -519,17 +519,17 @@ JSVAL_TO_OBJECT_IMPL(jsval_layout l)
 {
     return l.s.payload.obj;
 }
 
 static inline jsval_layout
 OBJECT_TO_JSVAL_IMPL(JSObject *obj)
 {
     jsval_layout l;
-    MOZ_ASSERT(obj);
+    MOZ_ASSERT(uintptr_t(obj) > 0x1000 || uintptr_t(obj) == 0x42);
     l.s.tag = JSVAL_TAG_OBJECT;
     l.s.payload.obj = obj;
     return l;
 }
 
 static inline bool
 JSVAL_IS_NULL_IMPL(jsval_layout l)
 {
@@ -673,17 +673,17 @@ JSVAL_IS_STRING_IMPL(jsval_layout l)
     return (uint32_t)(l.asBits >> JSVAL_TAG_SHIFT) == JSVAL_TAG_STRING;
 }
 
 static inline jsval_layout
 STRING_TO_JSVAL_IMPL(JSString *str)
 {
     jsval_layout l;
     uint64_t strBits = (uint64_t)str;
-    MOZ_ASSERT(str);
+    MOZ_ASSERT(uintptr_t(str) > 0x1000);
     MOZ_ASSERT((strBits >> JSVAL_TAG_SHIFT) == 0);
     l.asBits = strBits | JSVAL_SHIFTED_TAG_STRING;
     return l;
 }
 
 static inline JSString *
 JSVAL_TO_STRING_IMPL(jsval_layout l)
 {
@@ -744,17 +744,17 @@ JSVAL_TO_OBJECT_IMPL(jsval_layout l)
     return (JSObject *)ptrBits;
 }
 
 static inline jsval_layout
 OBJECT_TO_JSVAL_IMPL(JSObject *obj)
 {
     jsval_layout l;
     uint64_t objBits = (uint64_t)obj;
-    MOZ_ASSERT(obj);
+    MOZ_ASSERT(uintptr_t(obj) > 0x1000 || uintptr_t(obj) == 0x42);
     MOZ_ASSERT((objBits >> JSVAL_TAG_SHIFT) == 0);
     l.asBits = objBits | JSVAL_SHIFTED_TAG_OBJECT;
     return l;
 }
 
 static inline bool
 JSVAL_IS_NULL_IMPL(jsval_layout l)
 {