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

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

Issue 7389008: Make Win64 compile. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Addressed review comments Created 9 years, 4 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
« no previous file with comments | « src/isolate.h ('k') | src/mark-compact.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 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
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
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 29 matching lines...) Expand all
294 ASSERT(0 <= idx_ && idx_ < kNumberOfElements); 294 ASSERT(0 <= idx_ && idx_ < kNumberOfElements);
295 slots_[idx_++] = slot; 295 slots_[idx_++] = slot;
296 } 296 }
297 297
298 void UpdateSlots(); 298 void UpdateSlots();
299 299
300 SlotsBuffer* next() { return next_; } 300 SlotsBuffer* next() { return next_; }
301 301
302 static int SizeOfChain(SlotsBuffer* buffer) { 302 static int SizeOfChain(SlotsBuffer* buffer) {
303 if (buffer == NULL) return 0; 303 if (buffer == NULL) return 0;
304 return buffer->idx_ + (buffer->chain_length_ - 1) * kNumberOfElements; 304 return static_cast<int>(buffer->idx_ +
305 (buffer->chain_length_ - 1) * kNumberOfElements);
305 } 306 }
306 307
307 inline bool IsFull() { 308 inline bool IsFull() {
308 return idx_ == kNumberOfElements; 309 return idx_ == kNumberOfElements;
309 } 310 }
310 311
311 static void UpdateSlotsRecordedIn(SlotsBuffer* buffer) { 312 static void UpdateSlotsRecordedIn(SlotsBuffer* buffer) {
312 while (buffer != NULL) { 313 while (buffer != NULL) {
313 buffer->UpdateSlots(); 314 buffer->UpdateSlots();
314 buffer = buffer->next(); 315 buffer = buffer->next();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 void EnableCodeFlushing(bool enable); 435 void EnableCodeFlushing(bool enable);
435 436
436 enum SweeperType { 437 enum SweeperType {
437 CONSERVATIVE, 438 CONSERVATIVE,
438 LAZY_CONSERVATIVE, 439 LAZY_CONSERVATIVE,
439 PRECISE 440 PRECISE
440 }; 441 };
441 442
442 // Sweep a single page from the given space conservatively. 443 // Sweep a single page from the given space conservatively.
443 // Return a number of reclaimed bytes. 444 // Return a number of reclaimed bytes.
444 static int SweepConservatively(PagedSpace* space, Page* p); 445 static intptr_t SweepConservatively(PagedSpace* space, Page* p);
445 446
446 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object** anchor)) { 447 INLINE(static bool ShouldSkipEvacuationSlotRecording(Object** anchor)) {
447 return Page::FromAddress(reinterpret_cast<Address>(anchor))-> 448 return Page::FromAddress(reinterpret_cast<Address>(anchor))->
448 ShouldSkipEvacuationSlotRecording(); 449 ShouldSkipEvacuationSlotRecording();
449 } 450 }
450 451
451 INLINE(static bool IsOnEvacuationCandidate(Object* obj)) { 452 INLINE(static bool IsOnEvacuationCandidate(Object* obj)) {
452 return Page::FromAddress(reinterpret_cast<Address>(obj))-> 453 return Page::FromAddress(reinterpret_cast<Address>(obj))->
453 IsEvacuationCandidate(); 454 IsEvacuationCandidate();
454 } 455 }
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 708
708 List<Page*> evacuation_candidates_; 709 List<Page*> evacuation_candidates_;
709 710
710 friend class Heap; 711 friend class Heap;
711 }; 712 };
712 713
713 714
714 } } // namespace v8::internal 715 } } // namespace v8::internal
715 716
716 #endif // V8_MARK_COMPACT_H_ 717 #endif // V8_MARK_COMPACT_H_
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698