Author: [EMAIL PROTECTED]
Date: Wed Oct 8 02:01:10 2008
New Revision: 469
Modified:
branches/bleeding_edge/src/heap.cc
Log:
Minor adjustments to the object migration code: When copying
large objects we use memcpy. If this turns out to be a wash
on the benchmarks, I'd be happy to rip it out again.
Review URL: http://codereview.chromium.org/6576
Modified: branches/bleeding_edge/src/heap.cc
==============================================================================
--- branches/bleeding_edge/src/heap.cc (original)
+++ branches/bleeding_edge/src/heap.cc Wed Oct 8 02:01:10 2008
@@ -733,10 +733,20 @@
int size) {
void** src = reinterpret_cast<void**>((*source_p)->address());
void** dst = reinterpret_cast<void**>(target->address());
- int counter = size/kPointerSize - 1;
- do {
- *dst++ = *src++;
- } while (counter-- > 0);
+
+ // Use block copying memcpy if the object we're migrating is big
+ // enough to justify the extra call/setup overhead.
+ static const int kBlockCopyLimit = 16 * kPointerSize;
+
+ if (size >= kBlockCopyLimit) {
+ memcpy(dst, src, size);
+ } else {
+ int remaining = size / kPointerSize;
+ do {
+ remaining--;
+ *dst++ = *src++;
+ } while (remaining > 0);
+ }
// Set the forwarding address.
(*source_p)->set_map_word(MapWord::FromForwardingAddress(target));
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---