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

Side by Side Diff: src/platform.h

Issue 13932006: Replace OS::MemCopy with OS::MemMove (just as fast but more flexible). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments 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 | « src/objects.cc ('k') | src/platform-posix.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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 // Support runtime detection of FPU on MIPS CPUs. 330 // Support runtime detection of FPU on MIPS CPUs.
331 static bool MipsCpuHasFeature(CpuFeature feature); 331 static bool MipsCpuHasFeature(CpuFeature feature);
332 332
333 // Returns the activation frame alignment constraint or zero if 333 // Returns the activation frame alignment constraint or zero if
334 // the platform doesn't care. Guaranteed to be a power of two. 334 // the platform doesn't care. Guaranteed to be a power of two.
335 static int ActivationFrameAlignment(); 335 static int ActivationFrameAlignment();
336 336
337 static void ReleaseStore(volatile AtomicWord* ptr, AtomicWord value); 337 static void ReleaseStore(volatile AtomicWord* ptr, AtomicWord value);
338 338
339 #if defined(V8_TARGET_ARCH_IA32) 339 #if defined(V8_TARGET_ARCH_IA32)
340 // Copy memory area to disjoint memory area.
341 static void MemCopy(void* dest, const void* src, size_t size);
342 // Limit below which the extra overhead of the MemCopy function is likely 340 // Limit below which the extra overhead of the MemCopy function is likely
343 // to outweigh the benefits of faster copying. 341 // to outweigh the benefits of faster copying.
344 static const int kMinComplexMemCopy = 64; 342 static const int kMinComplexMemCopy = 64;
345 typedef void (*MemCopyFunction)(void* dest, const void* src, size_t size);
346 343
344 // Copy memory area. No restrictions.
345 static void MemMove(void* dest, const void* src, size_t size);
346 typedef void (*MemMoveFunction)(void* dest, const void* src, size_t size);
347
348 // Keep the distinction of "move" vs. "copy" for the benefit of other
349 // architectures.
350 static void MemCopy(void* dest, const void* src, size_t size) {
351 MemMove(dest, src, size);
352 }
347 #else // V8_TARGET_ARCH_IA32 353 #else // V8_TARGET_ARCH_IA32
354 // Copy memory area to disjoint memory area.
348 static void MemCopy(void* dest, const void* src, size_t size) { 355 static void MemCopy(void* dest, const void* src, size_t size) {
349 memcpy(dest, src, size); 356 memcpy(dest, src, size);
350 } 357 }
358 static void MemMove(void* dest, const void* src, size_t size) {
359 memmove(dest, src, size);
360 }
351 static const int kMinComplexMemCopy = 16 * kPointerSize; 361 static const int kMinComplexMemCopy = 16 * kPointerSize;
352 #endif // V8_TARGET_ARCH_IA32 362 #endif // V8_TARGET_ARCH_IA32
353 363
354 static int GetCurrentProcessId(); 364 static int GetCurrentProcessId();
355 365
356 private: 366 private:
357 static const int msPerSecond = 1000; 367 static const int msPerSecond = 1000;
358 368
359 DISALLOW_IMPLICIT_CONSTRUCTORS(OS); 369 DISALLOW_IMPLICIT_CONSTRUCTORS(OS);
360 }; 370 };
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 Atomic32 active_; 823 Atomic32 active_;
814 PlatformData* data_; // Platform specific data. 824 PlatformData* data_; // Platform specific data.
815 int samples_taken_; // Counts stack samples taken. 825 int samples_taken_; // Counts stack samples taken.
816 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); 826 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler);
817 }; 827 };
818 828
819 829
820 } } // namespace v8::internal 830 } } // namespace v8::internal
821 831
822 #endif // V8_PLATFORM_H_ 832 #endif // V8_PLATFORM_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/platform-posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698