Closed Bug 508146 Opened 15 years ago Closed 15 years ago

TM: Fix stack arithmetic for deeply nested closures

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

VERIFIED FIXED
Tracking Status
status1.9.2 --- beta1-fixed

People

(Reporter: dmandelin, Assigned: dmandelin)

Details

(Keywords: verified1.9.2, Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

Attached patch PatchSplinter Review
While reading code to fix another bug, I noticed that the stack navigation arithmetic GetUpvarOnTrace had not been updated for the inclusion of |arguments| in the native stack area (see bug 453730). It fails on this test case:

function f(a, b) {
  function g(x, y) {
    function h(m, n) {
      function k(u, v) {
	for (var i = 0; i < 5; ++i) {
	  print(a + ' ' + b + ' ' + x + ' ' + y + ' ' + m + ' ' + n + ' ' + u + ' ' + v);
	}
      }
      k(m+1, n+1);
    }
    h(x+1, y+1);
  }
  g(a+1, b+1);
}

for (var i = 0; i < 5; ++i) {
  f(i, i+i);
}

It's really only m and n that get the wrong value, but I figure testing more rigorously isn't bad. 

The solution is simply to adjust the formulas to account for the presence of |arguments| on the trace stack right after the arguments and before the local slots.
Attachment #392371 - Flags: review?(gal)
Attachment #392371 - Flags: review?(gal) → review+
Pushed to TM as 691a47bca2ae.

Note that as of today, this doesn't affect release branch, as the patch that caused the problem (c76558a87dd9) hasn't been taken on branch.
Whiteboard: fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/691a47bca2ae
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Flags: blocking1.9.2+
Priority: -- → P1
js/src/trace-test.js
Flags: in-testsuite+
testNestedClosures
v 1.9.3, 1.9.2
Status: RESOLVED → VERIFIED
Keywords: verified1.9.2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: