Bug 1002737 - Make PropDesc::setUndefined() play nicer with our asserts. (r=jorendorff)
authorEric Faust <efaustbmo@gmail.com>
Tue, 03 Jun 2014 12:37:43 -0700
changeset 206216 d1a3b8ee7c7e017aa684eb42b82fe62ed68ed811
parent 206215 00481a443cf0a10162d8b928ff0d66fc24b18ca9
child 206217 c14b461b3c244c41cfed02a753b83a1407ac86bf
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
@@ -122,18 +122,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_; }