Closed
Bug 706091
Opened 14 years ago
Closed 14 years ago
JS Correctness: Different output with/without options "-m -n -a" and generator
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 584594
People
(Reporter: decoder, Unassigned)
Details
(Keywords: regression, testcase, Whiteboard: js-triage-needed)
The following test produces different output with/without options -m -n -a on mozilla-central revision e320f9f5536f:
test();
function test() {
print("Hello world!");
var g = (function() {
try {
test("with({x: (c) = (x2 = [])})false;");
} finally { yield 3; }
})();
g.next();
}
The amount of lines outputted differs depending on the CLI options (where $JS is just the javascript shell binary):
$ $JS -m -n min.js | wc -l
67
$ $JS -m -n -a min.js | wc -l
55
$ $JS min.js | wc -l
80
Comment 1•14 years ago
|
||
The stack is getting exhausted by this testcase, so the number of calls before the failure happens will vary depending on compilation options. The stack overflow exception is generated, but ends up getting swallowed by the 'yield' inside the 'finally' block.
Comment 2•14 years ago
|
||
Talked to dherman on IRC, and the generator behavior is correct here --- yielding with a pending exception suspends the current frame and doesn't post the exception until the generator resumes. Since next() is only called on the generator once, the exception never gets posted.
Updated•14 years ago
|
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
Comment 3•14 years ago
|
||
bhackett's comment looks right to me. This is just a difference of how many stack frames you can allocate before you get a stack overflow. The stack overflow exception is dropped because the generator is only advanced to yield in the finally block, but not resumed afterwards. Then all the outer frames just successfully complete the try-block and also yield from the finally block.
So net result: you get as many lines of output as there were test() stack frames before the overflow.
Dave
Updated•14 years ago
|
Resolution: INVALID → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•