diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h index 33f98d8dfba6..5b612660cd70 100644 --- a/js/public/RootingAPI.h +++ b/js/public/RootingAPI.h @@ -7,6 +7,7 @@ #ifndef js_RootingAPI_h #define js_RootingAPI_h +#include "mozilla/Attributes.h" #include "mozilla/GuardObjects.h" #include "mozilla/LinkedList.h" #include "mozilla/NullPtr.h" @@ -437,10 +438,9 @@ class MOZ_NONHEAP_CLASS Handle : public js::HandleBase * for the lifetime of the handle, as its users may not expect its value * to change underneath them. */ - static Handle fromMarkedLocation(const T *p) { - Handle h; - h.ptr = p; - return h; + static MOZ_CONSTEXPR Handle fromMarkedLocation(const T *p) { + return Handle(p, DeliberatelyChoosingThisOverload, + ImUsingThisOnlyInFromFromMarkedLocation); } /* @@ -482,6 +482,10 @@ class MOZ_NONHEAP_CLASS Handle : public js::HandleBase private: Handle() {} + enum Disambiguator { DeliberatelyChoosingThisOverload = 42 }; + enum CallerIdentity { ImUsingThisOnlyInFromFromMarkedLocation = 17 }; + MOZ_CONSTEXPR Handle(const T *p, Disambiguator, CallerIdentity) : ptr(p) {} + const T *ptr; template void operator=(S) MOZ_DELETE; diff --git a/js/src/jit/Ion.h b/js/src/jit/Ion.h index cb68dc7db088..88d8e8acb3ca 100644 --- a/js/src/jit/Ion.h +++ b/js/src/jit/Ion.h @@ -216,7 +216,7 @@ struct IonOptions baselineUsesBeforeCompile = 0; } - IonOptions() + MOZ_CONSTEXPR IonOptions() : gvn(true), gvnIsOptimistic(true), licm(true), diff --git a/js/src/vm/ObjectImpl.h b/js/src/vm/ObjectImpl.h index d2cc6b655e0e..d367507deae8 100644 --- a/js/src/vm/ObjectImpl.h +++ b/js/src/vm/ObjectImpl.h @@ -8,6 +8,7 @@ #define vm_ObjectImpl_h #include "mozilla/Assertions.h" +#include "mozilla/Attributes.h" #include @@ -833,7 +834,7 @@ class ObjectElements } public: - ObjectElements(uint32_t capacity, uint32_t length) + MOZ_CONSTEXPR ObjectElements(uint32_t capacity, uint32_t length) : flags(0), initializedLength(0), capacity(capacity), length(length) {}