Do not attempt to lock a non-native object. bug 436741, r=brendan
authorBlake Kaplan <mrbkap@gmail.com>
Wed, 25 Jun 2008 12:23:35 +0200
changeset 15525 8eac0738eaab7eca469685c5f1465c7cc797046e
parent 15524 a78c4eeaf51cf0af0ef24a7a200174338ba77f49
child 15526 44c589bd2a7b81d750acd26b870209f877847b00
push id286
push usermrbkap@mozilla.com
push dateWed, 25 Jun 2008 12:11:32 +0000
treeherdermozilla-central@44c589bd2a7b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbrendan
bugs436741
milestone1.9.1a1pre
Do not attempt to lock a non-native object. bug 436741, r=brendan
js/src/jsobj.cpp
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -3338,28 +3338,28 @@ js_LookupPropertyWithFlags(JSContext *cx
                     if (!ok)
                         goto cleanup;
 
                     JS_LOCK_OBJ(cx, obj);
                     if (obj2) {
                         /* Resolved: juggle locks and lookup id again. */
                         if (obj2 != obj) {
                             JS_UNLOCK_OBJ(cx, obj);
-                            JS_LOCK_OBJ(cx, obj2);
+                            if (OBJ_IS_NATIVE(obj2))
+                                JS_LOCK_OBJ(cx, obj2);
                         }
                         protoIndex = 0;
                         for (proto = start; proto && proto != obj2;
                              proto = OBJ_GET_PROTO(cx, proto)) {
                             protoIndex++;
                         }
                         scope = OBJ_SCOPE(obj2);
                         if (!MAP_IS_NATIVE(&scope->map)) {
                             /* Whoops, newresolve handed back a foreign obj2. */
                             JS_ASSERT(obj2 != obj);
-                            JS_UNLOCK_OBJ(cx, obj2);
                             ok = OBJ_LOOKUP_PROPERTY(cx, obj2, id, objp, propp);
                             if (!ok || *propp)
                                 goto cleanup;
                             JS_LOCK_OBJ(cx, obj2);
                         } else {
                             /*
                              * Require that obj2 have its own scope now, as we
                              * do for old-style resolve.  If it doesn't, then
@@ -3370,17 +3370,18 @@ js_LookupPropertyWithFlags(JSContext *cx
                              */
                             if (scope->object == obj2)
                                 sprop = SCOPE_GET_PROPERTY(scope, id);
                         }
                         if (sprop) {
                             JS_ASSERT(obj2 == scope->object);
                             obj = obj2;
                         } else if (obj2 != obj) {
-                            JS_UNLOCK_OBJ(cx, obj2);
+                            if (OBJ_IS_NATIVE(obj2))
+                                JS_UNLOCK_OBJ(cx, obj2);
                             JS_LOCK_OBJ(cx, obj);
                         }
                     }
                 } else {
                     /*
                      * Old resolve always requires id re-lookup if obj owns
                      * its scope after resolve returns.
                      */