summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2017-05-02 10:50:00 +0200
committerMichaël Zasso <targos@protonmail.com>2017-05-06 20:02:35 +0200
commit60d1aac8d225e844e68ae48e8f3d58802e635fbe (patch)
tree922f347dd054db18d88666fad7181e5a777f4022 /deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
parent73d9c0f903ae371cd5011af64c3a6f69a1bda978 (diff)
downloadnode-new-60d1aac8d225e844e68ae48e8f3d58802e635fbe.tar.gz
deps: update V8 to 5.8.283.38
PR-URL: https://github.com/nodejs/node/pull/12784 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Diffstat (limited to 'deps/v8/test/cctest/interpreter/test-bytecode-generator.cc')
-rw-r--r--deps/v8/test/cctest/interpreter/test-bytecode-generator.cc67
1 files changed, 67 insertions, 0 deletions
diff --git a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
index b43384e946..5ee0a6fc3c 100644
--- a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
@@ -2343,6 +2343,73 @@ TEST(SuperCallAndSpread) {
LoadGolden("SuperCallAndSpread.golden")));
}
+TEST(CallAndSpread) {
+ InitializedIgnitionHandleScope scope;
+ BytecodeExpectationsPrinter printer(CcTest::isolate());
+ const char* snippets[] = {"Math.max(...[1, 2, 3]);\n",
+ "Math.max(0, ...[1, 2, 3]);\n",
+ "Math.max(0, ...[1, 2, 3], 4);\n"};
+
+ CHECK(CompareTexts(BuildActual(printer, snippets),
+ LoadGolden("CallAndSpread.golden")));
+}
+
+TEST(NewAndSpread) {
+ InitializedIgnitionHandleScope scope;
+ BytecodeExpectationsPrinter printer(CcTest::isolate());
+ const char* snippets[] = {
+ "class A { constructor(...args) { this.args = args; } }\n"
+ "new A(...[1, 2, 3]);\n",
+
+ "class A { constructor(...args) { this.args = args; } }\n"
+ "new A(0, ...[1, 2, 3]);\n",
+
+ "class A { constructor(...args) { this.args = args; } }\n"
+ "new A(0, ...[1, 2, 3], 4);\n"};
+
+ CHECK(CompareTexts(BuildActual(printer, snippets),
+ LoadGolden("NewAndSpread.golden")));
+}
+
+TEST(ForAwaitOf) {
+ 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"
+ " for await (let x of [1, 2, 3]) {}\n"
+ "}\n"
+ "f();\n",
+
+ "async function f() {\n"
+ " for await (let x of [1, 2, 3]) { return x; }\n"
+ "}\n"
+ "f();\n",
+
+ "async function f() {\n"
+ " for await (let x of [10, 20, 30]) {\n"
+ " if (x == 10) continue;\n"
+ " if (x == 20) break;\n"
+ " }\n"
+ "}\n"
+ "f();\n",
+
+ "async function f() {\n"
+ " var x = { 'a': 1, 'b': 2 };\n"
+ " for (x['a'] of [1,2,3]) { return x['a']; }\n"
+ "}\n"
+ "f();\n"};
+
+ CHECK(CompareTexts(BuildActual(printer, snippets),
+ LoadGolden("ForAwaitOf.golden")));
+
+ i::FLAG_harmony_async_iteration = old_flag;
+}
+
} // namespace interpreter
} // namespace internal
} // namespace v8