| 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/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 } | 823 } |
| 824 | 824 |
| 825 | 825 |
| 826 void Heap::EnsureFillerObjectAtTop() { | 826 void Heap::EnsureFillerObjectAtTop() { |
| 827 // There may be an allocation memento behind every object in new space. | 827 // There may be an allocation memento behind every object in new space. |
| 828 // If we evacuate a not full new space or if we are on the last page of | 828 // If we evacuate a not full new space or if we are on the last page of |
| 829 // the new space, then there may be uninitialized memory behind the top | 829 // the new space, then there may be uninitialized memory behind the top |
| 830 // pointer of the new space page. We store a filler object there to | 830 // pointer of the new space page. We store a filler object there to |
| 831 // identify the unused space. | 831 // identify the unused space. |
| 832 Address from_top = new_space_.top(); | 832 Address from_top = new_space_.top(); |
| 833 Address from_limit = new_space_.limit(); | 833 // Check that from_top is inside its page (i.e., not at the end). |
| 834 if (from_top < from_limit) { | 834 Address space_end = new_space_.ToSpaceEnd(); |
| 835 int remaining_in_page = static_cast<int>(from_limit - from_top); | 835 if (from_top < space_end) { |
| 836 CreateFillerObjectAt(from_top, remaining_in_page); | 836 Page* page = Page::FromAddress(from_top); |
| 837 if (page->Contains(from_top)) { |
| 838 int remaining_in_page = static_cast<int>(page->area_end() - from_top); |
| 839 CreateFillerObjectAt(from_top, remaining_in_page); |
| 840 } |
| 837 } | 841 } |
| 838 } | 842 } |
| 839 | 843 |
| 840 | 844 |
| 841 bool Heap::CollectGarbage(GarbageCollector collector, const char* gc_reason, | 845 bool Heap::CollectGarbage(GarbageCollector collector, const char* gc_reason, |
| 842 const char* collector_reason, | 846 const char* collector_reason, |
| 843 const v8::GCCallbackFlags gc_callback_flags) { | 847 const v8::GCCallbackFlags gc_callback_flags) { |
| 844 // The VM is in the GC state until exiting this function. | 848 // The VM is in the GC state until exiting this function. |
| 845 VMState<GC> state(isolate_); | 849 VMState<GC> state(isolate_); |
| 846 | 850 |
| (...skipping 5592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6439 static_cast<int>(object_sizes_last_time_[index])); | 6443 static_cast<int>(object_sizes_last_time_[index])); |
| 6440 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6444 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6441 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6445 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6442 | 6446 |
| 6443 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6447 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6444 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6448 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6445 ClearObjectStats(); | 6449 ClearObjectStats(); |
| 6446 } | 6450 } |
| 6447 } | 6451 } |
| 6448 } // namespace v8::internal | 6452 } // namespace v8::internal |
| OLD | NEW |