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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_x64.cc ('k') | runtime/vm/disassembler_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
(...skipping 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2299 __ ret(); 2299 __ ret();
2300 } 2300 }
2301 2301
2302 2302
2303 ASSEMBLER_TEST_RUN(TestSetCC, test) { 2303 ASSEMBLER_TEST_RUN(TestSetCC, test) {
2304 typedef uword (*TestSetCC)(); 2304 typedef uword (*TestSetCC)();
2305 uword res = reinterpret_cast<TestSetCC>(test->entry())(); 2305 uword res = reinterpret_cast<TestSetCC>(test->entry())();
2306 EXPECT_EQ(0xFFFFFF00, res); 2306 EXPECT_EQ(0xFFFFFF00, res);
2307 } 2307 }
2308 2308
2309
2310 ASSEMBLER_TEST_GENERATE(TestRepMovsBytes, assembler) {
2311 // Save incoming arguments.
2312 __ pushq(RDI); // Arg0, from.
2313 __ pushq(RSI); // Arg1, to.
2314 __ pushq(RDX); // Arg2, count.
2315 __ movq(RSI, Address(RSP, 2 * kWordSize)); // from.
2316 __ movq(RDI, Address(RSP, 1 * kWordSize)); // to.
2317 __ movq(RCX, Address(RSP, 0 * kWordSize)); // count.
2318 __ rep_movsb();
2319 // Remove saved arguments.
2320 __ popq(RAX);
2321 __ popq(RAX);
2322 __ popq(RAX);
2323 __ ret();
2324 }
2325
2326
2327 ASSEMBLER_TEST_RUN(TestRepMovsBytes, test) {
2328 const char* from = "0123456789";
2329 const char* to = new char[10];
2330 typedef void (*TestRepMovsBytes)(const char* from, const char* to, int count);
2331 reinterpret_cast<TestRepMovsBytes>(test->entry())(from, to, 10);
2332 EXPECT_EQ(to[0], '0');
2333 for (int i = 0; i < 10; i++) {
2334 EXPECT_EQ(from[i], to[i]);
2335 }
2336 delete [] to;
2337 }
2338
2309 } // namespace dart 2339 } // namespace dart
2310 2340
2311 #endif // defined TARGET_ARCH_X64 2341 #endif // defined TARGET_ARCH_X64
OLDNEW
« 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