| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
| 9 #include "src/full-codegen.h" | 9 #include "src/full-codegen.h" |
| 10 #include "src/heap/mark-compact.h" | 10 #include "src/heap/mark-compact.h" |
| (...skipping 2953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2964 | 2964 |
| 2965 void LargeObjectSpace::FreeUnmarkedObjects() { | 2965 void LargeObjectSpace::FreeUnmarkedObjects() { |
| 2966 LargePage* previous = NULL; | 2966 LargePage* previous = NULL; |
| 2967 LargePage* current = first_page_; | 2967 LargePage* current = first_page_; |
| 2968 while (current != NULL) { | 2968 while (current != NULL) { |
| 2969 HeapObject* object = current->GetObject(); | 2969 HeapObject* object = current->GetObject(); |
| 2970 // Can this large page contain pointers to non-trivial objects. No other | 2970 // Can this large page contain pointers to non-trivial objects. No other |
| 2971 // pointer object is this big. | 2971 // pointer object is this big. |
| 2972 bool is_pointer_object = object->IsFixedArray(); | 2972 bool is_pointer_object = object->IsFixedArray(); |
| 2973 MarkBit mark_bit = Marking::MarkBitFrom(object); | 2973 MarkBit mark_bit = Marking::MarkBitFrom(object); |
| 2974 if (mark_bit.Get()) { | 2974 if (Marking::IsBlackOrGrey(mark_bit)) { |
| 2975 mark_bit.Clear(); | 2975 Marking::BlackToWhite(mark_bit); |
| 2976 Page::FromAddress(object->address())->ResetProgressBar(); | 2976 Page::FromAddress(object->address())->ResetProgressBar(); |
| 2977 Page::FromAddress(object->address())->ResetLiveBytes(); | 2977 Page::FromAddress(object->address())->ResetLiveBytes(); |
| 2978 previous = current; | 2978 previous = current; |
| 2979 current = current->next_page(); | 2979 current = current->next_page(); |
| 2980 } else { | 2980 } else { |
| 2981 LargePage* page = current; | 2981 LargePage* page = current; |
| 2982 // Cut the chunk out from the chunk list. | 2982 // Cut the chunk out from the chunk list. |
| 2983 current = current->next_page(); | 2983 current = current->next_page(); |
| 2984 if (previous == NULL) { | 2984 if (previous == NULL) { |
| 2985 first_page_ = current; | 2985 first_page_ = current; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3120 | 3120 |
| 3121 void Page::Print() { | 3121 void Page::Print() { |
| 3122 // Make a best-effort to print the objects in the page. | 3122 // Make a best-effort to print the objects in the page. |
| 3123 PrintF("Page@%p in %s\n", this->address(), | 3123 PrintF("Page@%p in %s\n", this->address(), |
| 3124 AllocationSpaceName(this->owner()->identity())); | 3124 AllocationSpaceName(this->owner()->identity())); |
| 3125 printf(" --------------------------------------\n"); | 3125 printf(" --------------------------------------\n"); |
| 3126 HeapObjectIterator objects(this, heap()->GcSafeSizeOfOldObjectFunction()); | 3126 HeapObjectIterator objects(this, heap()->GcSafeSizeOfOldObjectFunction()); |
| 3127 unsigned mark_size = 0; | 3127 unsigned mark_size = 0; |
| 3128 for (HeapObject* object = objects.Next(); object != NULL; | 3128 for (HeapObject* object = objects.Next(); object != NULL; |
| 3129 object = objects.Next()) { | 3129 object = objects.Next()) { |
| 3130 bool is_marked = Marking::MarkBitFrom(object).Get(); | 3130 bool is_marked = Marking::IsBlackOrGrey(Marking::MarkBitFrom(object)); |
| 3131 PrintF(" %c ", (is_marked ? '!' : ' ')); // Indent a little. | 3131 PrintF(" %c ", (is_marked ? '!' : ' ')); // Indent a little. |
| 3132 if (is_marked) { | 3132 if (is_marked) { |
| 3133 mark_size += heap()->GcSafeSizeOfOldObjectFunction()(object); | 3133 mark_size += heap()->GcSafeSizeOfOldObjectFunction()(object); |
| 3134 } | 3134 } |
| 3135 object->ShortPrint(); | 3135 object->ShortPrint(); |
| 3136 PrintF("\n"); | 3136 PrintF("\n"); |
| 3137 } | 3137 } |
| 3138 printf(" --------------------------------------\n"); | 3138 printf(" --------------------------------------\n"); |
| 3139 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3139 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3140 } | 3140 } |
| 3141 | 3141 |
| 3142 #endif // DEBUG | 3142 #endif // DEBUG |
| 3143 } | 3143 } |
| 3144 } // namespace v8::internal | 3144 } // namespace v8::internal |
| OLD | NEW |