[INFER] Don't immediately evict data register when storing top frame entry, bug 643653.
authorBrian Hackett <bhackett1024@gmail.com>
Tue, 22 Mar 2011 16:54:15 -0700
changeset 74840 13323fd7e400633e813160f830f9fb34a6203fab
parent 74839 496bd6239fb88a7d3cdc31874db3e799039aac92
child 74841 ea1997ab6c32b50c133ac07af880315fd3642668
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
bugs643653
milestone2.0b13pre
[INFER] Don't immediately evict data register when storing top frame entry, bug 643653.
js/src/jit-test/tests/jaeger/bug643653-1.js
js/src/methodjit/FrameState.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/jaeger/bug643653-1.js
@@ -0,0 +1,10 @@
+function f(x) {
+    var a;
+    var b = [1].length;
+    var c = x;
+    var d = b + 1;
+    AA = x;
+    a = d;
+    assertEq(b + d, 3);
+}
+f();
--- a/js/src/methodjit/FrameState.cpp
+++ b/js/src/methodjit/FrameState.cpp
@@ -2069,19 +2069,21 @@ FrameState::storeTop(FrameEntry *target,
         RegisterID reg = tempRegForData(backing);
         target->data.setRegister(reg);
         regstate(reg).reassociate(target);
 
         if (type == JSVAL_TYPE_UNKNOWN) {
             if (backing->isTypeKnown()) {
                 target->setType(backing->getKnownType());
             } else {
-                RegisterID reg = tempRegForType(backing);
-                target->type.setRegister(reg);
-                regstate(reg).reassociate(target);
+                pinReg(reg);
+                RegisterID typeReg = tempRegForType(backing);
+                unpinReg(reg);
+                target->type.setRegister(typeReg);
+                regstate(typeReg).reassociate(target);
             }
         } else if (type != JSVAL_TYPE_DOUBLE || backing->isType(JSVAL_TYPE_INT32)) {
             /*
              * Treat the stored entry as an int even if inference has marked it
              * as a float (we will fixDoubles on it before branching), to avoid
              * demoting the backing.
              */
             if (type == JSVAL_TYPE_DOUBLE)