[INFER] Fix build break.
authorBrian Hackett <bhackett1024@gmail.com>
Sat, 02 Jul 2011 06:38:36 -0700
changeset 75171 a24aa7a782bfb4e2da91367e3bd9a1f8cb160623
parent 75170 670548b1f7ce841766f524cadbaf51aa408bcec9
child 75172 ab061e5730cbeb014a06fd4c500f6c97c181b782
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
milestone7.0a1
[INFER] Fix build break.
js/src/jsfriendapi.cpp
js/src/jsfriendapi.h
js/src/jsobj.cpp
js/src/jsobjinlines.h
js/src/xpconnect/src/xpcjsruntime.cpp
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -109,8 +109,16 @@ JS_NewObjectWithUniqueType(JSContext *cx
     if (obj->hasSpecialEquality())
         types::MarkTypeObjectFlags(cx, type, types::OBJECT_FLAG_SPECIAL_EQUALITY);
     if (!obj->setTypeAndUniqueShape(cx, type))
         return NULL;
     type->singleton = obj;
 
     return obj;
 }
+
+JS_FRIEND_API(uint32)
+JS_ObjectCountDynamicSlots(JSObject *obj)
+{
+    if (obj->hasSlotsArray())
+        return obj->numDynamicSlots(obj->numSlots());
+    return 0;
+}
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -58,11 +58,14 @@ extern JS_FRIEND_API(JSObject *)
 JS_GetFrameScopeChainRaw(JSStackFrame *fp);
 
 extern JS_FRIEND_API(void)
 JS_SplicePrototype(JSContext *cx, JSObject *obj, JSObject *proto);
 
 extern JS_FRIEND_API(JSObject *)
 JS_NewObjectWithUniqueType(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent);
 
+extern JS_FRIEND_API(uint32)
+JS_ObjectCountDynamicSlots(JSObject *obj);
+
 JS_END_EXTERN_C
 
 #endif /* jsfriendapi_h___ */
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -4311,24 +4311,16 @@ JSObject::copySlotRange(size_t start, co
                 memcpy(slots, vector + localCopy, (length - localCopy) * sizeof(Value));
             }
         } else {
             memcpy(slots + start - fixed, vector, length * sizeof(Value));
         }
     }
 }
 
-/* Get the number of dynamic slots needed for a given capacity. */
-inline size_t
-JSObject::numDynamicSlots(size_t capacity) const
-{
-    JS_ASSERT(capacity >= numFixedSlots());
-    return isDenseArray() ? capacity : capacity - numFixedSlots();
-}
-
 bool
 JSObject::allocSlots(JSContext *cx, size_t newcap)
 {
     JS_ASSERT(newcap >= numSlots() && !hasSlotsArray());
 
     /*
      * If we are allocating slots for an object whose type is always created
      * by calling 'new' on a particular script, bump the GC kind for that
--- a/js/src/jsobjinlines.h
+++ b/js/src/jsobjinlines.h
@@ -338,16 +338,23 @@ JSObject::getRawSlot(size_t slot, js::Va
 inline bool
 JSObject::isFixedSlot(size_t slot)
 {
     JS_ASSERT(!isDenseArray());
     return slot < numFixedSlots();
 }
 
 inline size_t
+JSObject::numDynamicSlots(size_t capacity) const
+{
+    JS_ASSERT(capacity >= numFixedSlots());
+    return isDenseArray() ? capacity : capacity - numFixedSlots();
+}
+
+inline size_t
 JSObject::dynamicSlotIndex(size_t slot)
 {
     JS_ASSERT(!isDenseArray() && slot >= numFixedSlots());
     return slot - numFixedSlots();
 }
 
 inline bool
 JSObject::ensureClassReservedSlots(JSContext *cx)
--- a/js/src/xpconnect/src/xpcjsruntime.cpp
+++ b/js/src/xpconnect/src/xpcjsruntime.cpp
@@ -1334,20 +1334,18 @@ struct PRInt64Data {
 #ifdef _MSC_VER
 #pragma optimize("", off)
 #endif
 void
 GetJSObjectSlotsCallback(JSContext *cx, void *v, size_t traceKind, void *thing)
 {
     JS_ASSERT(traceKind == JSTRACE_OBJECT);
     JSObject *obj = (JSObject *)thing;
-    if (obj->hasSlotsArray()) {
-        PRInt64Data *data = (PRInt64Data *) v;
-        data->n += obj->numDynamicSlots(obj->numSlots()) * sizeof(js::Value);
-    }
+    PRInt64Data *data = (PRInt64Data *) v;
+    data->n += JS_ObjectCountDynamicSlots(obj) * sizeof(js::Value);
 }
 #ifdef _MSC_VER
 #pragma optimize("", on)
 #endif
 
 static PRInt64
 GetJSObjectSlots(void *dummy)
 {