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

Side by Side Diff: test/cctest/test-utils.cc

Issue 297303004: Revert 21502 - "Move OS::MemCopy and OS::MemMove out of platform to utils" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 void TestMemMove(byte* area1, 104 void TestMemMove(byte* area1,
105 byte* area2, 105 byte* area2,
106 int src_offset, 106 int src_offset,
107 int dest_offset, 107 int dest_offset,
108 int length) { 108 int length) {
109 for (int i = 0; i < kAreaSize; i++) { 109 for (int i = 0; i < kAreaSize; i++) {
110 area1[i] = i & 0xFF; 110 area1[i] = i & 0xFF;
111 area2[i] = i & 0xFF; 111 area2[i] = i & 0xFF;
112 } 112 }
113 MemMove(area1 + dest_offset, area1 + src_offset, length); 113 OS::MemMove(area1 + dest_offset, area1 + src_offset, length);
114 memmove(area2 + dest_offset, area2 + src_offset, length); 114 memmove(area2 + dest_offset, area2 + src_offset, length);
115 if (memcmp(area1, area2, kAreaSize) != 0) { 115 if (memcmp(area1, area2, kAreaSize) != 0) {
116 printf("MemMove(): src_offset: %d, dest_offset: %d, length: %d\n", 116 printf("OS::MemMove(): src_offset: %d, dest_offset: %d, length: %d\n",
117 src_offset, dest_offset, length); 117 src_offset, dest_offset, length);
118 for (int i = 0; i < kAreaSize; i++) { 118 for (int i = 0; i < kAreaSize; i++) {
119 if (area1[i] == area2[i]) continue; 119 if (area1[i] == area2[i]) continue;
120 printf("diff at offset %d (%p): is %d, should be %d\n", i, 120 printf("diff at offset %d (%p): is %d, should be %d\n",
121 reinterpret_cast<void*>(area1 + i), area1[i], area2[i]); 121 i, reinterpret_cast<void*>(area1 + i), area1[i], area2[i]);
122 } 122 }
123 CHECK(false); 123 CHECK(false);
124 } 124 }
125 } 125 }
126 126
127 127
128 TEST(MemMove) { 128 TEST(MemMove) {
129 v8::V8::Initialize(); 129 v8::V8::Initialize();
130 byte* area1 = new byte[kAreaSize]; 130 byte* area1 = new byte[kAreaSize];
131 byte* area2 = new byte[kAreaSize]; 131 byte* area2 = new byte[kAreaSize];
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 TEST(SequenceCollectorRegression) { 211 TEST(SequenceCollectorRegression) {
212 SequenceCollector<char> collector(16); 212 SequenceCollector<char> collector(16);
213 collector.StartSequence(); 213 collector.StartSequence();
214 collector.Add('0'); 214 collector.Add('0');
215 collector.AddBlock( 215 collector.AddBlock(
216 i::Vector<const char>("12345678901234567890123456789012", 32)); 216 i::Vector<const char>("12345678901234567890123456789012", 32));
217 i::Vector<char> seq = collector.EndSequence(); 217 i::Vector<char> seq = collector.EndSequence();
218 CHECK_EQ(0, strncmp("0123456789012345678901234567890123", 218 CHECK_EQ(0, strncmp("0123456789012345678901234567890123",
219 seq.start(), seq.length())); 219 seq.start(), seq.length()));
220 } 220 }
OLDNEW
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698