bug 938025 - part 2 - fix some static constructors in the jseng r=waldo
authorTrevor Saunders <trev.saunders@gmail.com>
Fri, 22 Nov 2013 15:05:04 -0500
changeset 157438 ca137ceb2877232c148f08907698fb94df7bb6a3
parent 157437 9d17f28e30dd2752ea613c94828db2a149692f03
child 157439 d84bce4e8f2c739d7f1baba03cb2bd0338e4db9f
push id36716
push usertrev.saunders@gmail.com
push dateMon, 25 Nov 2013 23:01:10 +0000
treeherdermozilla-inbound@d84bce4e8f2c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo
bugs938025
milestone28.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 938025 - part 2 - fix some static constructors in the jseng r=waldo
js/public/RootingAPI.h
js/src/jit/Ion.h
js/src/vm/ObjectImpl.h
--- a/js/public/RootingAPI.h
+++ b/js/public/RootingAPI.h
@@ -2,16 +2,17 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef js_RootingAPI_h
 #define js_RootingAPI_h
 
+#include "mozilla/Attributes.h"
 #include "mozilla/GuardObjects.h"
 #include "mozilla/LinkedList.h"
 #include "mozilla/NullPtr.h"
 #include "mozilla/TypeTraits.h"
 
 #include "jspubtd.h"
 
 #include "js/TypeDecls.h"
@@ -432,20 +433,19 @@ class MOZ_NONHEAP_CLASS Handle : public 
      *  1) the location of the T is guaranteed to be marked (for some reason
      *     other than being a Rooted), e.g., if it is guaranteed to be reachable
      *     from an implicit root.
      *
      *  2) the contents of the location are immutable, or at least cannot change
      *     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);
     }
 
     /*
      * Construct a handle from an explicitly rooted location. This is the
      * normal way to create a handle, and normally happens implicitly.
      */
     template <typename S>
     inline
@@ -477,16 +477,20 @@ class MOZ_NONHEAP_CLASS Handle : public 
     bool operator==(const T &other) const { return *ptr == other; }
 
     /* Change this handle to point to the same rooted location RHS does. */
     void repoint(const Handle &rhs) { ptr = rhs.address(); }
 
   private:
     Handle() {}
 
+    enum Disambiguator { DeliberatelyChoosingThisOverload = 42 };
+    enum CallerIdentity { ImUsingThisOnlyInFromFromMarkedLocation = 17 };
+    MOZ_CONSTEXPR Handle(const T *p, Disambiguator, CallerIdentity) : ptr(p) {}
+
     const T *ptr;
 
     template <typename S> void operator=(S) MOZ_DELETE;
     void operator=(Handle) MOZ_DELETE;
 };
 
 /*
  * Similar to a handle, but the underlying storage can be changed. This is
--- a/js/src/jit/Ion.h
+++ b/js/src/jit/Ion.h
@@ -211,17 +211,17 @@ struct IonOptions
     uint32_t inliningMaxCallerBytecodeLength;
 
     void setEagerCompilation() {
         eagerCompilation = true;
         usesBeforeCompile = 0;
         baselineUsesBeforeCompile = 0;
     }
 
-    IonOptions()
+    MOZ_CONSTEXPR IonOptions()
       : gvn(true),
         gvnIsOptimistic(true),
         licm(true),
         osr(true),
         limitScriptSize(true),
         registerAllocator(RegisterAllocator_LSRA),
         inlining(true),
         edgeCaseAnalysis(true),
--- a/js/src/vm/ObjectImpl.h
+++ b/js/src/vm/ObjectImpl.h
@@ -3,16 +3,17 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef vm_ObjectImpl_h
 #define vm_ObjectImpl_h
 
 #include "mozilla/Assertions.h"
+#include "mozilla/Attributes.h"
 
 #include <stdint.h>
 
 #include "jsfriendapi.h"
 #include "jsinfer.h"
 #include "NamespaceImports.h"
 
 #include "gc/Barrier.h"
@@ -828,17 +829,17 @@ class ObjectElements
     bool hasNonwritableArrayLength() const {
         return flags & NONWRITABLE_ARRAY_LENGTH;
     }
     void setNonwritableArrayLength() {
         flags |= NONWRITABLE_ARRAY_LENGTH;
     }
 
   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)
     {}
 
     HeapSlot *elements() {
         return reinterpret_cast<HeapSlot*>(uintptr_t(this) + sizeof(ObjectElements));
     }
     static ObjectElements * fromElements(HeapSlot *elems) {
         return reinterpret_cast<ObjectElements*>(uintptr_t(elems) - sizeof(ObjectElements));