Bug 1517259 - Part 14: Add constexpr modifier to variables holding constexpr values. r=tcampbell
authorAndré Bargull <andre.bargull@gmail.com>
Thu, 03 Jan 2019 05:51:22 -0800
changeset 509957 5259ce5b5a406ca59b08d42c88435c99e7352bdd
parent 509956 ed51ef14289e378f05974012b62f1cb2464b867b
child 509958 500c1db3053317312cba1fb8abf93da49d36e862
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1517259
milestone66.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 1517259 - Part 14: Add constexpr modifier to variables holding constexpr values. r=tcampbell
js/src/vm/TypedArrayObject.cpp
--- a/js/src/vm/TypedArrayObject.cpp
+++ b/js/src/vm/TypedArrayObject.cpp
@@ -167,17 +167,17 @@ void TypedArrayObject::finalize(FreeOp* 
     return 0;
   }
 
   // Determine if we can use inline data for the target array. If this is
   // possible, the nursery will have picked an allocation size that is large
   // enough.
   size_t nbytes = oldObj->byteLength();
 
-  size_t headerSize = dataOffset() + sizeof(HeapSlot);
+  constexpr size_t headerSize = dataOffset() + sizeof(HeapSlot);
 
   // See AllocKindForLazyBuffer.
   gc::AllocKind newAllocKind = obj->asTenured().getAllocKind();
   MOZ_ASSERT_IF(nbytes == 0,
                 headerSize + sizeof(uint8_t) <= GetGCKindBytes(newAllocKind));
 
   if (headerSize + nbytes <= GetGCKindBytes(newAllocKind)) {
     MOZ_ASSERT(oldObj->hasInlineElements());
@@ -489,18 +489,18 @@ class TypedArrayObjectTemplate : public 
       Nursery& nursery = cx->nursery();
       MOZ_ASSERT_IF(!nursery.isInside(buf) && !tarray->hasInlineElements(),
                     tarray->isTenured());
 #endif
       tarray->initPrivate(buf);
     } else {
       size_t nbytes = len * BYTES_PER_ELEMENT;
 #ifdef DEBUG
-      size_t dataOffset = TypedArrayObject::dataOffset();
-      size_t offset = dataOffset + sizeof(HeapSlot);
+      constexpr size_t dataOffset = TypedArrayObject::dataOffset();
+      constexpr size_t offset = dataOffset + sizeof(HeapSlot);
       MOZ_ASSERT(offset + nbytes <= GetGCKindBytes(allocKind));
 #endif
 
       void* data = tarray->fixedData(FIXED_DATA_START);
       tarray->initPrivate(data);
       memset(data, 0, nbytes);
     }
   }