Bug 1290337 - Part 2: Replace jsval_layout parameter to const jsval_layout&. r=evilpie
authorTooru Fujisawa <arai_a@mac.com>
Sun, 11 Sep 2016 18:15:21 +0900
changeset 316047 a3a7f0fa1186ada56b6a66f1181069790c61a3bd
parent 316046 95c5ce6ed75dd9427d4eb9eac65704260074d577
child 316048 9796ed81f17a936804ec792c843dadf2c00023df
push id30759
push userphilringnalda@gmail.com
push dateSat, 01 Oct 2016 06:25:09 +0000
treeherdermozilla-central@fcc62bbf09ee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpie
bugs1290337
milestone52.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 1290337 - Part 2: Replace jsval_layout parameter to const jsval_layout&. r=evilpie
js/public/Value.h
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -388,38 +388,38 @@ JS_STATIC_ASSERT(sizeof(jsval_layout) ==
 
 static inline JS_VALUE_CONSTEXPR jsval_layout
 BUILD_JSVAL(JSValueTag tag, uint32_t payload)
 {
     JS_RETURN_LAYOUT_FROM_BITS((((uint64_t)(uint32_t)tag) << 32) | payload);
 }
 
 static inline bool
-JSVAL_IS_DOUBLE_IMPL(jsval_layout l)
+JSVAL_IS_DOUBLE_IMPL(const jsval_layout& l)
 {
     return (uint32_t)l.s.tag <= (uint32_t)JSVAL_TAG_CLEAR;
 }
 
 static inline jsval_layout
 DOUBLE_TO_JSVAL_IMPL(double d)
 {
     jsval_layout l;
     l.asDouble = d;
     MOZ_ASSERT(JSVAL_IS_DOUBLE_IMPL(l));
     return l;
 }
 
 static inline bool
-JSVAL_IS_INT32_IMPL(jsval_layout l)
+JSVAL_IS_INT32_IMPL(const jsval_layout& l)
 {
     return l.s.tag == JSVAL_TAG_INT32;
 }
 
 static inline int32_t
-JSVAL_TO_INT32_IMPL(jsval_layout l)
+JSVAL_TO_INT32_IMPL(const jsval_layout& l)
 {
     return l.s.payload.i32;
 }
 
 static inline JS_VALUE_CONSTEXPR jsval_layout
 INT32_TO_JSVAL_IMPL(int32_t i)
 {
 #if defined(JS_VALUE_IS_CONSTEXPR)
@@ -428,154 +428,154 @@ INT32_TO_JSVAL_IMPL(int32_t i)
     jsval_layout l;
     l.s.tag = JSVAL_TAG_INT32;
     l.s.payload.i32 = i;
     return l;
 #endif
 }
 
 static inline bool
-JSVAL_IS_NUMBER_IMPL(jsval_layout l)
+JSVAL_IS_NUMBER_IMPL(const jsval_layout& l)
 {
     JSValueTag tag = l.s.tag;
     MOZ_ASSERT(tag != JSVAL_TAG_CLEAR);
     return (uint32_t)tag <= (uint32_t)JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET;
 }
 
 static inline bool
-JSVAL_IS_UNDEFINED_IMPL(jsval_layout l)
+JSVAL_IS_UNDEFINED_IMPL(const jsval_layout& l)
 {
     return l.s.tag == JSVAL_TAG_UNDEFINED;
 }
 
 static inline bool
-JSVAL_IS_STRING_IMPL(jsval_layout l)
+JSVAL_IS_STRING_IMPL(const 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(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)
+JSVAL_TO_STRING_IMPL(const jsval_layout& l)
 {
     return l.s.payload.str;
 }
 
 static inline bool
-JSVAL_IS_SYMBOL_IMPL(jsval_layout l)
+JSVAL_IS_SYMBOL_IMPL(const jsval_layout& l)
 {
     return l.s.tag == JSVAL_TAG_SYMBOL;
 }
 
 static inline jsval_layout
 SYMBOL_TO_JSVAL_IMPL(JS::Symbol* sym)
 {
     jsval_layout l;
     MOZ_ASSERT(uintptr_t(sym) > 0x1000);
     l.s.tag = JSVAL_TAG_SYMBOL;
     l.s.payload.sym = sym;
     return l;
 }
 
 static inline JS::Symbol*
-JSVAL_TO_SYMBOL_IMPL(jsval_layout l)
+JSVAL_TO_SYMBOL_IMPL(const jsval_layout& l)
 {
     return l.s.payload.sym;
 }
 
 static inline bool
-JSVAL_IS_BOOLEAN_IMPL(jsval_layout l)
+JSVAL_IS_BOOLEAN_IMPL(const jsval_layout& l)
 {
     return l.s.tag == JSVAL_TAG_BOOLEAN;
 }
 
 static inline bool
-JSVAL_TO_BOOLEAN_IMPL(jsval_layout l)
+JSVAL_TO_BOOLEAN_IMPL(const jsval_layout& l)
 {
     return bool(l.s.payload.boo);
 }
 
 static inline jsval_layout
 BOOLEAN_TO_JSVAL_IMPL(bool b)
 {
     jsval_layout l;
     l.s.tag = JSVAL_TAG_BOOLEAN;
     l.s.payload.boo = uint32_t(b);
     return l;
 }
 
 static inline bool
-JSVAL_IS_MAGIC_IMPL(jsval_layout l)
+JSVAL_IS_MAGIC_IMPL(const jsval_layout& l)
 {
     return l.s.tag == JSVAL_TAG_MAGIC;
 }
 
 static inline bool
-JSVAL_IS_OBJECT_IMPL(jsval_layout l)
+JSVAL_IS_OBJECT_IMPL(const jsval_layout& l)
 {
     return l.s.tag == JSVAL_TAG_OBJECT;
 }
 
 static inline bool
-JSVAL_IS_PRIMITIVE_IMPL(jsval_layout l)
+JSVAL_IS_PRIMITIVE_IMPL(const jsval_layout& l)
 {
     return (uint32_t)l.s.tag < (uint32_t)JSVAL_UPPER_EXCL_TAG_OF_PRIMITIVE_SET;
 }
 
 static inline bool
-JSVAL_IS_OBJECT_OR_NULL_IMPL(jsval_layout l)
+JSVAL_IS_OBJECT_OR_NULL_IMPL(const jsval_layout& l)
 {
     MOZ_ASSERT((uint32_t)l.s.tag <= (uint32_t)JSVAL_TAG_OBJECT);
     return (uint32_t)l.s.tag >= (uint32_t)JSVAL_LOWER_INCL_TAG_OF_OBJ_OR_NULL_SET;
 }
 
 static inline JSObject*
-JSVAL_TO_OBJECT_IMPL(jsval_layout l)
+JSVAL_TO_OBJECT_IMPL(const jsval_layout& l)
 {
     return l.s.payload.obj;
 }
 
 static inline jsval_layout
 OBJECT_TO_JSVAL_IMPL(JSObject* obj)
 {
     jsval_layout l;
     MOZ_ASSERT(uintptr_t(obj) > 0x1000 || uintptr_t(obj) == 0x48);
     l.s.tag = JSVAL_TAG_OBJECT;
     l.s.payload.obj = obj;
     return l;
 }
 
 static inline bool
-JSVAL_IS_NULL_IMPL(jsval_layout l)
+JSVAL_IS_NULL_IMPL(const jsval_layout& l)
 {
     return l.s.tag == JSVAL_TAG_NULL;
 }
 
 static inline jsval_layout
 PRIVATE_PTR_TO_JSVAL_IMPL(void* ptr)
 {
     jsval_layout l;
     MOZ_ASSERT((uintptr_t(ptr) & 1) == 0);
     l.s.tag = (JSValueTag)0;
     l.s.payload.ptr = ptr;
     MOZ_ASSERT(JSVAL_IS_DOUBLE_IMPL(l));
     return l;
 }
 
 static inline void*
-JSVAL_TO_PRIVATE_PTR_IMPL(jsval_layout l)
+JSVAL_TO_PRIVATE_PTR_IMPL(const jsval_layout& l)
 {
     return l.s.payload.ptr;
 }
 
 static inline jsval_layout
 PRIVATE_GCTHING_TO_JSVAL_IMPL(js::gc::Cell* cell)
 {
     MOZ_ASSERT(JS::GCThingTraceKind(cell) != JS::TraceKind::String,
@@ -588,56 +588,56 @@ PRIVATE_GCTHING_TO_JSVAL_IMPL(js::gc::Ce
     jsval_layout l;
     MOZ_ASSERT(uintptr_t(cell) > 0x1000);
     l.s.tag = JSVAL_TAG_PRIVATE_GCTHING;
     l.s.payload.cell = cell;
     return l;
 }
 
 static inline bool
-JSVAL_IS_PRIVATE_GCTHING_IMPL(jsval_layout l)
+JSVAL_IS_PRIVATE_GCTHING_IMPL(const jsval_layout& l)
 {
     return l.s.tag == JSVAL_TAG_PRIVATE_GCTHING;
 }
 
 static inline bool
-JSVAL_IS_GCTHING_IMPL(jsval_layout l)
+JSVAL_IS_GCTHING_IMPL(const 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 js::gc::Cell*
-JSVAL_TO_GCTHING_IMPL(jsval_layout l)
+JSVAL_TO_GCTHING_IMPL(const jsval_layout& l)
 {
     return l.s.payload.cell;
 }
 
 static inline uint32_t
-JSVAL_TRACE_KIND_IMPL(jsval_layout l)
+JSVAL_TRACE_KIND_IMPL(const jsval_layout& l)
 {
     static_assert((JSVAL_TAG_STRING & 0x03) == size_t(JS::TraceKind::String),
                   "Value type tags must correspond with JS::TraceKinds.");
     static_assert((JSVAL_TAG_SYMBOL & 0x03) == size_t(JS::TraceKind::Symbol),
                   "Value type tags must correspond with JS::TraceKinds.");
     static_assert((JSVAL_TAG_OBJECT & 0x03) == size_t(JS::TraceKind::Object),
                   "Value type tags must correspond with JS::TraceKinds.");
     if (MOZ_UNLIKELY(JSVAL_IS_PRIVATE_GCTHING_IMPL(l)))
         return (uint32_t)JS::GCThingTraceKind(JSVAL_TO_GCTHING_IMPL(l));
     return l.s.tag & 0x03;
 }
 
 static inline bool
-JSVAL_IS_SPECIFIC_INT32_IMPL(jsval_layout l, int32_t i32)
+JSVAL_IS_SPECIFIC_INT32_IMPL(const jsval_layout& l, int32_t i32)
 {
     return l.s.tag == JSVAL_TAG_INT32 && l.s.payload.i32 == i32;
 }
 
 static inline bool
-JSVAL_IS_SPECIFIC_BOOLEAN_IMPL(jsval_layout l, bool b)
+JSVAL_IS_SPECIFIC_BOOLEAN_IMPL(const jsval_layout& l, bool b)
 {
     return (l.s.tag == JSVAL_TAG_BOOLEAN) && (l.s.payload.boo == uint32_t(b));
 }
 
 static inline jsval_layout
 MAGIC_TO_JSVAL_IMPL(JSWhyMagic why)
 {
     jsval_layout l;
@@ -651,177 +651,177 @@ MAGIC_UINT32_TO_JSVAL_IMPL(uint32_t payl
 {
     jsval_layout l;
     l.s.tag = JSVAL_TAG_MAGIC;
     l.s.payload.u32 = payload;
     return l;
 }
 
 static inline bool
-JSVAL_SAME_TYPE_IMPL(jsval_layout lhs, jsval_layout rhs)
+JSVAL_SAME_TYPE_IMPL(const jsval_layout& lhs, const jsval_layout& rhs)
 {
     JSValueTag ltag = lhs.s.tag, rtag = rhs.s.tag;
     return ltag == rtag || (ltag < JSVAL_TAG_CLEAR && rtag < JSVAL_TAG_CLEAR);
 }
 
 static inline JSValueType
-JSVAL_EXTRACT_NON_DOUBLE_TYPE_IMPL(jsval_layout l)
+JSVAL_EXTRACT_NON_DOUBLE_TYPE_IMPL(const jsval_layout& l)
 {
     uint32_t type = l.s.tag & 0xF;
     MOZ_ASSERT(type > JSVAL_TYPE_DOUBLE);
     return (JSValueType)type;
 }
 
 #elif defined(JS_PUNBOX64)
 
 static inline JS_VALUE_CONSTEXPR jsval_layout
 BUILD_JSVAL(JSValueTag tag, uint64_t payload)
 {
     JS_RETURN_LAYOUT_FROM_BITS((((uint64_t)(uint32_t)tag) << JSVAL_TAG_SHIFT) | payload);
 }
 
 static inline bool
-JSVAL_IS_DOUBLE_IMPL(jsval_layout l)
+JSVAL_IS_DOUBLE_IMPL(const jsval_layout& l)
 {
     return (l.asBits | mozilla::DoubleTypeTraits::kSignBit) <= JSVAL_SHIFTED_TAG_MAX_DOUBLE;
 }
 
 static inline jsval_layout
 DOUBLE_TO_JSVAL_IMPL(double d)
 {
     jsval_layout l;
     l.asDouble = d;
     MOZ_ASSERT(JSVAL_IS_DOUBLE_IMPL(l));
     return l;
 }
 
 static inline bool
-JSVAL_IS_INT32_IMPL(jsval_layout l)
+JSVAL_IS_INT32_IMPL(const jsval_layout& l)
 {
     return (uint32_t)(l.asBits >> JSVAL_TAG_SHIFT) == JSVAL_TAG_INT32;
 }
 
 static inline int32_t
-JSVAL_TO_INT32_IMPL(jsval_layout l)
+JSVAL_TO_INT32_IMPL(const jsval_layout& l)
 {
     return (int32_t)l.asBits;
 }
 
 static inline JS_VALUE_CONSTEXPR jsval_layout
 INT32_TO_JSVAL_IMPL(int32_t i32)
 {
     JS_RETURN_LAYOUT_FROM_BITS(((uint64_t)(uint32_t)i32) | JSVAL_SHIFTED_TAG_INT32);
 }
 
 static inline bool
-JSVAL_IS_NUMBER_IMPL(jsval_layout l)
+JSVAL_IS_NUMBER_IMPL(const jsval_layout& l)
 {
     return l.asBits < JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_NUMBER_SET;
 }
 
 static inline bool
-JSVAL_IS_UNDEFINED_IMPL(jsval_layout l)
+JSVAL_IS_UNDEFINED_IMPL(const jsval_layout& l)
 {
     return l.asBits == JSVAL_SHIFTED_TAG_UNDEFINED;
 }
 
 static inline bool
-JSVAL_IS_STRING_IMPL(jsval_layout l)
+JSVAL_IS_STRING_IMPL(const 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(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)
+JSVAL_TO_STRING_IMPL(const jsval_layout& l)
 {
     return (JSString*)(l.asBits & JSVAL_PAYLOAD_MASK);
 }
 
 static inline bool
-JSVAL_IS_SYMBOL_IMPL(jsval_layout l)
+JSVAL_IS_SYMBOL_IMPL(const jsval_layout& l)
 {
     return (uint32_t)(l.asBits >> JSVAL_TAG_SHIFT) == JSVAL_TAG_SYMBOL;
 }
 
 static inline jsval_layout
 SYMBOL_TO_JSVAL_IMPL(JS::Symbol* sym)
 {
     jsval_layout l;
     uint64_t symBits = (uint64_t)sym;
     MOZ_ASSERT(uintptr_t(sym) > 0x1000);
     MOZ_ASSERT((symBits >> JSVAL_TAG_SHIFT) == 0);
     l.asBits = symBits | JSVAL_SHIFTED_TAG_SYMBOL;
     return l;
 }
 
 static inline JS::Symbol*
-JSVAL_TO_SYMBOL_IMPL(jsval_layout l)
+JSVAL_TO_SYMBOL_IMPL(const jsval_layout& l)
 {
     return (JS::Symbol*)(l.asBits & JSVAL_PAYLOAD_MASK);
 }
 
 static inline bool
-JSVAL_IS_BOOLEAN_IMPL(jsval_layout l)
+JSVAL_IS_BOOLEAN_IMPL(const jsval_layout& l)
 {
     return (uint32_t)(l.asBits >> JSVAL_TAG_SHIFT) == JSVAL_TAG_BOOLEAN;
 }
 
 static inline bool
-JSVAL_TO_BOOLEAN_IMPL(jsval_layout l)
+JSVAL_TO_BOOLEAN_IMPL(const jsval_layout& l)
 {
     return (bool)(l.asBits & JSVAL_PAYLOAD_MASK);
 }
 
 static inline jsval_layout
 BOOLEAN_TO_JSVAL_IMPL(bool b)
 {
     jsval_layout l;
     l.asBits = ((uint64_t)(uint32_t)b) | JSVAL_SHIFTED_TAG_BOOLEAN;
     return l;
 }
 
 static inline bool
-JSVAL_IS_MAGIC_IMPL(jsval_layout l)
+JSVAL_IS_MAGIC_IMPL(const jsval_layout& l)
 {
     return (l.asBits >> JSVAL_TAG_SHIFT) == JSVAL_TAG_MAGIC;
 }
 
 static inline bool
-JSVAL_IS_PRIMITIVE_IMPL(jsval_layout l)
+JSVAL_IS_PRIMITIVE_IMPL(const jsval_layout& l)
 {
     return l.asBits < JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_PRIMITIVE_SET;
 }
 
 static inline bool
-JSVAL_IS_OBJECT_IMPL(jsval_layout l)
+JSVAL_IS_OBJECT_IMPL(const jsval_layout& l)
 {
     MOZ_ASSERT((l.asBits >> JSVAL_TAG_SHIFT) <= JSVAL_TAG_OBJECT);
     return l.asBits >= JSVAL_SHIFTED_TAG_OBJECT;
 }
 
 static inline bool
-JSVAL_IS_OBJECT_OR_NULL_IMPL(jsval_layout l)
+JSVAL_IS_OBJECT_OR_NULL_IMPL(const jsval_layout& l)
 {
     MOZ_ASSERT((l.asBits >> JSVAL_TAG_SHIFT) <= JSVAL_TAG_OBJECT);
     return l.asBits >= JSVAL_LOWER_INCL_SHIFTED_TAG_OF_OBJ_OR_NULL_SET;
 }
 
 static inline JSObject*
-JSVAL_TO_OBJECT_IMPL(jsval_layout l)
+JSVAL_TO_OBJECT_IMPL(const jsval_layout& l)
 {
     uint64_t ptrBits = l.asBits & JSVAL_PAYLOAD_MASK;
     MOZ_ASSERT((ptrBits & 0x7) == 0);
     return (JSObject*)ptrBits;
 }
 
 static inline jsval_layout
 OBJECT_TO_JSVAL_IMPL(JSObject* obj)
@@ -830,43 +830,43 @@ OBJECT_TO_JSVAL_IMPL(JSObject* obj)
     uint64_t objBits = (uint64_t)obj;
     MOZ_ASSERT(uintptr_t(obj) > 0x1000 || uintptr_t(obj) == 0x48);
     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)
+JSVAL_IS_NULL_IMPL(const jsval_layout& l)
 {
     return l.asBits == JSVAL_SHIFTED_TAG_NULL;
 }
 
 static inline bool
-JSVAL_IS_PRIVATE_GCTHING_IMPL(jsval_layout l)
+JSVAL_IS_PRIVATE_GCTHING_IMPL(const jsval_layout& l)
 {
     return (l.asBits >> JSVAL_TAG_SHIFT) == JSVAL_TAG_PRIVATE_GCTHING;
 }
 
 static inline bool
-JSVAL_IS_GCTHING_IMPL(jsval_layout l)
+JSVAL_IS_GCTHING_IMPL(const jsval_layout& l)
 {
     return l.asBits >= JSVAL_LOWER_INCL_SHIFTED_TAG_OF_GCTHING_SET;
 }
 
 static inline js::gc::Cell*
-JSVAL_TO_GCTHING_IMPL(jsval_layout l)
+JSVAL_TO_GCTHING_IMPL(const jsval_layout& l)
 {
     uint64_t ptrBits = l.asBits & JSVAL_PAYLOAD_MASK;
     MOZ_ASSERT((ptrBits & 0x7) == 0);
     return reinterpret_cast<js::gc::Cell*>(ptrBits);
 }
 
 static inline uint32_t
-JSVAL_TRACE_KIND_IMPL(jsval_layout l)
+JSVAL_TRACE_KIND_IMPL(const jsval_layout& l)
 {
     static_assert((JSVAL_TAG_STRING & 0x03) == size_t(JS::TraceKind::String),
                   "Value type tags must correspond with JS::TraceKinds.");
     static_assert((JSVAL_TAG_SYMBOL & 0x03) == size_t(JS::TraceKind::Symbol),
                   "Value type tags must correspond with JS::TraceKinds.");
     static_assert((JSVAL_TAG_OBJECT & 0x03) == size_t(JS::TraceKind::Object),
                   "Value type tags must correspond with JS::TraceKinds.");
     if (MOZ_UNLIKELY(JSVAL_IS_PRIVATE_GCTHING_IMPL(l)))
@@ -881,17 +881,17 @@ PRIVATE_PTR_TO_JSVAL_IMPL(void* ptr)
     uintptr_t ptrBits = uintptr_t(ptr);
     MOZ_ASSERT((ptrBits & 1) == 0);
     l.asBits = ptrBits >> 1;
     MOZ_ASSERT(JSVAL_IS_DOUBLE_IMPL(l));
     return l;
 }
 
 static inline void*
-JSVAL_TO_PRIVATE_PTR_IMPL(jsval_layout l)
+JSVAL_TO_PRIVATE_PTR_IMPL(const jsval_layout& l)
 {
     MOZ_ASSERT((l.asBits & 0x8000000000000000LL) == 0);
     return (void*)(l.asBits << 1);
 }
 
 static inline jsval_layout
 PRIVATE_GCTHING_TO_JSVAL_IMPL(js::gc::Cell* cell)
 {
@@ -906,23 +906,23 @@ PRIVATE_GCTHING_TO_JSVAL_IMPL(js::gc::Ce
     uint64_t cellBits = (uint64_t)cell;
     MOZ_ASSERT(uintptr_t(cellBits) > 0x1000);
     MOZ_ASSERT((cellBits >> JSVAL_TAG_SHIFT) == 0);
     l.asBits = cellBits | JSVAL_SHIFTED_TAG_PRIVATE_GCTHING;
     return l;
 }
 
 static inline bool
-JSVAL_IS_SPECIFIC_INT32_IMPL(jsval_layout l, int32_t i32)
+JSVAL_IS_SPECIFIC_INT32_IMPL(const jsval_layout& l, int32_t i32)
 {
     return l.asBits == (((uint64_t)(uint32_t)i32) | JSVAL_SHIFTED_TAG_INT32);
 }
 
 static inline bool
-JSVAL_IS_SPECIFIC_BOOLEAN_IMPL(jsval_layout l, bool b)
+JSVAL_IS_SPECIFIC_BOOLEAN_IMPL(const jsval_layout& l, bool b)
 {
     return l.asBits == (((uint64_t)(uint32_t)b) | JSVAL_SHIFTED_TAG_BOOLEAN);
 }
 
 static inline jsval_layout
 MAGIC_TO_JSVAL_IMPL(JSWhyMagic why)
 {
     jsval_layout l;
@@ -934,40 +934,40 @@ static inline jsval_layout
 MAGIC_UINT32_TO_JSVAL_IMPL(uint32_t payload)
 {
     jsval_layout l;
     l.asBits = ((uint64_t)payload) | JSVAL_SHIFTED_TAG_MAGIC;
     return l;
 }
 
 static inline bool
-JSVAL_SAME_TYPE_IMPL(jsval_layout lhs, jsval_layout rhs)
+JSVAL_SAME_TYPE_IMPL(const jsval_layout& lhs, const jsval_layout& rhs)
 {
     return (JSVAL_IS_DOUBLE_IMPL(lhs) && JSVAL_IS_DOUBLE_IMPL(rhs)) ||
            (((lhs.asBits ^ rhs.asBits) & 0xFFFF800000000000LL) == 0);
 }
 
 static inline JSValueType
-JSVAL_EXTRACT_NON_DOUBLE_TYPE_IMPL(jsval_layout l)
+JSVAL_EXTRACT_NON_DOUBLE_TYPE_IMPL(const jsval_layout& l)
 {
    uint64_t type = (l.asBits >> JSVAL_TAG_SHIFT) & 0xF;
    MOZ_ASSERT(type > JSVAL_TYPE_DOUBLE);
    return (JSValueType)type;
 }
 
 #endif  /* JS_PUNBOX64 */
 
 static inline bool
-JSVAL_IS_TRACEABLE_IMPL(jsval_layout l)
+JSVAL_IS_TRACEABLE_IMPL(const jsval_layout& l)
 {
     return JSVAL_IS_GCTHING_IMPL(l) && !JSVAL_IS_NULL_IMPL(l);
 }
 
 static inline jsval_layout JSVAL_TO_IMPL(JS::Value v);
-static inline JS_VALUE_CONSTEXPR JS::Value IMPL_TO_JSVAL(jsval_layout l);
+static inline JS_VALUE_CONSTEXPR JS::Value IMPL_TO_JSVAL(const jsval_layout& l);
 
 namespace JS {
 
 static inline JS_VALUE_CONSTEXPR JS::Value UndefinedValue();
 
 /**
  * Returns a generic quiet NaN value, with all payload bits set to zero.
  *
@@ -1387,28 +1387,28 @@ class Value
   // precisely, we don't want Value return values compiled as out params.
   private:
 #endif
 
     jsval_layout data;
 
   private:
 #if defined(JS_VALUE_IS_CONSTEXPR)
-    MOZ_IMPLICIT JS_VALUE_CONSTEXPR Value(jsval_layout layout) : data(layout) {}
+    MOZ_IMPLICIT JS_VALUE_CONSTEXPR Value(const jsval_layout& layout) : data(layout) {}
 #endif
 
     void staticAssertions() {
         JS_STATIC_ASSERT(sizeof(JSValueType) == 1);
         JS_STATIC_ASSERT(sizeof(JSValueTag) == 4);
         JS_STATIC_ASSERT(sizeof(JSWhyMagic) <= 4);
         JS_STATIC_ASSERT(sizeof(Value) == 8);
     }
 
     friend jsval_layout (::JSVAL_TO_IMPL)(Value);
-    friend Value JS_VALUE_CONSTEXPR (::IMPL_TO_JSVAL)(jsval_layout l);
+    friend Value JS_VALUE_CONSTEXPR (::IMPL_TO_JSVAL)(const jsval_layout& l);
     friend Value JS_VALUE_CONSTEXPR (JS::UndefinedValue)();
 } JS_HAZ_GC_POINTER;
 
 inline bool
 IsOptimizedPlaceholderMagicValue(const Value& v)
 {
     if (v.isMagic()) {
         MOZ_ASSERT(v.whyMagic() == JS_OPTIMIZED_ARGUMENTS || v.whyMagic() == JS_OPTIMIZED_OUT);
@@ -1930,17 +1930,17 @@ template <class S, bool v> struct BoolDe
 
 inline jsval_layout
 JSVAL_TO_IMPL(JS::Value v)
 {
     return v.data;
 }
 
 inline JS_VALUE_CONSTEXPR JS::Value
-IMPL_TO_JSVAL(jsval_layout l)
+IMPL_TO_JSVAL(const jsval_layout& l)
 {
 #if defined(JS_VALUE_IS_CONSTEXPR)
     return JS::Value(l);
 #else
     JS::Value v;
     v.data = l;
     return v;
 #endif