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

Unified Diff: test/cctest/compiler/test-run-bytecode-graph-builder.cc

Issue 1546683002: [Interpreter] Add support for jumps using constants with wide operands. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Incorporate comments on patchset 13. Created 4 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
« no previous file with comments | « src/objects.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-run-bytecode-graph-builder.cc
diff --git a/test/cctest/compiler/test-run-bytecode-graph-builder.cc b/test/cctest/compiler/test-run-bytecode-graph-builder.cc
index be1fefeee52e9a338489251acd607680c3e76473..2f5c4ff57b626c8ab87b7178ebe581d86c9c23cc 100644
--- a/test/cctest/compiler/test-run-bytecode-graph-builder.cc
+++ b/test/cctest/compiler/test-run-bytecode-graph-builder.cc
@@ -2106,6 +2106,46 @@ TEST(BytecodeGraphBuilderForIn) {
}
+TEST(JumpWithConstantsAndWideConstants) {
+ HandleAndZoneScope scope;
+ auto isolate = scope.main_isolate();
+ const int kStep = 19;
+ int start = 7;
+ for (int constants = start; constants < 256 + 3 * kStep; constants += kStep) {
+ std::stringstream filler_os;
+ // Generate a string that consumes constant pool entries and
+ // spread out branch distances in script below.
+ for (int i = 0; i < constants; i++) {
+ filler_os << "var x_ = 'x_" << i << "';\n";
+ }
+ std::string filler(filler_os.str());
+
+ std::stringstream script_os;
+ script_os << "function " << kFunctionName << "(a) {\n";
+ script_os << " " << filler;
+ script_os << " for (var i = a; i < 2; i++) {\n";
+ script_os << " " << filler;
+ script_os << " if (i == 0) { " << filler << "i = 10; continue; }\n";
+ script_os << " else if (i == a) { " << filler << "i = 12; break; }\n";
+ script_os << " else { " << filler << " }\n";
+ script_os << " }\n";
+ script_os << " return i;\n";
+ script_os << "}\n";
+ script_os << kFunctionName << "(0);\n";
+ std::string script(script_os.str());
+ auto factory = isolate->factory();
+ auto zone = scope.main_zone();
+ for (int a = 0; a < 3; a++) {
+ BytecodeGraphTester tester(isolate, zone, script.c_str());
+ auto callable = tester.GetCallable<Handle<Object>>();
+ Handle<Object> return_val =
+ callable(factory->NewNumberFromInt(a)).ToHandleChecked();
+ static const int results[] = {11, 12, 2};
+ CHECK_EQ(Handle<Smi>::cast(return_val)->value(), results[a]);
+ }
+ }
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/objects.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698