summaryrefslogtreecommitdiff
path: root/deps/v8/src/heap-inl.h
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-04-14 10:34:17 -0700
committerRyan Dahl <ry@tinyclouds.org>2010-04-14 10:34:27 -0700
commit41ef1717e096a9e1761efa0df97c395f59c51f16 (patch)
tree7e854284ef8ce5189a63074857a408b6eea5a9cb /deps/v8/src/heap-inl.h
parent760bba55186eba039ca00e532f7813d2aea450a2 (diff)
downloadnode-new-41ef1717e096a9e1761efa0df97c395f59c51f16.tar.gz
Upgrade V8 to 2.2.3.1
Diffstat (limited to 'deps/v8/src/heap-inl.h')
-rw-r--r--deps/v8/src/heap-inl.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/deps/v8/src/heap-inl.h b/deps/v8/src/heap-inl.h
index 892c2892ba..bf9c535d4f 100644
--- a/deps/v8/src/heap-inl.h
+++ b/deps/v8/src/heap-inl.h
@@ -236,19 +236,27 @@ AllocationSpace Heap::TargetSpaceId(InstanceType type) {
void Heap::CopyBlock(Object** dst, Object** src, int byte_size) {
ASSERT(IsAligned(byte_size, kPointerSize));
+ CopyWords(dst, src, 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--;
+void Heap::MoveBlock(Object** dst, Object** src, size_t byte_size) {
+ ASSERT(IsAligned<size_t>(byte_size, kPointerSize));
+
+ int size_in_words = byte_size / kPointerSize;
+
+ if ((dst < src) || (dst >= (src + size_in_words))) {
+ ASSERT((dst >= (src + size_in_words)) ||
+ ((OffsetFrom(reinterpret_cast<Address>(src)) -
+ OffsetFrom(reinterpret_cast<Address>(dst))) >= kPointerSize));
+
+ Object** end = src + size_in_words;
+
+ while (src != end) {
*dst++ = *src++;
- } while (remaining > 0);
+ }
+ } else {
+ memmove(dst, src, byte_size);
}
}