bug 725595 - drop native object checks from JS_(Get|Set)ReservedSlot. r=Waldo
authorIgor Bukanov <igor@mir2.org>
Fri, 10 Feb 2012 13:40:34 +0100
changeset 87009 c1b718602a5ad36a41cbcfeb3383d2e3586926b9
parent 87008 23a142cb2fc10c16d1d84d981bf352b8bc90cc40
child 87010 888416bbd8f30d61fb88521dc604d6701cea83d3
push id22071
push userbmo@edmorley.co.uk
push dateFri, 17 Feb 2012 11:08:28 +0000
treeherdermozilla-central@08e55f36b731 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
bugs725595
milestone13.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 725595 - drop native object checks from JS_(Get|Set)ReservedSlot. r=Waldo
js/src/jsapi.cpp
js/src/jsobj.cpp
js/src/jsproxy.cpp
js/src/jsproxy.h
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -4410,30 +4410,23 @@ JS_ElementIteratorStub(JSContext *cx, JS
 {
     JS_ASSERT(!keysonly);
     return JS_NewElementIterator(cx, obj);
 }
 
 JS_PUBLIC_API(jsval)
 JS_GetReservedSlot(JSObject *obj, uint32_t index)
 {
-    if (!obj->isNative())
-        return UndefinedValue();
-
-    return GetReservedSlot(obj, index);
+    return obj->getReservedSlot(index);
 }
 
 JS_PUBLIC_API(void)
 JS_SetReservedSlot(JSObject *obj, uint32_t index, jsval v)
 {
-    if (!obj->isNative())
-        return;
-
-    SetReservedSlot(obj, index, v);
-    GCPoke(obj->compartment()->rt, NullValue());
+    obj->setReservedSlot(index, v);
 }
 
 JS_PUBLIC_API(JSObject *)
 JS_NewArrayObject(JSContext *cx, jsint length, jsval *vector)
 {
     JS_THREADSAFE_ASSERT(cx->compartment != cx->runtime->atomsCompartment);
     AssertNoGC(cx);
     CHECK_REQUEST(cx);
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -3590,17 +3590,17 @@ DefineStandardSlot(JSContext *cx, JSObje
          * reserved slot. Otherwise, go through the normal property path.
          */
         JS_ASSERT(obj->isGlobal());
         JS_ASSERT(obj->isNative());
 
         const Shape *shape = obj->nativeLookup(cx, id);
         if (!shape) {
             uint32_t slot = 2 * JSProto_LIMIT + key;
-            SetReservedSlot(obj, slot, v);
+            obj->setReservedSlot(slot, v);
             if (!obj->addProperty(cx, id, JS_PropertyStub, JS_StrictPropertyStub, slot, attrs, 0, 0))
                 return false;
             AddTypePropertyId(cx, obj, id, v);
 
             named = true;
             return true;
         }
     }
@@ -3613,18 +3613,18 @@ namespace js {
 
 static void
 SetClassObject(JSObject *obj, JSProtoKey key, JSObject *cobj, JSObject *proto)
 {
     JS_ASSERT(!obj->getParent());
     if (!obj->isGlobal())
         return;
 
-    SetReservedSlot(obj, key, ObjectOrNullValue(cobj));
-    SetReservedSlot(obj, JSProto_LIMIT + key, ObjectOrNullValue(proto));
+    obj->setReservedSlot(key, ObjectOrNullValue(cobj));
+    obj->setReservedSlot(JSProto_LIMIT + key, ObjectOrNullValue(proto));
 }
 
 static void
 ClearClassObject(JSContext *cx, JSObject *obj, JSProtoKey key)
 {
     JS_ASSERT(!obj->getParent());
     if (!obj->isGlobal())
         return;
--- a/js/src/jsproxy.cpp
+++ b/js/src/jsproxy.cpp
@@ -87,16 +87,19 @@ OperationInProgress(JSContext *cx, JSObj
     while (op) {
         if (op->object == proxy)
             return true;
         op = op->next;
     }
     return false;
 }
 
+static bool
+FixProxy(JSContext *cx, JSObject *proxy, JSBool *bp);
+
 ProxyHandler::ProxyHandler(void *family) : mFamily(family)
 {
 }
 
 ProxyHandler::~ProxyHandler()
 {
 }
 
@@ -1730,18 +1733,18 @@ Class js::CallableObjectClass = {
     JS_ConvertStub,
     NULL,                    /* finalize    */
     NULL,                    /* reserved0   */
     NULL,                    /* checkAccess */
     callable_Call,
     callable_Construct,
 };
 
-JS_FRIEND_API(JSBool)
-js::FixProxy(JSContext *cx, JSObject *proxy, JSBool *bp)
+static bool
+FixProxy(JSContext *cx, JSObject *proxy, JSBool *bp)
 {
     if (OperationInProgress(cx, proxy)) {
         JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_PROXY_FIX);
         return false;
     }
 
     AutoValueRooter tvr(cx);
     if (!Proxy::fix(cx, proxy, tvr.addr()))
--- a/js/src/jsproxy.h
+++ b/js/src/jsproxy.h
@@ -178,23 +178,16 @@ GetProxyHandler(const JSObject *obj)
 
 inline const Value &
 GetProxyPrivate(const JSObject *obj)
 {
     JS_ASSERT(IsProxy(obj));
     return GetReservedSlot(obj, JSSLOT_PROXY_PRIVATE);
 }
 
-inline void
-SetProxyPrivate(JSObject *obj, const Value &priv)
-{
-    JS_ASSERT(IsProxy(obj));
-    SetReservedSlot(obj, JSSLOT_PROXY_PRIVATE, priv);
-}
-
 inline const Value &
 GetProxyExtra(const JSObject *obj, size_t n)
 {
     JS_ASSERT(IsProxy(obj));
     return GetReservedSlot(obj, JSSLOT_PROXY_EXTRA + n);
 }
 
 inline void
@@ -205,19 +198,16 @@ SetProxyExtra(JSObject *obj, size_t n, c
     SetReservedSlot(obj, JSSLOT_PROXY_EXTRA + n, extra);
 }
 
 JS_FRIEND_API(JSObject *)
 NewProxyObject(JSContext *cx, ProxyHandler *handler, const Value &priv,
                JSObject *proto, JSObject *parent,
                JSObject *call = NULL, JSObject *construct = NULL);
 
-JS_FRIEND_API(JSBool)
-FixProxy(JSContext *cx, JSObject *proxy, JSBool *bp);
-
 } /* namespace js */
 
 JS_BEGIN_EXTERN_C
 
 extern JS_FRIEND_API(JSObject *)
 js_InitProxyClass(JSContext *cx, JSObject *obj);
 
 JS_END_EXTERN_C