Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Issue 15990004: Generators: Avoid calling into runtime if operand stack is empty (Closed)

Created:
7 years, 7 months ago by wingo
Modified:
7 years, 6 months ago
CC:
v8-dev
Visibility:
Public.

Description

Generators: 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+123 lines, -54 lines) Patch
M src/arm/full-codegen-arm.cc View 1 3 chunks +39 lines, -14 lines 0 comments Download
M src/ia32/code-stubs-ia32.cc View 1 chunk +0 lines, -5 lines 0 comments Download
M src/ia32/full-codegen-ia32.cc View 1 3 chunks +37 lines, -9 lines 0 comments Download
M src/runtime.cc View 1 2 chunks +10 lines, -18 lines 0 comments Download
M src/x64/full-codegen-x64.cc View 1 3 chunks +37 lines, -8 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
wingo
7 years, 7 months ago (2013-05-24 12:00:44 UTC) #1
wingo
Whenever the tree unfreezes, I'd like to get this one in -- it speeds up ...
7 years, 6 months ago (2013-06-20 07:16:02 UTC) #2
Michael Starzinger
https://codereview.chromium.org/15990004/diff/3001/src/ia32/full-codegen-ia32.cc File src/ia32/full-codegen-ia32.cc (right): https://codereview.chromium.org/15990004/diff/3001/src/ia32/full-codegen-ia32.cc#newcode1967 src/ia32/full-codegen-ia32.cc:1967: Immediate(Smi::FromInt(continuation.pos()))); It's too bad that we cannot reliably predict ...
7 years, 6 months ago (2013-06-20 12:08:31 UTC) #3
wingo
Addressed comments; PTAL.
7 years, 6 months ago (2013-06-20 12:45:45 UTC) #4
Michael Starzinger
LGTM.
7 years, 6 months ago (2013-06-20 12:54:05 UTC) #5
wingo
7 years, 6 months ago (2013-06-20 12:59:55 UTC) #6
Message was sent while issue was closed.
Committed patchset #2 manually as r15240 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698