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

Unified Diff: src/v8utils.h

Issue 12970006: Use internal memcpy for CopyWords and when copying code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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 | « src/heap.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8utils.h
diff --git a/src/v8utils.h b/src/v8utils.h
index fd785452f8a774969c9829dc704e55707ff0ed5b..606d8e7f404dc0e82b52cbde0b64a3d6b2835175 100644
--- a/src/v8utils.h
+++ b/src/v8utils.h
@@ -111,6 +111,7 @@ int WriteAsCFile(const char* filename, const char* varname,
const char* str, int size, bool verbose = true);
+// ----------------------------------------------------------------------------
// Data structures
template <typename T>
@@ -120,6 +121,8 @@ inline Vector< Handle<Object> > HandleVector(v8::internal::Handle<T>* elms,
reinterpret_cast<v8::internal::Handle<Object>*>(elms), length);
}
+
+// ----------------------------------------------------------------------------
// Memory
// Copies data from |src| to |dst|. The data spans must not overlap.
@@ -129,12 +132,13 @@ inline void CopyWords(T* dst, T* src, int num_words) {
ASSERT(Min(dst, src) + num_words <= Max(dst, src));
ASSERT(num_words > 0);
- // Use block copying memcpy if the segment we're copying is
+ // Use block copying OS::MemCopy if the segment we're copying is
// enough to justify the extra call/setup overhead.
static const int kBlockCopyLimit = 16;
+ STATIC_ASSERT(kBlockCopyLimit * kPointerSize >= OS::kMinComplexMemCopy);
if (num_words >= kBlockCopyLimit) {
- memcpy(dst, src, num_words * kPointerSize);
+ OS::MemCopy(dst, src, num_words * kPointerSize);
} else {
int remaining = num_words;
do {
@@ -153,7 +157,7 @@ inline void CopyBytes(T* dst, T* src, int num_bytes) {
ASSERT(num_bytes >= 0);
if (num_bytes == 0) return;
- // Use block copying memcpy if the segment we're copying is
+ // Use block copying OS::MemCopy if the segment we're copying is
// enough to justify the extra call/setup overhead.
static const int kBlockCopyLimit = OS::kMinComplexMemCopy;
« no previous file with comments | « src/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698