| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/base/once.h" | 9 #include "src/base/once.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1985 ASSERT(heap->AllowedToBeMigrated(object, NEW_SPACE)); | 1985 ASSERT(heap->AllowedToBeMigrated(object, NEW_SPACE)); |
| 1986 AllocationResult allocation = | 1986 AllocationResult allocation = |
| 1987 heap->new_space()->AllocateRaw(allocation_size); | 1987 heap->new_space()->AllocateRaw(allocation_size); |
| 1988 | 1988 |
| 1989 HeapObject* target = NULL; // Initialization to please compiler. | 1989 HeapObject* target = NULL; // Initialization to please compiler. |
| 1990 if (allocation.To(&target)) { | 1990 if (allocation.To(&target)) { |
| 1991 if (alignment != kObjectAlignment) { | 1991 if (alignment != kObjectAlignment) { |
| 1992 target = EnsureDoubleAligned(heap, target, allocation_size); | 1992 target = EnsureDoubleAligned(heap, target, allocation_size); |
| 1993 } | 1993 } |
| 1994 | 1994 |
| 1995 // Order is important here: Set the promotion limit before migrating |
| 1996 // the object. Otherwise we may end up overwriting promotion queue |
| 1997 // entries when we migrate the object. |
| 1998 heap->promotion_queue()->SetNewLimit(heap->new_space()->top()); |
| 1999 |
| 1995 // Order is important: slot might be inside of the target if target | 2000 // Order is important: slot might be inside of the target if target |
| 1996 // was allocated over a dead object and slot comes from the store | 2001 // was allocated over a dead object and slot comes from the store |
| 1997 // buffer. | 2002 // buffer. |
| 1998 *slot = target; | 2003 *slot = target; |
| 1999 MigrateObject(heap, object, target, object_size); | 2004 MigrateObject(heap, object, target, object_size); |
| 2000 | 2005 |
| 2001 heap->promotion_queue()->SetNewLimit(heap->new_space()->top()); | |
| 2002 heap->IncrementSemiSpaceCopiedObjectSize(object_size); | 2006 heap->IncrementSemiSpaceCopiedObjectSize(object_size); |
| 2003 return true; | 2007 return true; |
| 2004 } | 2008 } |
| 2005 return false; | 2009 return false; |
| 2006 } | 2010 } |
| 2007 | 2011 |
| 2008 | 2012 |
| 2009 template<ObjectContents object_contents, int alignment> | 2013 template<ObjectContents object_contents, int alignment> |
| 2010 static inline bool PromoteObject(Map* map, | 2014 static inline bool PromoteObject(Map* map, |
| 2011 HeapObject** slot, | 2015 HeapObject** slot, |
| (...skipping 4426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6438 static_cast<int>(object_sizes_last_time_[index])); | 6442 static_cast<int>(object_sizes_last_time_[index])); |
| 6439 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6443 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6440 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6444 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6441 | 6445 |
| 6442 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6446 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6443 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6447 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6444 ClearObjectStats(); | 6448 ClearObjectStats(); |
| 6445 } | 6449 } |
| 6446 | 6450 |
| 6447 } } // namespace v8::internal | 6451 } } // namespace v8::internal |
| OLD | NEW |