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

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

Issue 1613163002: [interpreter] Wide register support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase 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/interpreter/register-translator.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/interpreter/test-bytecode-generator.cc
diff --git a/test/cctest/interpreter/test-bytecode-generator.cc b/test/cctest/interpreter/test-bytecode-generator.cc
index 124f12508c64a951382604da53b4c28018e4068a..20a919691e8ebd82ee83a2e984764a349ef15045 100644
--- a/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/test/cctest/interpreter/test-bytecode-generator.cc
@@ -1458,9 +1458,8 @@ TEST(PropertyCall) {
1,
{"func"}},
{"function f(a) {\n"
- " a.func;\n"
- REPEAT_127(SPACE, " a.func;\n")
- " return a.func(); }\nf(" FUNC_ARG ")",
+ " a.func;\n" REPEAT_127(
+ SPACE, " a.func;\n") " return a.func(); }\nf(" FUNC_ARG ")",
2 * kPointerSize,
2,
1046,
@@ -1472,12 +1471,13 @@ TEST(PropertyCall) {
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LoadICSloppy), R(0), U8(0), U8((wide_idx += 2))), //
- B(Ldar), A(1, 2), //
- B(Star), R(1), //
- B(LoadICSloppyWide), R(1), U16(0), U16(wide_idx + 4), //
- B(Star), R(0), //
- B(CallWide), R16(0), R16(1), U16(0), U16(wide_idx + 2), //
- B(Return), //
+ B(Ldar),
+ A(1, 2), //
+ B(Star), R(1), //
+ B(LoadICSloppyWide), R(1), U16(0), U16(wide_idx + 4), //
+ B(Star), R(0), //
+ B(CallWide), R16(0), R16(1), U16(0), U16(wide_idx + 2), //
+ B(Return), //
},
1,
{"func"}},
@@ -7282,6 +7282,273 @@ TEST(DeleteLookupSlotInEval) {
}
}
+TEST(WideRegisters) {
+ InitializedHandleScope handle_scope;
+ BytecodeGeneratorHelper helper;
+
+ // Prepare prologue that creates frame for lots of registers.
+ std::ostringstream os;
+ for (size_t i = 0; i < 157; ++i) {
+ os << "var x" << i << ";\n";
+ }
+ std::string prologue(os.str());
+
+ ExpectedSnippet<int> snippets[] = {
+ {"x0 = x127;\n"
+ "return x0;\n",
+ 161 * kPointerSize,
+ 1,
+ 15,
+ {
+ B(MovWide), R16(131), R16(125), //
+ B(Ldar), R(125), //
+ B(MovWide), R16(125), R16(131), //
+ B(Star), R(0), //
+ B(Return), //
+ }},
+ {"x127 = x126;\n"
+ "return x127;\n",
+ 161 * kPointerSize,
+ 1,
+ 37,
+ {
+ B(MovWide), R16(130), R16(125), //
+ B(Ldar), R(125), //
+ B(MovWide), R16(125), R16(130), //
+ B(MovWide), R16(131), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(131), //
+ B(MovWide), R16(131), R16(125), //
+ B(Ldar), R(125), //
+ B(MovWide), R16(125), R16(131), //
+ B(Return), //
+ }},
+ {"if (x2 > 3) { return x129; }\n"
+ "return x128;\n",
+ 162 * kPointerSize,
+ 1,
+ 56,
+ {
+ B(Ldar), R(2), //
+ B(MovWide), R16(161), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(161), //
+ B(LdaSmi8), U8(3), //
+ B(MovWide), R16(161), R16(125), //
+ B(TestGreaterThan), R(125), //
+ B(MovWide), R16(125), R16(161), //
+ B(JumpIfToBooleanFalse), U8(15), //
+ B(MovWide), R16(133), R16(125), //
+ B(Ldar), R(125), //
+ B(MovWide), R16(125), R16(133), //
+ B(Return), //
+ B(MovWide), R16(132), R16(125), //
+ B(Ldar), R(125), //
+ B(MovWide), R16(125), R16(132), //
+ B(Return), //
+ }},
+ {"var x0 = 0;\n"
+ "if (x129 == 3) { var x129 = x0; }\n"
+ "if (x2 > 3) { return x0; }\n"
+ "return x129;\n",
+ 162 * kPointerSize,
+ 1,
+ 103,
+ {
+ B(LdaZero), //
+ B(Star), R(0), //
+ B(MovWide), R16(133), R16(125), //
+ B(Ldar), R(125), //
+ B(MovWide), R16(125), R16(133), //
+ B(MovWide), R16(161), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(161), //
+ B(LdaSmi8), U8(3), //
+ B(MovWide), R16(161), R16(125), //
+ B(TestEqual), R(125), //
+ B(MovWide), R16(125), R16(161), //
+ B(JumpIfToBooleanFalse), U8(16), //
+ B(Ldar), R(0), //
+ B(MovWide), R16(133), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(133), //
+ B(Ldar), R(2), //
+ B(MovWide), R16(161), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(161), //
+ B(LdaSmi8), U8(3), //
+ B(MovWide), R16(161), R16(125), //
+ B(TestGreaterThan), R(125), //
+ B(MovWide), R16(125), R16(161), //
+ B(JumpIfToBooleanFalse), U8(5), //
+ B(Ldar), R(0), //
+ B(Return), //
+ B(MovWide), R16(133), R16(125), //
+ B(Ldar), R(125), //
+ B(MovWide), R16(125), R16(133), //
+ B(Return), //
+ }},
+ {"var x0 = 0;\n"
+ "var x1 = 0;\n"
+ "for (x128 = 0; x128 < 64; x128++) {"
+ " x1 += x128;"
+ "}"
+ "return x128;\n",
+ 162 * kPointerSize,
+ 1,
+ 152,
+ {
+ B(LdaZero), //
+ B(Star), R(0), //
+ B(LdaZero), //
+ B(Star), R(1), //
+ B(LdaZero), //
+ B(MovWide), R16(132), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(132), //
+ B(MovWide), R16(132), R16(125), //
+ B(Ldar), R(125), //
+ B(MovWide), R16(125), R16(132), //
+ B(MovWide), R16(161), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(161), //
+ B(LdaSmi8), U8(64), //
+ B(MovWide), R16(161), R16(125), //
+ B(TestLessThan), R(125), //
+ B(MovWide), R16(125), R16(161), //
+ B(JumpIfToBooleanFalse), U8(82), //
+ B(Ldar), R(1), //
+ B(MovWide), R16(161), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(161), //
+ B(MovWide), R16(132), R16(125), //
+ B(Ldar), R(125), //
+ B(MovWide), R16(125), R16(132), //
+ B(MovWide), R16(161), R16(125), //
+ B(Add), R(125), //
+ B(MovWide), R16(125), R16(161), //
+ B(Star), R(1), //
+ B(MovWide), R16(132), R16(125), //
+ B(Ldar), R(125), //
+ B(MovWide), R16(125), R16(132), //
+ B(ToNumber), //
+ B(MovWide), R16(161), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(161), //
+ B(Inc), //
+ B(MovWide), R16(132), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(132), //
+ B(Jump), U8(-118), //
+ B(MovWide), R16(132), R16(125), //
+ B(Ldar), R(125), //
+ B(MovWide), R16(125), R16(132), //
+ B(Return), //
+ }},
+ {"var x0 = 1234;\n"
+ "var x1 = 0;\n"
+ "for (x128 in x0) {"
+ " x1 += x128;"
+ "}"
+ "return x1;\n",
+ 167 * kPointerSize,
+ 1,
+ 159,
+ {
+ B(LdaConstant), U8(0), //
+ B(Star), R(0), //
+ B(LdaZero), //
+ B(Star), R(1), //
+ B(Ldar), R(0), //
+ B(JumpIfUndefinedConstant), U8(3), //
+ B(JumpIfNullConstant), U8(2), //
+ B(ToObject), //
+ B(JumpIfNullConstant), U8(1), //
+ B(MovWide), R16(161), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(161), //
+ B(ForInPrepareWide), R16(162), //
+ B(LdaZero), //
+ B(MovWide), R16(165), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(165), //
+ B(MovWide), R16(165), R16(125), //
+ B(MovWide), R16(164), R16(126), //
+ B(ForInDone), R(125), R(126), //
+ B(MovWide), R16(126), R16(164), //
+ B(MovWide), R16(125), R16(165), //
+ B(JumpIfToBooleanTrue), U8(89), //
+ B(ForInNextWide), R16(161), R16(165), R16(162), //
+ B(JumpIfUndefined), U8(54), //
+ B(MovWide), R16(132), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(132), //
+ B(Ldar), R(1), //
+ B(MovWide), R16(166), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(166), //
+ B(MovWide), R16(132), R16(125), //
+ B(Ldar), R(125), //
+ B(MovWide), R16(125), R16(132), //
+ B(MovWide), R16(166), R16(125), //
+ B(Add), R(125), //
+ B(MovWide), R16(125), R16(166), //
+ B(Star), R(1), //
+ B(MovWide), R16(165), R16(125), //
+ B(ForInStep), R(125), //
+ B(MovWide), R16(125), R16(165), //
+ B(MovWide), R16(165), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(165), //
+ B(Jump), U8(-110), //
+ B(Ldar), R(1), //
+ B(Return), //
+ },
+ 4,
+ {1234, 142, 145, 147}},
+ {"x0 = %Add(x64, x63);\n"
+ "x1 = %Add(x27, x143);\n"
+ "%TheHole();\n"
+ "return x1;\n",
+ 163 * kPointerSize,
+ 1,
+ 90,
+ {
+ B(Ldar), R(64), //
+ B(MovWide), R16(161), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(161), //
+ B(Ldar), R(63), //
+ B(MovWide), R16(162), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(162), //
+ B(CallRuntimeWide), U16(Runtime::kAdd), R16(161), U8(2), //
+ B(Star), R(0), //
+ B(Ldar), R(27), //
+ B(MovWide), R16(161), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(161), //
+ B(MovWide), R16(147), R16(125), //
+ B(Ldar), R(125), //
+ B(MovWide), R16(125), R16(147), //
+ B(MovWide), R16(162), R16(125), //
+ B(Star), R(125), //
+ B(MovWide), R16(125), R16(162), //
+ B(CallRuntimeWide), U16(Runtime::kAdd), R16(161), U8(2), //
+ B(Star), R(1), //
+ B(CallRuntime), U16(Runtime::kTheHole), R(0), U8(0), //
+ B(Ldar), R(1), //
+ B(Return), //
+ }}};
+
+ for (size_t i = 0; i < arraysize(snippets); ++i) {
+ std::string body = prologue + snippets[i].code_snippet;
+ Handle<BytecodeArray> bytecode_array =
+ helper.MakeBytecodeForFunctionBody(body.c_str());
+ CheckBytecodeArrayEqual(snippets[i], bytecode_array);
+ }
+}
+
} // namespace interpreter
} // namespace internal
} // namespace v8
« no previous file with comments | « src/interpreter/register-translator.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698