Merge
authorRobert Sayre <sayrer@gmail.com>
Tue, 27 Jul 2010 13:09:42 -0700
changeset 48602 144b2bbb24edcd5c22293352b8bdc7fd8b18507c
parent 48601 6410c02c7fe04215ebab735916b201dfec3df310 (current diff)
parent 48600 8ad1738e14f592a72cc32a3a063412c1561b9c8a (diff)
child 48603 af1686bcc2632c49f9fdba973957a982a427a227
push id14748
push userrsayre@mozilla.com
push dateSun, 01 Aug 2010 00:33:23 +0000
treeherdermozilla-central@f0df797bb2a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone2.0b3pre
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
Merge
--- a/js/src/jsinterp.cpp
+++ b/js/src/jsinterp.cpp
@@ -4196,18 +4196,18 @@ BEGIN_CASE(JSOP_UNBRAND)
     if (!regs.sp[-1].toObject().unbrand(cx))
         goto error;
 END_CASE(JSOP_UNBRAND)
 
 BEGIN_CASE(JSOP_SETNAME)
 BEGIN_CASE(JSOP_SETPROP)
 BEGIN_CASE(JSOP_SETMETHOD)
 {
-    Value &rref = regs.sp[-1];
-    JS_ASSERT_IF(op == JSOP_SETMETHOD, IsFunctionObject(rref));
+    Value rval = regs.sp[-1];
+    JS_ASSERT_IF(op == JSOP_SETMETHOD, IsFunctionObject(rval));
     Value &lref = regs.sp[-2];
     JS_ASSERT_IF(op == JSOP_SETNAME, lref.isObject());
     JSObject *obj;
     VALUE_TO_OBJECT(cx, &lref, obj);
 
     do {
         PropertyCache *cache = &JS_PROPERTY_CACHE(cx);
 
@@ -4268,17 +4268,17 @@ BEGIN_CASE(JSOP_SETMETHOD)
 
                 /* The cache entry doesn't apply. vshape mismatch. */
                 checkForAdd = false;
             } else if (!scope->isSharedEmpty()) {
                 if (sprop == scope->lastProperty() || scope->hasProperty(sprop)) {
                   fast_set_propcache_hit:
                     PCMETER(cache->pchits++);
                     PCMETER(cache->setpchits++);
-                    NATIVE_SET(cx, obj, sprop, entry, &rref);
+                    NATIVE_SET(cx, obj, sprop, entry, &rval);
                     break;
                 }
                 checkForAdd = sprop->hasSlot() && sprop->parent == scope->lastProperty();
             } else {
                 /*
                  * We check that cx own obj here and will continue to
                  * own it after js_GetMutableScope returns so we can
                  * continue to skip JS_UNLOCK_OBJ calls.
@@ -4346,17 +4346,17 @@ BEGIN_CASE(JSOP_SETMETHOD)
 
                 /*
                  * No method change check here because here we are
                  * adding a new property, not updating an existing
                  * slot's value that might contain a method of a
                  * branded scope.
                  */
                 TRACE_2(SetPropHit, entry, sprop);
-                obj->lockedSetSlot(slot, rref);
+                obj->lockedSetSlot(slot, rval);
 
                 /*
                  * Purge the property cache of the id we may have just
                  * shadowed in obj's scope and proto chains. We do this
                  * after unlocking obj's scope to avoid lock nesting.
                  */
                 js_PurgeScopeChain(cx, obj, sprop->id);
                 break;
@@ -4369,37 +4369,37 @@ BEGIN_CASE(JSOP_SETMETHOD)
              * the slow path, via fullTest).
              */
             ASSERT_VALID_PROPERTY_CACHE_HIT(0, obj, obj2, entry);
             JSScopeProperty *sprop = NULL;
             if (obj == obj2) {
                 sprop = entry->vword.toSprop();
                 JS_ASSERT(sprop->writable());
                 JS_ASSERT(!obj2->scope()->sealed());
-                NATIVE_SET(cx, obj, sprop, entry, &rref);
+                NATIVE_SET(cx, obj, sprop, entry, &rval);
             }
             if (sprop)
                 break;
         }
 
         if (!atom)
             LOAD_ATOM(0, atom);
         jsid id = ATOM_TO_JSID(atom);
         if (entry && JS_LIKELY(obj->map->ops->setProperty == js_SetProperty)) {
             uintN defineHow;
             if (op == JSOP_SETMETHOD)
                 defineHow = JSDNP_CACHE_RESULT | JSDNP_SET_METHOD;
             else if (op == JSOP_SETNAME)
                 defineHow = JSDNP_CACHE_RESULT | JSDNP_UNQUALIFIED;
             else
                 defineHow = JSDNP_CACHE_RESULT;
-            if (!js_SetPropertyHelper(cx, obj, id, defineHow, &rref))
+            if (!js_SetPropertyHelper(cx, obj, id, defineHow, &rval))
                 goto error;
         } else {
-            if (!obj->setProperty(cx, id, &rref))
+            if (!obj->setProperty(cx, id, &rval))
                 goto error;
             ABORT_RECORDING(cx, "Non-native set");
         }
     } while (0);
 }
 END_SET_CASE_STORE_RVAL(JSOP_SETPROP, 2);
 
 BEGIN_CASE(JSOP_GETELEM)
@@ -4508,46 +4508,49 @@ BEGIN_CASE(JSOP_CALLELEM)
 END_CASE(JSOP_CALLELEM)
 
 BEGIN_CASE(JSOP_SETELEM)
 {
     JSObject *obj;
     FETCH_OBJECT(cx, -3, obj);
     jsid id;
     FETCH_ELEMENT_ID(obj, -2, id);
+    Value rval;
     do {
         if (obj->isDenseArray() && JSID_IS_INT(id)) {
             jsuint length = obj->getDenseArrayCapacity();
             jsint i = JSID_TO_INT(id);
             if ((jsuint)i < length) {
                 if (obj->getDenseArrayElement(i).isMagic(JS_ARRAY_HOLE)) {
                     if (js_PrototypeHasIndexedProperties(cx, obj))
                         break;
                     if ((jsuint)i >= obj->getArrayLength())
                         obj->setArrayLength(i + 1);
                 }
                 obj->setDenseArrayElement(i, regs.sp[-1]);
                 goto end_setelem;
             }
         }
     } while (0);
-    if (!obj->setProperty(cx, id, &regs.sp[-1]))
+    rval = regs.sp[-1];
+    if (!obj->setProperty(cx, id, &rval))
         goto error;
   end_setelem:;
 }
 END_SET_CASE_STORE_RVAL(JSOP_SETELEM, 3)
 
 BEGIN_CASE(JSOP_ENUMELEM)
 {
     /* Funky: the value to set is under the [obj, id] pair. */
     JSObject *obj;
     FETCH_OBJECT(cx, -2, obj);
     jsid id;
     FETCH_ELEMENT_ID(obj, -1, id);
-    if (!obj->setProperty(cx, id, &regs.sp[-3]))
+    Value rval = regs.sp[-3];
+    if (!obj->setProperty(cx, id, &rval))
         goto error;
     regs.sp -= 3;
 }
 END_CASE(JSOP_ENUMELEM)
 
 {
     JSFunction *fun;
     JSObject *obj;
new file mode 100644
--- /dev/null
+++ b/js/src/trace-test/tests/basic/testAssignmentThatIgnoresSetterRetval.js
@@ -0,0 +1,10 @@
+var o = {
+    set x() {
+        return 42;
+    }
+};
+
+for (var i = 0; i < 10; ++i) {
+    var z = o.x = "choose me";
+    assertEq(z, "choose me");
+}