Bug 429649 - Don't serialize the shortid in js_XDRBlockObject, r=igor
authorMichael Wu <mwu@mozilla.com>
Tue, 08 Mar 2011 08:59:01 -0800
changeset 64245 64ccb8c2892a0dc6ef92184876672cb671b9e5e4
parent 64244 ff5bb67330c01198a0d0035d59d1d18ad2fb449c
child 64246 d3961f0a2adec33f5176712f3b6c32f9e4aa13d2
push idunknown
push userunknown
push dateunknown
reviewersigor
bugs429649
milestone2.0b13pre
Bug 429649 - Don't serialize the shortid in js_XDRBlockObject, r=igor
js/src/jsobj.cpp
js/src/jsxdrapi.h
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -3723,23 +3723,22 @@ js_XDRBlockObject(JSXDRState *xdr, JSObj
         obj->setSlot(JSSLOT_BLOCK_DEPTH, Value(Int32Value(depth)));
 
         /*
          * XDR the block object's properties. We know that there are 'count'
          * properties to XDR, stored as id/shortid pairs.
          */
         for (uintN i = 0; i < count; i++) {
             JSAtom *atom;
-            uint16 shortid;
-
-            /* XDR the real id, then the shortid. */
-            if (!js_XDRAtom(xdr, &atom) || !JS_XDRUint16(xdr, &shortid))
+
+            /* XDR the real id. */
+            if (!js_XDRAtom(xdr, &atom))
                 return false;
 
-            if (!obj->defineBlockVariable(cx, ATOM_TO_JSID(atom), shortid))
+            if (!obj->defineBlockVariable(cx, ATOM_TO_JSID(atom), i))
                 return false;
         }
     } else {
         AutoShapeVector shapes(cx);
         shapes.growBy(count);
 
         for (Shape::Range r(obj->lastProperty()); !r.empty(); r.popFront()) {
             shape = &r.front();
@@ -3753,21 +3752,23 @@ js_XDRBlockObject(JSXDRState *xdr, JSObj
         for (uintN i = 0; i < count; i++) {
             shape = shapes[i];
             JS_ASSERT(shape->getter() == block_getProperty);
 
             jsid propid = shape->id;
             JS_ASSERT(JSID_IS_ATOM(propid));
             JSAtom *atom = JSID_TO_ATOM(propid);
 
+#ifdef DEBUG
             uint16 shortid = uint16(shape->shortid);
             JS_ASSERT(shortid == i);
-
-            /* XDR the real id, then the shortid. */
-            if (!js_XDRAtom(xdr, &atom) || !JS_XDRUint16(xdr, &shortid))
+#endif
+
+            /* XDR the real id. */
+            if (!js_XDRAtom(xdr, &atom))
                 return false;
         }
     }
     return true;
 }
 
 #endif
 
--- a/js/src/jsxdrapi.h
+++ b/js/src/jsxdrapi.h
@@ -200,17 +200,17 @@ JS_XDRFindClassById(JSXDRState *xdr, uin
  * Bytecode version number. Increment the subtrahend whenever JS bytecode
  * changes incompatibly.
  *
  * This version number should be XDR'ed once near the front of any file or
  * larger storage unit containing XDR'ed bytecode and other data, and checked
  * before deserialization of bytecode.  If the saved version does not match
  * the current version, abort deserialization and invalidate the file.
  */
-#define JSXDR_BYTECODE_VERSION      (0xb973c0de - 82)
+#define JSXDR_BYTECODE_VERSION      (0xb973c0de - 83)
 
 /*
  * Library-private functions.
  */
 extern JSBool
 js_XDRAtom(JSXDRState *xdr, JSAtom **atomp);
 
 JS_END_EXTERN_C