[INFER] Fix broken DefineConstructorAndPrototype logic, make jstype unsigned.
authorBrian Hackett <bhackett1024@gmail.com>
Thu, 31 Mar 2011 03:26:10 -0700
changeset 74881 bc0a254d5c681bab517856f7749ee917ea5807ac
parent 74880 ca3aaca8c59083448afb82da0d10cbc41a6e4680
child 74882 bde17df8b4b60dc36c9410a4c2a479d85c3dfbc1
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
milestone2.0b13pre
[INFER] Fix broken DefineConstructorAndPrototype logic, make jstype unsigned.
js/src/jsinfer.h
js/src/jsobj.cpp
--- a/js/src/jsinfer.h
+++ b/js/src/jsinfer.h
@@ -69,17 +69,17 @@ struct TypeFunction;
 struct TypeCompartment;
 struct ClonedTypeSet;
 
 /*
  * Information about a single concrete type.  This is a non-zero value whose
  * lower 3 bits indicate a particular primitive type below, and if those bits
  * are zero then a pointer to a type object.
  */
-typedef jsword jstype;
+typedef jsuword jstype;
 
 /* The primitive types. */
 const jstype TYPE_UNDEFINED = 1;
 const jstype TYPE_NULL      = 2;
 const jstype TYPE_BOOLEAN   = 3;
 const jstype TYPE_INT32     = 4;
 const jstype TYPE_DOUBLE    = 5;
 const jstype TYPE_STRING    = 6;
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -4006,21 +4006,21 @@ DefineConstructorAndPrototype(JSContext 
         if (!fun)
             goto bad;
 
         /*
          * Set the class object early for standard class constructors. Type
          * inference may need to access these, and js_GetClassPrototype will
          * fail if it tries to do a reentrant reconstruction of the class.
          */
-        if (key != JSProto_Null && !(clasp->flags & JSCLASS_CONSTRUCT_PROTOTYPE) &&
-            !SetClassObject(cx, obj, key, fun, proto)) {
-            goto bad;
+        if (key != JSProto_Null && !(clasp->flags & JSCLASS_CONSTRUCT_PROTOTYPE)) {
+            if (!SetClassObject(cx, obj, key, fun, proto))
+                goto bad;
+            cached = true;
         }
-        cached = true;
 
         AutoValueRooter tvr2(cx, ObjectValue(*fun));
         if (!DefineStandardSlot(cx, obj, key, atom, tvr2.value(), 0, named))
             goto bad;
 
         /*
          * Remember the class this function is a constructor for so that
          * we know to create an object of this class when we call the