Account for all special CALLPROP behavior in inline cache stub, bug 717208. r=dvander
authorBrian Hackett <bhackett1024@gmail.com>
Wed, 11 Jan 2012 17:31:41 -0800
changeset 84323 16f0d80b3137f26f033e681d6e1d17675af32448
parent 84322 91ed31395881c4589e4afbe4eb60052778473924
child 84324 ebb34e2325778e6be9d312c7619e25585bc7561f
push id21839
push usermbrubeck@mozilla.com
push dateThu, 12 Jan 2012 16:24:29 +0000
treeherdermozilla-central@fb5bcf9ae739 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs717208
milestone12.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
Account for all special CALLPROP behavior in inline cache stub, bug 717208. r=dvander
js/src/jit-test/tests/basic/bug717208.js
js/src/methodjit/PolyIC.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/bug717208.js
@@ -0,0 +1,15 @@
+var count = 0;
+var a = {__noSuchMethod__: function() { count++; } }
+
+function f() {
+  for (var i = 0; i < 10; i++) {
+    try {
+      a.b();
+    } catch (e) {
+      assertEq(true, false);
+    }
+  }
+}
+f();
+
+assertEq(count, 10);
--- a/js/src/methodjit/PolyIC.cpp
+++ b/js/src/methodjit/PolyIC.cpp
@@ -1830,19 +1830,33 @@ class BindNameCompiler : public PICStubC
         LookupStatus status = generateStub(obj);
         if (status == Lookup_Error)
             return NULL;
 
         return obj;
     }
 };
 
+static void JS_FASTCALL
+DisabledGetPropIC(VMFrame &f, ic::PICInfo *pic)
+{
+    stubs::GetProp(f, pic->name);
+}
+
+static void JS_FASTCALL
+DisabledGetPropNoCacheIC(VMFrame &f, ic::PICInfo *pic)
+{
+    stubs::GetPropNoCache(f, pic->name);
+}
+
 static inline void
-GetPropWithStub(VMFrame &f, ic::PICInfo *pic, VoidStubPIC stub)
+GetPropMaybeCached(VMFrame &f, ic::PICInfo *pic, bool cached)
 {
+    VoidStubPIC stub = cached ? DisabledGetPropIC : DisabledGetPropNoCacheIC;
+
     JSScript *script = f.fp()->script();
 
     PropertyName *name = pic->name;
     if (name == f.cx->runtime->atomState.lengthAtom) {
         if (f.regs.sp[-1].isMagic(JS_LAZY_ARGUMENTS)) {
             f.regs.sp[-1].setInt32(f.regs.fp()->numActualArgs());
             return;
         } else if (!f.regs.sp[-1].isPrimitive()) {
@@ -1902,44 +1916,37 @@ 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 (!GetPropertyGenericMaybeCallXML(f.cx, JSOp(*f.pc()), obj, ATOM_TO_JSID(name), &v))
-        THROW();
+    if (cached) {
+        if (!GetPropertyOperation(f.cx, f.pc(), ObjectValue(*obj), &v))
+            THROW();
+    } else {
+        if (!obj->getProperty(f.cx, name, &v))
+            THROW();
+    }
 
     f.regs.sp[-1] = v;
 }
 
-static void JS_FASTCALL
-DisabledGetPropIC(VMFrame &f, ic::PICInfo *pic)
-{
-    stubs::GetProp(f, pic->name);
-}
-
-static void JS_FASTCALL
-DisabledGetPropNoCacheIC(VMFrame &f, ic::PICInfo *pic)
-{
-    stubs::GetPropNoCache(f, pic->name);
-}
-
 void JS_FASTCALL
 ic::GetProp(VMFrame &f, ic::PICInfo *pic)
 {
-    GetPropWithStub(f, pic, DisabledGetPropIC);
+    GetPropMaybeCached(f, pic, /* cache = */ true);
 }
 
 void JS_FASTCALL
 ic::GetPropNoCache(VMFrame &f, ic::PICInfo *pic)
 {
-    GetPropWithStub(f, pic, DisabledGetPropNoCacheIC);
+    GetPropMaybeCached(f, pic, /* cache = */ false);
 }
 
 template <JSBool strict>
 static void JS_FASTCALL
 DisabledSetPropIC(VMFrame &f, ic::PICInfo *pic)
 {
     stubs::SetName<strict>(f, pic->name);
 }