Make sure to call XML methods properly in property ICs, no bug. r=dvander
☠☠ backed out by 54cd89b0f1fa ☠ ☠
authorBrian Hackett <bhackett1024@gmail.com>
Thu, 05 Jan 2012 12:57:06 -0800
changeset 85126 c0d337401801dba787908b933e9b4f80d7764eb6
parent 85125 050b661a6ceaff1c4fbe2706f56582203f6bfdfd
child 85127 f6928624a1ce9d224c9af73a59d06f88a1f2e459
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
milestone12.0a1
Make sure to call XML methods properly in property ICs, no bug. r=dvander
js/src/jsinterpinlines.h
js/src/methodjit/PolyIC.cpp
--- a/js/src/jsinterpinlines.h
+++ b/js/src/jsinterpinlines.h
@@ -195,16 +195,31 @@ AssertValidPropertyCacheHit(JSContext *c
 #else
 inline void
 AssertValidPropertyCacheHit(JSContext *cx, JSObject *start, JSObject *found,
                             PropertyCacheEntry *entry)
 {}
 #endif
 
 inline bool
+GetPropertyGenericMaybeCallXML(JSContext *cx, JSOp op, JSObject *obj, jsid id, Value *vp)
+{
+    /*
+     * Various XML properties behave differently when accessed in a
+     * call vs. normal context, and getGeneric will not work right.
+     */
+#if JS_HAS_XML_SUPPORT
+    if (op == JSOP_CALLPROP && obj->isXML())
+        return js_GetXMLMethod(cx, obj, id, vp);
+#endif
+
+    return obj->getGeneric(cx, id, vp);
+}
+
+inline bool
 GetPropertyOperation(JSContext *cx, jsbytecode *pc, const Value &lval, Value *vp)
 {
     JS_ASSERT(vp != &lval);
 
     JSOp op = JSOp(*pc);
 
     if (op == JSOP_LENGTH) {
         /* Optimize length accesses on strings, arrays, and arguments. */
@@ -259,30 +274,18 @@ GetPropertyOperation(JSContext *cx, jsby
         if (!NativeGet(cx, obj, obj2, entry->prop, flags, vp))
             return false;
         return true;
     }
 
     jsid id = ATOM_TO_JSID(name);
 
     if (obj->getOps()->getProperty) {
-#if JS_HAS_XML_SUPPORT
-        if (op == JSOP_CALLPROP && obj->isXML()) {
-            /*
-             * Various XML properties behave differently when accessed in a
-             * call vs. normal context, and getGeneric will not work right.
-             */
-            if (!js_GetXMLMethod(cx, obj, id, vp))
-                return false;
-        } else
-#endif
-        {
-            if (!obj->getGeneric(cx, id, vp))
-                return false;
-        }
+        if (!GetPropertyGenericMaybeCallXML(cx, op, obj, id, vp))
+            return false;
     } else {
         if (!GetPropertyHelper(cx, obj, id, flags, vp))
             return false;
     }
 
 #if JS_HAS_NO_SUCH_METHOD
     if (op == JSOP_CALLPROP &&
         JS_UNLIKELY(vp->isPrimitive()) &&
--- a/js/src/methodjit/PolyIC.cpp
+++ b/js/src/methodjit/PolyIC.cpp
@@ -1902,17 +1902,17 @@ GetPropWithStub(VMFrame &f, ic::PICInfo 
 
     if (!monitor.recompiled() && pic->shouldUpdate(f.cx)) {
         GetPropCompiler cc(f, script, obj, *pic, name, stub);
         if (!cc.update())
             THROW();
     }
 
     Value v;
-    if (!obj->getProperty(f.cx, name, &v))
+    if (!GetPropertyGenericMaybeCallXML(f.cx, JSOp(*f.pc()), obj, ATOM_TO_JSID(name), &v))
         THROW();
 
     f.regs.sp[-1] = v;
 }
 
 static void JS_FASTCALL
 DisabledGetPropIC(VMFrame &f, ic::PICInfo *pic)
 {