Backed out changeset 043f06dd9135 (bug 887016)
authorTooru Fujisawa <arai_a@mac.com>
Mon, 28 Mar 2016 06:49:55 +0900
changeset 290658 f5060d63b4f8ddbb8a5f9e6db822e283701f46f0
parent 290657 dd34be112501af92dcaf4f4f24e7f67a7ceaaf7e
child 290659 8e34eeaf571fc541c0dda5198bffcc3cea6b3977
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs887016
milestone48.0a1
backs out043f06dd9135a5ce9e716f12805d4df686da2ebc
Backed out changeset 043f06dd9135 (bug 887016)
js/src/jsobj.cpp
js/src/jsobj.h
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -2271,101 +2271,80 @@ js::HasOwnProperty(JSContext* cx, Handle
     *result = (shape != nullptr);
     return true;
 }
 
 bool
 js::LookupPropertyPure(ExclusiveContext* cx, JSObject* obj, jsid id, JSObject** objp,
                        Shape** propp)
 {
-    bool isTypedArrayOutOfRange = false;
     do {
-        if (!LookupOwnPropertyPure(cx, obj, id, propp, &isTypedArrayOutOfRange))
+        if (obj->isNative()) {
+            /* Search for a native dense element, typed array element, or property. */
+
+            if (JSID_IS_INT(id) && obj->as<NativeObject>().containsDenseElement(JSID_TO_INT(id))) {
+                *objp = obj;
+                MarkDenseOrTypedArrayElementFound<NoGC>(propp);
+                return true;
+            }
+
+            if (obj->is<TypedArrayObject>()) {
+                uint64_t index;
+                if (IsTypedArrayIndex(id, &index)) {
+                    if (index < obj->as<TypedArrayObject>().length()) {
+                        *objp = obj;
+                        MarkDenseOrTypedArrayElementFound<NoGC>(propp);
+                    } else {
+                        *objp = nullptr;
+                        *propp = nullptr;
+                    }
+                    return true;
+                }
+            }
+
+            if (Shape* shape = obj->as<NativeObject>().lookupPure(id)) {
+                *objp = obj;
+                *propp = shape;
+                return true;
+            }
+
+            // Fail if there's a resolve hook, unless the mayResolve hook tells
+            // us the resolve hook won't define a property with this id.
+            if (ClassMayResolveId(cx->names(), obj->getClass(), id, obj))
+                return false;
+        } else if (obj->is<UnboxedPlainObject>()) {
+            if (obj->as<UnboxedPlainObject>().containsUnboxedOrExpandoProperty(cx, id)) {
+                *objp = obj;
+                MarkNonNativePropertyFound<NoGC>(propp);
+                return true;
+            }
+        } else if (obj->is<UnboxedArrayObject>()) {
+            if (obj->as<UnboxedArrayObject>().containsProperty(cx, id)) {
+                *objp = obj;
+                MarkNonNativePropertyFound<NoGC>(propp);
+                return true;
+            }
+        } else if (obj->is<TypedObject>()) {
+            if (obj->as<TypedObject>().typeDescr().hasProperty(cx->names(), id)) {
+                *objp = obj;
+                MarkNonNativePropertyFound<NoGC>(propp);
+                return true;
+            }
+        } else {
             return false;
-
-        if (*propp) {
-            *objp = obj;
-            return true;
-        }
-
-        if (isTypedArrayOutOfRange) {
-            *objp = nullptr;
-            return true;
         }
 
         obj = obj->getProto();
     } while (obj);
 
     *objp = nullptr;
     *propp = nullptr;
     return true;
 }
 
-bool
-js::LookupOwnPropertyPure(ExclusiveContext* cx, JSObject* obj, jsid id, Shape** propp,
-                          bool* isTypedArrayOutOfRange /* = nullptr */)
-{
-    JS::AutoCheckCannotGC nogc;
-    if (isTypedArrayOutOfRange)
-        *isTypedArrayOutOfRange = false;
-
-    if (obj->isNative()) {
-        // Search for a native dense element, typed array element, or property.
-
-        if (JSID_IS_INT(id) && obj->as<NativeObject>().containsDenseElement(JSID_TO_INT(id))) {
-            MarkDenseOrTypedArrayElementFound<NoGC>(propp);
-            return true;
-        }
-
-        if (obj->is<TypedArrayObject>()) {
-            uint64_t index;
-            if (IsTypedArrayIndex(id, &index)) {
-                if (index < obj->as<TypedArrayObject>().length()) {
-                    MarkDenseOrTypedArrayElementFound<NoGC>(propp);
-                } else {
-                    *propp = nullptr;
-                    if (isTypedArrayOutOfRange)
-                        *isTypedArrayOutOfRange = true;
-                }
-                return true;
-            }
-        }
-
-        if (Shape* shape = obj->as<NativeObject>().lookupPure(id)) {
-            *propp = shape;
-            return true;
-        }
-
-        // Fail if there's a resolve hook, unless the mayResolve hook tells
-        // us the resolve hook won't define a property with this id.
-        if (ClassMayResolveId(cx->names(), obj->getClass(), id, obj))
-            return false;
-    } else if (obj->is<UnboxedPlainObject>()) {
-        if (obj->as<UnboxedPlainObject>().containsUnboxedOrExpandoProperty(cx, id)) {
-            MarkNonNativePropertyFound<NoGC>(propp);
-            return true;
-        }
-    } else if (obj->is<UnboxedArrayObject>()) {
-        if (obj->as<UnboxedArrayObject>().containsProperty(cx, id)) {
-            MarkNonNativePropertyFound<NoGC>(propp);
-            return true;
-        }
-    } else if (obj->is<TypedObject>()) {
-        if (obj->as<TypedObject>().typeDescr().hasProperty(cx->names(), id)) {
-            MarkNonNativePropertyFound<NoGC>(propp);
-            return true;
-        }
-    } else {
-        return false;
-    }
-
-    *propp = nullptr;
-    return true;
-}
-
 static inline bool
 NativeGetPureInline(NativeObject* pobj, Shape* shape, Value* vp)
 {
     /* Fail if we have a custom getter. */
     if (!shape->hasDefaultGetter())
         return false;
 
     if (shape->hasSlot()) {
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -1211,20 +1211,16 @@ namespace js {
 extern JSObject*
 FindVariableScope(JSContext* cx, JSFunction** funp);
 
 bool
 LookupPropertyPure(ExclusiveContext* cx, JSObject* obj, jsid id, JSObject** objp,
                    Shape** propp);
 
 bool
-LookupOwnPropertyPure(ExclusiveContext* cx, JSObject* obj, jsid id, Shape** propp,
-                      bool* isTypedArrayOutOfRange = nullptr);
-
-bool
 GetPropertyPure(ExclusiveContext* cx, JSObject* obj, jsid id, Value* vp);
 
 bool
 GetGetterPure(ExclusiveContext* cx, JSObject* obj, jsid id, JSFunction** fp);
 
 bool
 GetOwnPropertyDescriptor(JSContext* cx, HandleObject obj, HandleId id,
                          MutableHandle<PropertyDescriptor> desc);