[cctest] add Async Generator bytecode tests

These were originally written as part of
https://chromium-review.googlesource.com/c/550396/. I've separated them
out into a separate CL with the intent of landing it first, so that it's
easier to see the difference these CLs will have on generated bytecode.

BUG=v8:5855
TBR=tebbi@chromium.org, rmcilroy@chromium.org

Change-Id: Ib84e65847d7396e31b0e38d28f59454cf7c58fc1
Reviewed-on: https://chromium-review.googlesource.com/558221
Reviewed-by: Caitlin Potter <caitp@igalia.com>
Commit-Queue: Caitlin Potter <caitp@igalia.com>
Cr-Commit-Position: refs/heads/master@{#46370}
This commit is contained in:
Caitlin Potter 2017-07-02 16:59:29 -04:00 committed by Commit Bot
parent 6c1e67f806
commit 7cf7a4307b
2 changed files with 1035 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2358,6 +2358,34 @@ TEST(Generators) {
LoadGolden("Generators.golden")));
}
TEST(AsyncGenerators) {
bool old_flag = i::FLAG_harmony_async_iteration;
i::FLAG_harmony_async_iteration = true;
InitializedIgnitionHandleScope scope;
BytecodeExpectationsPrinter printer(CcTest::isolate());
printer.set_wrap(false);
printer.set_test_function_name("f");
const char* snippets[] = {
"async function* f() { }\n"
"f();\n",
"async function* f() { yield 42 }\n"
"f();\n",
"async function* f() { for (let x of [42]) yield x }\n"
"f();\n",
"function* g() { yield 42 }\n"
"async function* f() { yield* g() }\n"
"f();\n",
};
CHECK(CompareTexts(BuildActual(printer, snippets),
LoadGolden("AsyncGenerators.golden")));
i::FLAG_harmony_async_iteration = old_flag;
}
TEST(Modules) {
InitializedIgnitionHandleScope scope;
BytecodeExpectationsPrinter printer(CcTest::isolate());