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

Unified Diff: runtime/vm/assembler_x64_test.cc

Issue 14122002: Use rep_movsb for copying one-byte strings in substring intrinsic. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/disassembler_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_x64_test.cc
===================================================================
--- runtime/vm/assembler_x64_test.cc (revision 21290)
+++ runtime/vm/assembler_x64_test.cc (working copy)
@@ -2306,6 +2306,36 @@
EXPECT_EQ(0xFFFFFF00, res);
}
+
+ASSEMBLER_TEST_GENERATE(TestRepMovsBytes, assembler) {
+ // Save incoming arguments.
+ __ pushq(RDI); // Arg0, from.
+ __ pushq(RSI); // Arg1, to.
+ __ pushq(RDX); // Arg2, count.
+ __ movq(RSI, Address(RSP, 2 * kWordSize)); // from.
+ __ movq(RDI, Address(RSP, 1 * kWordSize)); // to.
+ __ movq(RCX, Address(RSP, 0 * kWordSize)); // count.
+ __ rep_movsb();
+ // Remove saved arguments.
+ __ popq(RAX);
+ __ popq(RAX);
+ __ popq(RAX);
+ __ ret();
+}
+
+
+ASSEMBLER_TEST_RUN(TestRepMovsBytes, test) {
+ const char* from = "0123456789";
+ const char* to = new char[10];
+ typedef void (*TestRepMovsBytes)(const char* from, const char* to, int count);
+ reinterpret_cast<TestRepMovsBytes>(test->entry())(from, to, 10);
+ EXPECT_EQ(to[0], '0');
+ for (int i = 0; i < 10; i++) {
+ EXPECT_EQ(from[i], to[i]);
+ }
+ delete [] to;
+}
+
} // namespace dart
#endif // defined TARGET_ARCH_X64
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/disassembler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698