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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 } 726 }
727 } 727 }
728 #endif // defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) 728 #endif // defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING)
729 729
730 730
731 HeapObject* Heap::MigrateObject(HeapObject** source_p, 731 HeapObject* Heap::MigrateObject(HeapObject** source_p,
732 HeapObject* target, 732 HeapObject* target,
733 int size) { 733 int size) {
734 void** src = reinterpret_cast<void**>((*source_p)->address()); 734 void** src = reinterpret_cast<void**>((*source_p)->address());
735 void** dst = reinterpret_cast<void**>(target->address()); 735 void** dst = reinterpret_cast<void**>(target->address());
736 int counter = size/kPointerSize - 1; 736
737 do { 737 // Use block copying memcpy if the object we're migrating is big
738 *dst++ = *src++; 738 // enough to justify the extra call/setup overhead.
739 } while (counter-- > 0); 739 static const int kBlockCopyLimit = 16 * kPointerSize;
740
741 if (size >= kBlockCopyLimit) {
742 memcpy(dst, src, size);
743 } else {
744 int remaining = size / kPointerSize;
745 do {
746 remaining--;
747 *dst++ = *src++;
748 } while (remaining > 0);
749 }
740 750
741 // Set the forwarding address. 751 // Set the forwarding address.
742 (*source_p)->set_map_word(MapWord::FromForwardingAddress(target)); 752 (*source_p)->set_map_word(MapWord::FromForwardingAddress(target));
743 753
744 // Update NewSpace stats if necessary. 754 // Update NewSpace stats if necessary.
745 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) 755 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING)
746 RecordCopiedObject(target); 756 RecordCopiedObject(target);
747 #endif 757 #endif
748 758
749 return target; 759 return target;
(...skipping 2309 matching lines...) Expand 10 before | Expand all | Expand 10 after
3059 return "Scavenge"; 3069 return "Scavenge";
3060 case MARK_COMPACTOR: 3070 case MARK_COMPACTOR:
3061 return MarkCompactCollector::HasCompacted() ? "Mark-compact" 3071 return MarkCompactCollector::HasCompacted() ? "Mark-compact"
3062 : "Mark-sweep"; 3072 : "Mark-sweep";
3063 } 3073 }
3064 return "Unknown GC"; 3074 return "Unknown GC";
3065 } 3075 }
3066 3076
3067 3077
3068 } } // namespace v8::internal 3078 } } // namespace v8::internal
OLDNEW
« 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