Bug 1138489 - Remove JSPROP_INDEX. r=Waldo.
authorJason Orendorff <jorendorff@mozilla.com>
Mon, 02 Mar 2015 10:20:56 -0600
changeset 264654 192e8bcb8b803d36a396ad72ae000abc06d5c132
parent 264653 c8cf2a03ddcf31ea2d4355e52a89037468cd15f9
child 264655 74ecd8227fe3ef41ec9cbb5bcca257397eb74d71
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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 1138489 - Remove JSPROP_INDEX. r=Waldo.
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -2363,26 +2363,20 @@ JS_DefineElement(JSContext *cx, HandleOb
 static bool
 DefineProperty(JSContext *cx, HandleObject obj, const char *name, HandleValue value,
                const JSNativeWrapper &getter, const JSNativeWrapper &setter,
                unsigned attrs, unsigned flags)
     AutoRooterGetterSetter gsRoot(cx, attrs, const_cast<JSNative *>(&getter.op),
                                   const_cast<JSNative *>(&setter.op));
-    RootedId id(cx);
-    if (attrs & JSPROP_INDEX) {
-        id = INT_TO_JSID(intptr_t(name));
-        attrs &= ~JSPROP_INDEX;
-    } else {
-        JSAtom *atom = Atomize(cx, name, strlen(name));
-        if (!atom)
-            return false;
-        id = AtomToId(atom);
-    }
+    JSAtom *atom = Atomize(cx, name, strlen(name));
+    if (!atom)
+        return false;
+    RootedId id(cx, AtomToId(atom));
     return DefinePropertyById(cx, obj, id, value, getter, setter, attrs, flags);
 static bool
 DefineSelfHostedProperty(JSContext *cx, HandleObject obj, HandleId id,
                          const char *getterName, const char *setterName,
                          unsigned attrs, unsigned flags)
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -891,17 +891,17 @@ class MOZ_STACK_CLASS SourceBufferHolder
                                            are JSGetterOp/JSSetterOp */
 #define JSPROP_GETTER           0x10    /* property holds getter function */
 #define JSPROP_SETTER           0x20    /* property holds setter function */
 #define JSPROP_SHARED           0x40    /* don't allocate a value slot for this
                                            property; don't copy the property on
                                            set of the same-named property in an
                                            object that delegates to a prototype
                                            containing this property */
-#define JSPROP_INDEX            0x80    /* name is actually (int) index */
+#define JSPROP_INTERNAL_USE_BIT 0x80    /* internal JS engine use only */
 #define JSPROP_DEFINE_LATE     0x100    /* Don't define property when initially creating
                                            the constructor. Some objects like Function/Object
                                            have self-hosted functions that can only be defined
                                            after the initialization is already finished. */
 #define JSFUN_STUB_GSOPS       0x200    /* use JS_PropertyStub getter/setter
                                            instead of defaulting to class gsops
                                            for property holding function */
@@ -2014,19 +2014,19 @@ typedef struct JSNativeWrapper {
  * Macro static initializers which make it easy to pass no JSJitInfo as part of a
  * JSPropertySpec or JSFunctionSpec.
 #define JSNATIVE_WRAPPER(native) { {native, nullptr} }
- * To define an array element rather than a named property member, cast the
- * element's index to (const char *) and initialize name with it, and set the
- * JSPROP_INDEX bit in flags.
+ * Description of a property. JS_DefineProperties and JS_InitClass take arrays
+ * of these and define many properties at once. JS_PSG, JS_PSGS and JS_PS_END
+ * are helper macros for defining such arrays.
 struct JSPropertySpec {
     struct SelfHostedWrapper {
         void       *unused;
         const char *funname;
     const char                  *name;
--- a/js/src/vm/Shape.h
+++ b/js/src/vm/Shape.h
@@ -257,19 +257,19 @@ class ShapeTable {
      * Try to grow the table.  On failure, reports out of memory on cx
      * and returns false.  This will make any extant pointers into the
      * table invalid.  Don't call this unless needsToGrow() is true.
     bool grow(ExclusiveContext *cx);
- * Reuse the API-only JSPROP_INDEX attribute to mean shadowability.
+ * Use the reserved attribute bit to mean shadowability.
  * Shapes encode information about both a property lineage *and* a particular
  * property. This information is split across the Shape and the BaseShape
  * at shape->base(). Both Shape and BaseShape can be either owned or unowned
  * by, respectively, the Object or Shape referring to them.
  * Owned Shapes are used in dictionary objects, and form a doubly linked list