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

Side by Side Diff: src/heap/heap.cc

Issue 1040443002: MarkBit cleanup: They have to be accessed through Marking accessors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | src/heap/incremental-marking.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5753 matching lines...) Expand 10 before | Expand all | Expand 10 after
5764 explicit UnreachableObjectsFilter(Heap* heap) : heap_(heap) { 5764 explicit UnreachableObjectsFilter(Heap* heap) : heap_(heap) {
5765 MarkReachableObjects(); 5765 MarkReachableObjects();
5766 } 5766 }
5767 5767
5768 ~UnreachableObjectsFilter() { 5768 ~UnreachableObjectsFilter() {
5769 heap_->mark_compact_collector()->ClearMarkbits(); 5769 heap_->mark_compact_collector()->ClearMarkbits();
5770 } 5770 }
5771 5771
5772 bool SkipObject(HeapObject* object) { 5772 bool SkipObject(HeapObject* object) {
5773 MarkBit mark_bit = Marking::MarkBitFrom(object); 5773 MarkBit mark_bit = Marking::MarkBitFrom(object);
5774 return !mark_bit.Get(); 5774 return Marking::IsWhite(mark_bit);
5775 } 5775 }
5776 5776
5777 private: 5777 private:
5778 class MarkingVisitor : public ObjectVisitor { 5778 class MarkingVisitor : public ObjectVisitor {
5779 public: 5779 public:
5780 MarkingVisitor() : marking_stack_(10) {} 5780 MarkingVisitor() : marking_stack_(10) {}
5781 5781
5782 void VisitPointers(Object** start, Object** end) { 5782 void VisitPointers(Object** start, Object** end) {
5783 for (Object** p = start; p < end; p++) { 5783 for (Object** p = start; p < end; p++) {
5784 if (!(*p)->IsHeapObject()) continue; 5784 if (!(*p)->IsHeapObject()) continue;
5785 HeapObject* obj = HeapObject::cast(*p); 5785 HeapObject* obj = HeapObject::cast(*p);
5786 MarkBit mark_bit = Marking::MarkBitFrom(obj); 5786 MarkBit mark_bit = Marking::MarkBitFrom(obj);
5787 if (!mark_bit.Get()) { 5787 if (Marking::IsWhite(mark_bit)) {
5788 mark_bit.Set(); 5788 Marking::WhiteToBlack(mark_bit);
5789 marking_stack_.Add(obj); 5789 marking_stack_.Add(obj);
5790 } 5790 }
5791 } 5791 }
5792 } 5792 }
5793 5793
5794 void TransitiveClosure() { 5794 void TransitiveClosure() {
5795 while (!marking_stack_.is_empty()) { 5795 while (!marking_stack_.is_empty()) {
5796 HeapObject* obj = marking_stack_.RemoveLast(); 5796 HeapObject* obj = marking_stack_.RemoveLast();
5797 obj->Iterate(this); 5797 obj->Iterate(this);
5798 } 5798 }
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
6365 static_cast<int>(object_sizes_last_time_[index])); 6365 static_cast<int>(object_sizes_last_time_[index]));
6366 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6366 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6367 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6367 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6368 6368
6369 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6369 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6370 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6370 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6371 ClearObjectStats(); 6371 ClearObjectStats();
6372 } 6372 }
6373 } 6373 }
6374 } // namespace v8::internal 6374 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/heap/incremental-marking.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698