| OLD | NEW |
| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 class MarkingDeque { | 182 class MarkingDeque { |
| 183 public: | 183 public: |
| 184 MarkingDeque() | 184 MarkingDeque() |
| 185 : array_(NULL), top_(0), bottom_(0), mask_(0), overflowed_(false) { } | 185 : array_(NULL), top_(0), bottom_(0), mask_(0), overflowed_(false) { } |
| 186 | 186 |
| 187 void Initialize(Address low, Address high) { | 187 void Initialize(Address low, Address high) { |
| 188 HeapObject** obj_low = reinterpret_cast<HeapObject**>(low); | 188 HeapObject** obj_low = reinterpret_cast<HeapObject**>(low); |
| 189 HeapObject** obj_high = reinterpret_cast<HeapObject**>(high); | 189 HeapObject** obj_high = reinterpret_cast<HeapObject**>(high); |
| 190 array_ = obj_low; | 190 array_ = obj_low; |
| 191 mask_ = RoundDownToPowerOf2(obj_high - obj_low) - 1; | 191 mask_ = RoundDownToPowerOf2(static_cast<int>(obj_high - obj_low)) - 1; |
| 192 top_ = bottom_ = 0; | 192 top_ = bottom_ = 0; |
| 193 overflowed_ = false; | 193 overflowed_ = false; |
| 194 } | 194 } |
| 195 | 195 |
| 196 inline bool IsFull() { return ((top_ + 1) & mask_) == bottom_; } | 196 inline bool IsFull() { return ((top_ + 1) & mask_) == bottom_; } |
| 197 | 197 |
| 198 inline bool IsEmpty() { return top_ == bottom_; } | 198 inline bool IsEmpty() { return top_ == bottom_; } |
| 199 | 199 |
| 200 bool overflowed() const { return overflowed_; } | 200 bool overflowed() const { return overflowed_; } |
| 201 | 201 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 if (IsFull()) { | 241 if (IsFull()) { |
| 242 ASSERT(Marking::IsGrey(Marking::MarkBitFrom(object))); | 242 ASSERT(Marking::IsGrey(Marking::MarkBitFrom(object))); |
| 243 SetOverflowed(); | 243 SetOverflowed(); |
| 244 } else { | 244 } else { |
| 245 bottom_ = ((bottom_ - 1) & mask_); | 245 bottom_ = ((bottom_ - 1) & mask_); |
| 246 array_[bottom_] = object; | 246 array_[bottom_] = object; |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 HeapObject** array() { return array_; } | 250 HeapObject** array() { return array_; } |
| 251 intptr_t bottom() { return bottom_; } | 251 int bottom() { return bottom_; } |
| 252 intptr_t top() { return top_; } | 252 int top() { return top_; } |
| 253 intptr_t mask() { return mask_; } | 253 int mask() { return mask_; } |
| 254 void set_top(intptr_t top) { top_ = top; } | 254 void set_top(int top) { top_ = top; } |
| 255 | 255 |
| 256 private: | 256 private: |
| 257 HeapObject** array_; | 257 HeapObject** array_; |
| 258 // array_[(top - 1) & mask_] is the top element in the deque. The Deque is | 258 // array_[(top - 1) & mask_] is the top element in the deque. The Deque is |
| 259 // empty when top_ == bottom_. It is full when top_ + 1 == bottom | 259 // empty when top_ == bottom_. It is full when top_ + 1 == bottom |
| 260 // (mod mask + 1). | 260 // (mod mask + 1). |
| 261 int top_; | 261 int top_; |
| 262 int bottom_; | 262 int bottom_; |
| 263 int mask_; | 263 int mask_; |
| 264 bool overflowed_; | 264 bool overflowed_; |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 | 707 |
| 708 List<Page*> evacuation_candidates_; | 708 List<Page*> evacuation_candidates_; |
| 709 | 709 |
| 710 friend class Heap; | 710 friend class Heap; |
| 711 }; | 711 }; |
| 712 | 712 |
| 713 | 713 |
| 714 } } // namespace v8::internal | 714 } } // namespace v8::internal |
| 715 | 715 |
| 716 #endif // V8_MARK_COMPACT_H_ | 716 #endif // V8_MARK_COMPACT_H_ |
| OLD | NEW |