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

Side by Side Diff: src/v8utils.h

Issue 24584004: Remove unused function MoveBytes(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 | « no previous file | test/cctest/test-utils.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 do { 187 do {
188 num_bytes--; 188 num_bytes--;
189 *dst++ = *src++; 189 *dst++ = *src++;
190 } while (num_bytes > 0); 190 } while (num_bytes > 0);
191 } else { 191 } else {
192 OS::MemCopy(dst, src, num_bytes); 192 OS::MemCopy(dst, src, num_bytes);
193 } 193 }
194 } 194 }
195 195
196 196
197 // Copies data from |src| to |dst|. No restrictions.
198 template <typename T>
199 inline void MoveBytes(T* dst, const T* src, size_t num_bytes) {
200 STATIC_ASSERT(sizeof(T) == 1);
201 switch (num_bytes) {
202 case 0: return;
203 case 1:
204 *dst = *src;
205 return;
206 #ifdef V8_HOST_CAN_READ_UNALIGNED
207 case 2:
208 *reinterpret_cast<uint16_t*>(dst) = *reinterpret_cast<const uint16_t*>(src);
209 return;
210 case 3: {
211 uint16_t part1 = *reinterpret_cast<const uint16_t*>(src);
212 byte part2 = *(src + 2);
213 *reinterpret_cast<uint16_t*>(dst) = part1;
214 *(dst + 2) = part2;
215 return;
216 }
217 case 4:
218 *reinterpret_cast<uint32_t*>(dst) = *reinterpret_cast<const uint32_t*>(src);
219 return;
220 case 5:
221 case 6:
222 case 7:
223 case 8: {
224 uint32_t part1 = *reinterpret_cast<const uint32_t*>(src);
225 uint32_t part2 = *reinterpret_cast<const uint32_t*>(src + num_bytes - 4);
226 *reinterpret_cast<uint32_t*>(dst) = part1;
227 *reinterpret_cast<uint32_t*>(dst + num_bytes - 4) = part2;
228 return;
229 }
230 case 9:
231 case 10:
232 case 11:
233 case 12:
234 case 13:
235 case 14:
236 case 15:
237 case 16: {
238 double part1 = *reinterpret_cast<const double*>(src);
239 double part2 = *reinterpret_cast<const double*>(src + num_bytes - 8);
240 *reinterpret_cast<double*>(dst) = part1;
241 *reinterpret_cast<double*>(dst + num_bytes - 8) = part2;
242 return;
243 }
244 #endif
245 default:
246 OS::MemMove(dst, src, num_bytes);
247 return;
248 }
249 }
250
251
252 template <typename T, typename U> 197 template <typename T, typename U>
253 inline void MemsetPointer(T** dest, U* value, int counter) { 198 inline void MemsetPointer(T** dest, U* value, int counter) {
254 #ifdef DEBUG 199 #ifdef DEBUG
255 T* a = NULL; 200 T* a = NULL;
256 U* b = NULL; 201 U* b = NULL;
257 a = b; // Fake assignment to check assignability. 202 a = b; // Fake assignment to check assignability.
258 USE(a); 203 USE(a);
259 #endif // DEBUG 204 #endif // DEBUG
260 #if V8_HOST_ARCH_IA32 205 #if V8_HOST_ARCH_IA32
261 #define STOS "stosl" 206 #define STOS "stosl"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 434
490 // Add formatted contents like printf based on a va_list. 435 // Add formatted contents like printf based on a va_list.
491 void AddFormattedList(const char* format, va_list list); 436 void AddFormattedList(const char* format, va_list list);
492 private: 437 private:
493 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); 438 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder);
494 }; 439 };
495 440
496 } } // namespace v8::internal 441 } } // namespace v8::internal
497 442
498 #endif // V8_V8UTILS_H_ 443 #endif // V8_V8UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698