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

Unified Diff: src/heap.cc

Issue 6576: Minor adjustments to the object migration code: When copying... (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 465)
+++ src/heap.cc (working copy)
@@ -733,11 +733,21 @@
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));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698