DescriptionGenerators: Avoid calling into runtime if operand stack is empty
This patch makes yield sites save the resume continuation and context
inline. If the operand stack is empty, we can avoid a call into the
runtime. This also makes the SuspendJSGeneratorObject runtime function
less magical: it just has to save the operand stack and stack handlers.
This speeds up the following case by a factor of 3 or so:
function* until(n) {
for (var i = 0; i < n; i++)
yield i;
}
function sum(iter) {
var sum = 0;
for (var x of iter) sum += x;
return sum;
}
for (var i = 0; i < 10000; i++) sum(until(1000))
Also, there is no more sentinel value as the generators will resume in
the right place already, allowing me to remove the hack added to the
--debug-code check in r14437.
R=mstarzinger@chromium.org
BUG=
Committed: http://code.google.com/p/v8/source/detail?r=15240
Patch Set 1 : Rebased on master #
Total comments: 3
Patch Set 2 : Add asserts to runtime.cc; clarify generated runtime call #
Messages
Total messages: 6 (0 generated)
|