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

Unified Diff: test/cctest/interpreter/test-interpreter.cc

Issue 1414193006: [Interpreter] Removes unnecessary jumps and dead code from If and loops. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Adds a test for generating JumpIfToBoolean for If statement. The earlier tests were optimized out b… Created 5 years, 1 month 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
« no previous file with comments | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/interpreter/test-interpreter.cc
diff --git a/test/cctest/interpreter/test-interpreter.cc b/test/cctest/interpreter/test-interpreter.cc
index cf47662c93e6a2db2d7969020f88e81de00ef2fa..98b7a77d5da14e71732132d9ccd83554ecff3993 100644
--- a/test/cctest/interpreter/test-interpreter.cc
+++ b/test/cctest/interpreter/test-interpreter.cc
@@ -2577,7 +2577,45 @@ TEST(InterpreterBasicLoops) {
" b *= 2;\n"
"}\n"
"return b;",
- factory->NewHeapNumber(1024))};
+ factory->NewHeapNumber(1024)),
+ std::make_pair("var a = 10; var b = 1;\n"
+ "while (false) {\n"
+ " b = b * 2;\n"
+ " a = a - 1;\n"
+ "}\n"
+ "return b;\n",
+ Handle<Object>(Smi::FromInt(1), isolate)),
+ std::make_pair("var a = 10; var b = 1;\n"
+ "while (true) {\n"
+ " b = b * 2;\n"
+ " a = a - 1;\n"
+ " if (a == 0) break;"
+ " continue;"
+ "}\n"
+ "return b;\n",
+ factory->NewHeapNumber(1024)),
+ std::make_pair("var a = 10; var b = 1;\n"
+ "do {\n"
+ " b = b * 2;\n"
+ " a = a - 1;\n"
+ " if (a == 0) break;"
+ "} while(true);\n"
+ "return b;\n",
+ factory->NewHeapNumber(1024)),
+ std::make_pair("var a = 10; var b = 1;\n"
+ "do {\n"
+ " b = b * 2;\n"
+ " a = a - 1;\n"
+ " if (a == 0) break;"
+ "} while(false);\n"
+ "return b;\n",
+ Handle<Object>(Smi::FromInt(2), isolate)),
+ std::make_pair("var a = 10; var b = 1;\n"
+ "for ( a = 1, b = 30; false; ) {\n"
+ " b = b * 2;\n"
+ "}\n"
+ "return b;\n",
+ Handle<Object>(Smi::FromInt(30), isolate))};
for (size_t i = 0; i < arraysize(loops); i++) {
std::string source(InterpreterTester::SourceForBody(loops[i].first));
« no previous file with comments | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698