Index: src/utils.h |
diff --git a/src/utils.h b/src/utils.h |
index 8ff1f9b1c826d2e47c2978c9811257c8ec481f35..ba27f07290b8f23803581e82ab295629fc03f1fc 100644 |
--- a/src/utils.h |
+++ b/src/utils.h |
@@ -597,6 +597,25 @@ static inline void MemsetPointer(T** dest, T* value, int counter) { |
} |
+// Copies data from |src| to |dst|. The data spans MUST not overlap. |
+inline void CopyWords(Object** dst, Object** src, int num_words) { |
+ ASSERT(Min(dst, src) + num_words <= Max(dst, src)); |
+ // Use block copying memcpy if the segment we're copying is |
+ // enough to justify the extra call/setup overhead. |
+ static const int kBlockCopyLimit = 16; |
+ |
+ if (num_words >= kBlockCopyLimit) { |
+ memcpy(dst, src, num_words * kPointerSize); |
+ } else { |
+ int remaining = num_words; |
+ do { |
+ remaining--; |
+ *dst++ = *src++; |
+ } while (remaining > 0); |
+ } |
+} |
+ |
+ |
// Calculate 10^exponent. |
int TenToThe(int exponent); |