Correctly calculate tree call stack adjustment, even if we don't have any arguments in the current frame and hand pick some cleanups from the backed-out changeset.

This commit is contained in:
Andreas Gal 2008-08-19 23:31:33 -07:00
parent 39d9d53d83
commit fb3cf056d9
2 changed files with 7 additions and 8 deletions

View File

@ -1143,11 +1143,11 @@ LIns*
TraceRecorder::writeBack(LIns* i, LIns* base, ptrdiff_t offset) TraceRecorder::writeBack(LIns* i, LIns* base, ptrdiff_t offset)
{ {
/* Sink all type casts targeting the stack into the side exit by simply storing the original /* Sink all type casts targeting the stack into the side exit by simply storing the original
(uncasted) value. Each guard generates the side exit map based on the types of the (uncasted) value. Each guard generates the side exit map based on the types of the
last stores to every stack location, so its safe to not perform them on-trace. */ last stores to every stack location, so its safe to not perform them on-trace. */
if (isPromoteInt(i)) if (isPromoteInt(i))
i = ::demote(lir, i); i = ::demote(lir, i);
return lir->insStorei(i, base, offset); return lir->insStorei(i, base, offset);
} }
/* Update the tracker, then issue a write back store. */ /* Update the tracker, then issue a write back store. */
@ -1260,7 +1260,6 @@ TraceRecorder::snapshot(ExitType exitType)
*m = isNumber(*vp) *m = isNumber(*vp)
? (isPromoteInt(i) ? JSVAL_INT : JSVAL_DOUBLE) ? (isPromoteInt(i) ? JSVAL_INT : JSVAL_DOUBLE)
: JSVAL_TAG(*vp); : JSVAL_TAG(*vp);
if (*m == JSVAL_INT && JSVAL_TAG(*vp) == 2)
JS_ASSERT((*m != JSVAL_INT) || isInt32(*vp)); JS_ASSERT((*m != JSVAL_INT) || isInt32(*vp));
++m; ++m;
); );
@ -1434,7 +1433,7 @@ TraceRecorder::emitTreeCallStackSetup(Fragment* inner)
if (callDepth > 0) { if (callDepth > 0) {
/* Calculate the amount we have to lift the native stack pointer by to compensate for /* Calculate the amount we have to lift the native stack pointer by to compensate for
any outer frames that the inner tree doesn't expect but the outer tree has. */ any outer frames that the inner tree doesn't expect but the outer tree has. */
ptrdiff_t sp_adj = nativeStackOffset(&cx->fp->argv[0]); ptrdiff_t sp_adj = nativeStackOffset(&cx->fp->argv[-1]) + sizeof(double);
/* Calculate the amount we have to lift the call stack by */ /* Calculate the amount we have to lift the call stack by */
ptrdiff_t rp_adj = callDepth * sizeof(FrameInfo); ptrdiff_t rp_adj = callDepth * sizeof(FrameInfo);
/* Guard that we have enough stack space for the tree we are trying to call on top /* Guard that we have enough stack space for the tree we are trying to call on top

View File

@ -779,7 +779,7 @@ function deep2() {
return "ok"; return "ok";
} }
deep2.expected = "ok"; deep2.expected = "ok";
test(deep2) test(deep2);
var merge_type_maps_x = 0, merge_type_maps_y = 0; var merge_type_maps_x = 0, merge_type_maps_y = 0;
function merge_type_maps() { function merge_type_maps() {