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

Side by Side Diff: src/mark-compact.h

Issue 7247002: Estimate a (close) upper bound on the size of black-marked objects on each page. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 9 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 ASSERT(IsGrey(markbit)); 112 ASSERT(IsGrey(markbit));
113 markbit.Next().Clear(); 113 markbit.Next().Clear();
114 ASSERT(IsBlack(markbit)); 114 ASSERT(IsBlack(markbit));
115 } 115 }
116 116
117 static inline void BlackToGrey(HeapObject* obj) { 117 static inline void BlackToGrey(HeapObject* obj) {
118 ASSERT(obj->Size() >= 2 * kPointerSize); 118 ASSERT(obj->Size() >= 2 * kPointerSize);
119 BlackToGrey(MarkBitFrom(obj)); 119 BlackToGrey(MarkBitFrom(obj));
120 } 120 }
121 121
122 void TransferMark(Address old_start, Address new_start); 122 // Returns true if the new_start is marked black.
Erik Corry 2011/06/24 09:46:17 Returns true if the object whose mark is transferr
Lasse Reichstein 2011/06/24 11:09:08 Done.
123 bool TransferMark(Address old_start, Address new_start);
123 124
124 #ifdef DEBUG 125 #ifdef DEBUG
125 enum ObjectColor { 126 enum ObjectColor {
126 BLACK_OBJECT, 127 BLACK_OBJECT,
127 WHITE_OBJECT, 128 WHITE_OBJECT,
128 GREY_OBJECT, 129 GREY_OBJECT,
129 IMPOSSIBLE_COLOR 130 IMPOSSIBLE_COLOR
130 }; 131 };
131 132
132 static const char* ColorName(ObjectColor color) { 133 static const char* ColorName(ObjectColor color) {
(...skipping 11 matching lines...) Expand all
144 } 145 }
145 146
146 static ObjectColor Color(MarkBit mark_bit) { 147 static ObjectColor Color(MarkBit mark_bit) {
147 if (IsBlack(mark_bit)) return BLACK_OBJECT; 148 if (IsBlack(mark_bit)) return BLACK_OBJECT;
148 if (IsWhite(mark_bit)) return WHITE_OBJECT; 149 if (IsWhite(mark_bit)) return WHITE_OBJECT;
149 if (IsGrey(mark_bit)) return GREY_OBJECT; 150 if (IsGrey(mark_bit)) return GREY_OBJECT;
150 UNREACHABLE(); 151 UNREACHABLE();
151 return IMPOSSIBLE_COLOR; 152 return IMPOSSIBLE_COLOR;
152 } 153 }
153 #endif 154 #endif
154 155
Erik Corry 2011/06/24 09:46:17 // Returns true if the object whose color was tran
Lasse Reichstein 2011/06/24 11:09:08 Fixed.
155 INLINE(static void TransferColor(HeapObject* from, 156 INLINE(static bool TransferColor(HeapObject* from,
156 HeapObject* to)) { 157 HeapObject* to)) {
157 MarkBit from_mark_bit = MarkBitFrom(from); 158 MarkBit from_mark_bit = MarkBitFrom(from);
158 MarkBit to_mark_bit = MarkBitFrom(to); 159 MarkBit to_mark_bit = MarkBitFrom(to);
159 if (from_mark_bit.Get()) to_mark_bit.Set(); 160 bool is_black = false;
160 if (from_mark_bit.Next().Get()) to_mark_bit.Next().Set(); 161 if (from_mark_bit.Get()) {
162 to_mark_bit.Set();
163 is_black = true; // Looks black so far.
164 }
165 if (from_mark_bit.Next().Get()) {
166 to_mark_bit.Next().Set();
167 is_black = false; // Was actually gray.
168 }
161 ASSERT(Color(from) == Color(to)); 169 ASSERT(Color(from) == Color(to));
170 ASSERT(is_black == (Color(to) == BLACK_OBJECT));
171 return is_black;
162 } 172 }
163 173
164 private: 174 private:
165 Heap* heap_; 175 Heap* heap_;
166 }; 176 };
167 177
168 // ---------------------------------------------------------------------------- 178 // ----------------------------------------------------------------------------
169 // Marking deque for tracing live objects. 179 // Marking deque for tracing live objects.
170 180
171 class MarkingDeque { 181 class MarkingDeque {
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 603
594 List<Page*> evacuation_candidates_; 604 List<Page*> evacuation_candidates_;
595 605
596 friend class Heap; 606 friend class Heap;
597 }; 607 };
598 608
599 609
600 } } // namespace v8::internal 610 } } // namespace v8::internal
601 611
602 #endif // V8_MARK_COMPACT_H_ 612 #endif // V8_MARK_COMPACT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698