[v8] Re-post non-blocking ScriptStreamer tasks (reland)

Posted blocking ScriptStreamer tasks can end up in a queue, and have
their Resource complete loading before the task even starts. When this
happens, these tasks will no longer block on network input, but they
will still be posted to the blocking task runner, which does not spin up
new threads if the running task is not blocked. When there are a lot of
small functions posted for streaming, this results in a slightly
paradoxical starvation, where the blocking task runner is processing
lots of no-longer-blocking tasks all in one thread, as it has no reason
to spin up new threads.

To avoid this, if a streaming task isn't started before the resource
finishes loading, we can cancel this posted task, and instead post a new
non-blocking task to the non-blocking thread pool. This frees up the
blocking task runner to process only blocking tasks (and thus allows it
to spin up new threads for them).

TBR=kouhei@chromium.org

Bug: chromium:865098
Bug: chromium:866868
Change-Id: I930b10d23fd538b3529ab3a31f6caba13a8661fb
Reviewed-on: https://chromium-review.googlesource.com/1179744
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584032}
2 files changed