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

Unified Diff: test/cctest/compiler/test-run-jsbranches.cc

Issue 850803002: First simple implementation of for-of in TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/ast-numbering.cc ('K') | « src/compiler/pipeline.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-run-jsbranches.cc
diff --git a/test/cctest/compiler/test-run-jsbranches.cc b/test/cctest/compiler/test-run-jsbranches.cc
index 7a4a0b335b44e9b44c66171ea444cee9c9f3fe41..5a7bdb9b4ae2fb544f89267e4e085acc1fdf2ecc 100644
--- a/test/cctest/compiler/test-run-jsbranches.cc
+++ b/test/cctest/compiler/test-run-jsbranches.cc
@@ -168,6 +168,33 @@ TEST(ForInContinueStatement) {
}
+TEST(ForOfContinueStatement) {
+ const char* src =
+ "(function(a,b) {"
+ " var r = '-';"
+ " for (var x of a) {"
+ " r += x + '-';"
+ " if (b) continue;"
+ " r += 'X-';"
+ " }"
+ " return r;"
+ "})";
+ FunctionTester T(src);
+
+ CompileRun(
+ "function wrap(v) {"
+ " var iterable = {};"
+ " function next() { return { done:!v.length, value:v.shift() }; };"
+ " iterable[Symbol.iterator] = function() { return { next:next }; };"
+ " return iterable;"
+ "}");
+
+ T.CheckCall(T.Val("-"), T.NewObject("wrap([])"), T.true_value());
+ T.CheckCall(T.Val("-1-2-"), T.NewObject("wrap([1,2])"), T.true_value());
+ T.CheckCall(T.Val("-1-X-2-X-"), T.NewObject("wrap([1,2])"), T.false_value());
+}
+
+
TEST(SwitchStatement) {
const char* src =
"(function(a,b) {"
« src/ast-numbering.cc ('K') | « src/compiler/pipeline.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698