[INFER] Always track active loop in liveness analysis, bug 643829.

This commit is contained in:
Brian Hackett 2011-04-06 14:04:24 -07:00
parent 40cc39a621
commit ac1a9b0c9c
3 changed files with 23 additions and 5 deletions

View File

@ -0,0 +1,11 @@
x = 10;
outer:
while (x < 10) {
while (x < 10) {
if (x < 10)
continue outer;
while (x < 10) {
y = 0;
}
}
}

View File

@ -788,6 +788,7 @@ LifetimeScript::analyze(JSContext *cx, analyze::Script *analysis, JSScript *scri
* For each such variable, look for the last lifetime segment in the body
* and extend it to the end of the loop.
*/
JS_ASSERT(loop == codeArray[offset].loop);
unsigned backedge = codeArray[offset].loop->backedge;
for (unsigned i = 0; i < nfixed; i++) {
if (locals[i].lifetime && !extendVariable(cx, locals[i], offset, backedge))
@ -798,8 +799,8 @@ LifetimeScript::analyze(JSContext *cx, analyze::Script *analysis, JSScript *scri
return false;
}
JS_ASSERT_IF(loop, loop == codeArray[offset].loop);
loop = NULL;
loop = loop->parent;
JS_ASSERT_IF(loop, loop->head < offset);
}
/* Find the last jump target in the loop, other than the initial entry point. */
@ -931,10 +932,13 @@ LifetimeScript::analyze(JSContext *cx, analyze::Script *analysis, JSScript *scri
if (loop && loop->entry > loop->lastBlock)
loop->lastBlock = loop->entry;
loop = ArenaNew<LifetimeLoop>(pool);
if (!loop)
LifetimeLoop *nloop = ArenaNew<LifetimeLoop>(pool);
if (!nloop)
return false;
PodZero(loop);
PodZero(nloop);
nloop->parent = loop;
loop = nloop;
codeArray[targetOffset].loop = loop;
loop->head = targetOffset;

View File

@ -377,6 +377,9 @@ struct Lifetime
/* Lifetime and modset information for a loop. */
struct LifetimeLoop
{
/* Any loop this one is nested in. */
LifetimeLoop *parent;
/* Offset of the head of the loop. */
uint32 head;