Test for getters in the tracer GETELEM IC (bug 633752, r=cdleary).
authorDavid Anderson <danderson@mozilla.com>
Wed, 16 Feb 2011 11:48:58 -0800
changeset 62785 34c05b9c0079571c3e15bfaede1e6c5b58d5ada3
parent 62784 bddea4962013c02ecb95bcbb3cb004b811e90f24
child 62786 14dda9fd96862cb20173bf2e346ab575926499b8
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
reviewerscdleary
bugs633752
milestone2.0b12pre
Test for getters in the tracer GETELEM IC (bug 633752, r=cdleary).
js/src/jit-test/tests/basic/bug633752.js
js/src/jstracer.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/bug633752.js
@@ -0,0 +1,11 @@
+function f(o) {
+    var p = "arguments";
+    for(var i=0; i<10; i++) {
+        f[p];
+    }
+}
+f({});
+f({});
+f({});
+f({});
+
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -6245,16 +6245,20 @@ IsEntryTypeCompatible(const Value &v, JS
         debug_only_printf(LC_TMTracer, "%s", "(incompatible types)");
 #endif
     return ok;
 }
 
 static inline bool
 IsFrameObjPtrTypeCompatible(void *p, JSStackFrame *fp, JSValueType type)
 {
+    debug_only_printf(LC_TMTracer, "%c/%c ", TypeToChar(type),
+                      (p == fp->addressOfScopeChain() || fp->hasArgsObj())
+                      ? TypeToChar(JSVAL_TYPE_NONFUNOBJ)
+                      : TypeToChar(JSVAL_TYPE_NULL));
     if (p == fp->addressOfScopeChain())
         return type == JSVAL_TYPE_NONFUNOBJ;
     JS_ASSERT(p == fp->addressOfArgs());
     JS_ASSERT(type == JSVAL_TYPE_NONFUNOBJ || type == JSVAL_TYPE_NULL);
     return fp->hasArgsObj() == (type == JSVAL_TYPE_NONFUNOBJ);
 }
 
 class TypeCompatibilityVisitor : public SlotVisitorBase
@@ -12679,17 +12683,17 @@ GetPropertyByName(JSContext* cx, JSObjec
     JSObject *holder;
     if (!js_GetPropertyHelperWithShape(cx, obj, obj, id, JSGET_METHOD_BARRIER, vp, &shape,
                                        &holder)) {
         SetBuiltinError(tm);
         return false;
     }
 
     /* Only update the table when the object is the holder of the property. */
-    if (obj == holder && shape->hasSlot()) {
+    if (obj == holder && shape->hasSlot() && shape->hasDefaultGetter()) {
         /*
          * Note: we insert the non-normalized id into the table so you don't need to
          * normalize it before hitting in the table (faster lookup).
          */
         picTable->update(obj->shape(), id, shape->slot);
     }
     
     return WasBuiltinSuccessful(tm);