Bug 1002737 - Make PropDesc::setUndefined() play nicer with our asserts. (r=jorendorff)
☠☠ backed out by b922ed24938f ☠ ☠
authorEric Faust <efaustbmo@gmail.com>
Tue, 03 Jun 2014 12:37:43 -0700
changeset 205655 ad09630ae9a35a1aaec723d0df1ebc5b0569dee0
parent 205654 c0dd6b9cc07a1d80131f9193a2ed36e2cb48553c
child 205656 6d4043272a0a2084ad587fda3bae0e625911cc83
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1002737
milestone32.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 1002737 - Make PropDesc::setUndefined() play nicer with our asserts. (r=jorendorff)
js/src/vm/ObjectImpl.cpp
js/src/vm/PropDesc.h
--- a/js/src/vm/ObjectImpl.cpp
+++ b/js/src/vm/ObjectImpl.cpp
@@ -13,31 +13,39 @@
 #include "jsobjinlines.h"
 #include "vm/Shape-inl.h"
 
 using namespace js;
 
 using JS::GenericNaN;
 
 PropDesc::PropDesc()
-  : pd_(UndefinedValue()),
-    value_(UndefinedValue()),
-    get_(UndefinedValue()),
-    set_(UndefinedValue()),
-    attrs(0),
-    hasGet_(false),
-    hasSet_(false),
-    hasValue_(false),
-    hasWritable_(false),
-    hasEnumerable_(false),
-    hasConfigurable_(false),
-    isUndefined_(true)
+{
+    setUndefined();
+}
+
+void
+PropDesc::setUndefined()
 {
+    pd_ = UndefinedValue();
+    value_ = UndefinedValue();
+    get_ = UndefinedValue();
+    set_ = UndefinedValue();
+    attrs = 0;
+    hasGet_ = false;
+    hasSet_ = false;
+    hasValue_ = false;
+    hasWritable_ = false;
+    hasEnumerable_ = false;
+    hasConfigurable_ = false;
+
+    isUndefined_ = true;
 }
 
+
 bool
 PropDesc::checkGetter(JSContext *cx)
 {
     if (hasGet_) {
         if (!js_IsCallable(get_) && !get_.isUndefined()) {
             JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_GET_SET_FIELD,
                                  js_getter_str);
             return false;
--- a/js/src/vm/PropDesc.h
+++ b/js/src/vm/PropDesc.h
@@ -121,18 +121,18 @@ struct PropDesc {
      * other fields of this PropDesc from desc.
      *
      * makeObject populates pd based on the other fields of *this, creating a
      * new property descriptor JSObject and defining properties on it.
      */
     void initFromPropertyDescriptor(Handle<JSPropertyDescriptor> desc);
     bool makeObject(JSContext *cx);
 
-    void setUndefined() { isUndefined_ = true; }
-
+    /* Reset the descriptor entirely. */
+    void setUndefined();
     bool isUndefined() const { return isUndefined_; }
 
     bool hasGet() const { MOZ_ASSERT(!isUndefined()); return hasGet_; }
     bool hasSet() const { MOZ_ASSERT(!isUndefined()); return hasSet_; }
     bool hasValue() const { MOZ_ASSERT(!isUndefined()); return hasValue_; }
     bool hasWritable() const { MOZ_ASSERT(!isUndefined()); return hasWritable_; }
     bool hasEnumerable() const { MOZ_ASSERT(!isUndefined()); return hasEnumerable_; }
     bool hasConfigurable() const { MOZ_ASSERT(!isUndefined()); return hasConfigurable_; }