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

Unified Diff: src/heap-inl.h

Issue 7863: - Optimized CopyFixedArray and CopyJSObject. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 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 side-by-side diff with in-line comments
Download patch
Index: src/heap-inl.h
===================================================================
--- src/heap-inl.h (revision 546)
+++ src/heap-inl.h (working copy)
@@ -146,6 +146,25 @@
}
+void Heap::CopyBlock(Object** dst, Object** src, int byte_size) {
+ ASSERT(IsAligned(byte_size, kPointerSize));
+
+ // Use block copying memcpy if the segment we're copying is
+ // enough to justify the extra call/setup overhead.
+ static const int kBlockCopyLimit = 16 * kPointerSize;
+
+ if (byte_size >= kBlockCopyLimit) {
+ memcpy(dst, src, byte_size);
+ } else {
+ int remaining = byte_size / kPointerSize;
+ do {
+ remaining--;
+ *dst++ = *src++;
+ } while (remaining > 0);
+ }
+}
+
+
#define GC_GREEDY_CHECK() \
ASSERT(!FLAG_gc_greedy || v8::internal::Heap::GarbageCollectionGreedyCheck())

Powered by Google App Engine
This is Rietveld 408576698