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

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, 9 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') | src/heap/incremental-marking.cc » ('J')
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 5778 matching lines...) Expand 10 before | Expand all | Expand 10 after
5789 explicit UnreachableObjectsFilter(Heap* heap) : heap_(heap) { 5789 explicit UnreachableObjectsFilter(Heap* heap) : heap_(heap) {
5790 MarkReachableObjects(); 5790 MarkReachableObjects();
5791 } 5791 }
5792 5792
5793 ~UnreachableObjectsFilter() { 5793 ~UnreachableObjectsFilter() {
5794 heap_->mark_compact_collector()->ClearMarkbits(); 5794 heap_->mark_compact_collector()->ClearMarkbits();
5795 } 5795 }
5796 5796
5797 bool SkipObject(HeapObject* object) { 5797 bool SkipObject(HeapObject* object) {
5798 MarkBit mark_bit = Marking::MarkBitFrom(object); 5798 MarkBit mark_bit = Marking::MarkBitFrom(object);
5799 return !mark_bit.Get(); 5799 return Marking::IsWhite(mark_bit);
5800 } 5800 }
5801 5801
5802 private: 5802 private:
5803 class MarkingVisitor : public ObjectVisitor { 5803 class MarkingVisitor : public ObjectVisitor {
5804 public: 5804 public:
5805 MarkingVisitor() : marking_stack_(10) {} 5805 MarkingVisitor() : marking_stack_(10) {}
5806 5806
5807 void VisitPointers(Object** start, Object** end) { 5807 void VisitPointers(Object** start, Object** end) {
5808 for (Object** p = start; p < end; p++) { 5808 for (Object** p = start; p < end; p++) {
5809 if (!(*p)->IsHeapObject()) continue; 5809 if (!(*p)->IsHeapObject()) continue;
5810 HeapObject* obj = HeapObject::cast(*p); 5810 HeapObject* obj = HeapObject::cast(*p);
5811 MarkBit mark_bit = Marking::MarkBitFrom(obj); 5811 MarkBit mark_bit = Marking::MarkBitFrom(obj);
5812 if (!mark_bit.Get()) { 5812 if (Marking::IsWhite(mark_bit)) {
5813 mark_bit.Set(); 5813 Marking::WhiteToBlack(mark_bit);
5814 marking_stack_.Add(obj); 5814 marking_stack_.Add(obj);
5815 } 5815 }
5816 } 5816 }
5817 } 5817 }
5818 5818
5819 void TransitiveClosure() { 5819 void TransitiveClosure() {
5820 while (!marking_stack_.is_empty()) { 5820 while (!marking_stack_.is_empty()) {
5821 HeapObject* obj = marking_stack_.RemoveLast(); 5821 HeapObject* obj = marking_stack_.RemoveLast();
5822 obj->Iterate(this); 5822 obj->Iterate(this);
5823 } 5823 }
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
6390 static_cast<int>(object_sizes_last_time_[index])); 6390 static_cast<int>(object_sizes_last_time_[index]));
6391 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6391 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6392 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6392 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6393 6393
6394 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6394 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6395 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6395 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6396 ClearObjectStats(); 6396 ClearObjectStats();
6397 } 6397 }
6398 } 6398 }
6399 } // namespace v8::internal 6399 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/heap/incremental-marking.cc » ('j') | src/heap/incremental-marking.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698