Fix SetGlobalName checking for getters instead of setters (bug 625438, r=jorendorff).
authorDavid Anderson <danderson@mozilla.com>
Fri, 21 Jan 2011 14:25:51 -0800
changeset 61211 96f460867847b25eedd685c7621da40d3672f7b1
parent 61210 33f07113de5fcf6bbe59ce554402b22c91cfebcb
child 61212 737a29c9ba554602cc923f702010d92b00c5ef5a
push id18277
push usercleary@mozilla.com
push dateTue, 25 Jan 2011 03:52:51 +0000
treeherdermozilla-central@7ee91bd90e7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs625438
milestone2.0b10pre
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
Fix SetGlobalName checking for getters instead of setters (bug 625438, r=jorendorff).
js/src/jit-test/tests/jaeger/bug625438.js
js/src/methodjit/MonoIC.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/jaeger/bug625438.js
@@ -0,0 +1,10 @@
+// vim: set ts=4 sw=4 tw=99 et:
+
+var count = 0;
+watch("x", function() {
+    count++;
+});
+for(var i=0; i<10; i++) {
+    x = 2;
+}
+assertEq(count, 10);
--- a/js/src/methodjit/MonoIC.cpp
+++ b/js/src/methodjit/MonoIC.cpp
@@ -155,17 +155,18 @@ ic::SetGlobalName(VMFrame &f, ic::MICInf
     JSScript *script = f.fp()->script();
     JSAtom *atom = script->getAtom(GET_INDEX(f.regs.pc));
     jsid id = ATOM_TO_JSID(atom);
 
     JS_ASSERT(ic->kind == ic::MICInfo::SET);
 
     const Shape *shape = obj->nativeLookup(id);
     if (!shape ||
-        !shape->hasDefaultGetterOrIsMethod() ||
+        shape->isMethod() ||
+        !shape->hasDefaultSetter() ||
         !shape->writable() ||
         !shape->hasSlot())
     {
         if (shape)
             PatchSetFallback(f, ic);
         if (ic->u.name.usePropertyCache)
             STRICT_VARIANT(stubs::SetGlobalName)(f, atom);
         else