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

Side by Side Diff: src/heap/spaces.h

Issue 2183383004: Revert of [heap] Reland "Remove black pages and use black areas instead." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
« no previous file with comments | « src/heap/scavenger.cc ('k') | src/heap/spaces.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 // 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 #ifndef V8_HEAP_SPACES_H_ 5 #ifndef V8_HEAP_SPACES_H_
6 #define V8_HEAP_SPACES_H_ 6 #define V8_HEAP_SPACES_H_
7 7
8 #include <list> 8 #include <list>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 HAS_PROGRESS_BAR, 243 HAS_PROGRESS_BAR,
244 244
245 // |PAGE_NEW_OLD_PROMOTION|: A page tagged with this flag has been promoted 245 // |PAGE_NEW_OLD_PROMOTION|: A page tagged with this flag has been promoted
246 // from new to old space during evacuation. 246 // from new to old space during evacuation.
247 PAGE_NEW_OLD_PROMOTION, 247 PAGE_NEW_OLD_PROMOTION,
248 248
249 // |PAGE_NEW_NEW_PROMOTION|: A page tagged with this flag has been moved 249 // |PAGE_NEW_NEW_PROMOTION|: A page tagged with this flag has been moved
250 // within the new space during evacuation. 250 // within the new space during evacuation.
251 PAGE_NEW_NEW_PROMOTION, 251 PAGE_NEW_NEW_PROMOTION,
252 252
253 // A black page has all mark bits set to 1 (black). A black page currently
254 // cannot be iterated because it is not swept. Moreover live bytes are also
255 // not updated.
256 BLACK_PAGE,
257
253 // This flag is intended to be used for testing. Works only when both 258 // This flag is intended to be used for testing. Works only when both
254 // FLAG_stress_compaction and FLAG_manual_evacuation_candidates_selection 259 // FLAG_stress_compaction and FLAG_manual_evacuation_candidates_selection
255 // are set. It forces the page to become an evacuation candidate at next 260 // are set. It forces the page to become an evacuation candidate at next
256 // candidates selection cycle. 261 // candidates selection cycle.
257 FORCE_EVACUATION_CANDIDATE_FOR_TESTING, 262 FORCE_EVACUATION_CANDIDATE_FOR_TESTING,
258 263
259 // This flag is intended to be used for testing. 264 // This flag is intended to be used for testing.
260 NEVER_ALLOCATE_ON_PAGE, 265 NEVER_ALLOCATE_ON_PAGE,
261 266
262 // The memory chunk is already logically freed, however the actual freeing 267 // The memory chunk is already logically freed, however the actual freeing
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 base::AtomicValue<ConcurrentSweepingState>& concurrent_sweeping_state() { 422 base::AtomicValue<ConcurrentSweepingState>& concurrent_sweeping_state() {
418 return concurrent_sweeping_; 423 return concurrent_sweeping_;
419 } 424 }
420 425
421 // Manage live byte count, i.e., count of bytes in black objects. 426 // Manage live byte count, i.e., count of bytes in black objects.
422 inline void ResetLiveBytes(); 427 inline void ResetLiveBytes();
423 inline void IncrementLiveBytes(int by); 428 inline void IncrementLiveBytes(int by);
424 429
425 int LiveBytes() { 430 int LiveBytes() {
426 DCHECK_LE(static_cast<unsigned>(live_byte_count_), size_); 431 DCHECK_LE(static_cast<unsigned>(live_byte_count_), size_);
432 DCHECK(!IsFlagSet(BLACK_PAGE) || live_byte_count_ == 0);
427 return live_byte_count_; 433 return live_byte_count_;
428 } 434 }
429 435
430 void SetLiveBytes(int live_bytes) { 436 void SetLiveBytes(int live_bytes) {
437 if (IsFlagSet(BLACK_PAGE)) return;
431 DCHECK_GE(live_bytes, 0); 438 DCHECK_GE(live_bytes, 0);
432 DCHECK_LE(static_cast<size_t>(live_bytes), size_); 439 DCHECK_LE(static_cast<size_t>(live_bytes), size_);
433 live_byte_count_ = live_bytes; 440 live_byte_count_ = live_bytes;
434 } 441 }
435 442
436 int write_barrier_counter() { 443 int write_barrier_counter() {
437 return static_cast<int>(write_barrier_counter_); 444 return static_cast<int>(write_barrier_counter_);
438 } 445 }
439 446
440 void set_write_barrier_counter(int counter) { 447 void set_write_barrier_counter(int counter) {
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
2061 void ResetFreeList() { free_list_.Reset(); } 2068 void ResetFreeList() { free_list_.Reset(); }
2062 2069
2063 // Set space allocation info. 2070 // Set space allocation info.
2064 void SetTopAndLimit(Address top, Address limit) { 2071 void SetTopAndLimit(Address top, Address limit) {
2065 DCHECK(top == limit || 2072 DCHECK(top == limit ||
2066 Page::FromAddress(top) == Page::FromAddress(limit - 1)); 2073 Page::FromAddress(top) == Page::FromAddress(limit - 1));
2067 MemoryChunk::UpdateHighWaterMark(allocation_info_.top()); 2074 MemoryChunk::UpdateHighWaterMark(allocation_info_.top());
2068 allocation_info_.Reset(top, limit); 2075 allocation_info_.Reset(top, limit);
2069 } 2076 }
2070 2077
2071 void SetAllocationInfo(Address top, Address limit);
2072
2073 // Empty space allocation info, returning unused area to free list. 2078 // Empty space allocation info, returning unused area to free list.
2074 void EmptyAllocationInfo(); 2079 void EmptyAllocationInfo() {
2075 2080 // Mark the old linear allocation area with a free space map so it can be
2076 void MarkAllocationInfoBlack(); 2081 // skipped when scanning the heap.
2082 int old_linear_size = static_cast<int>(limit() - top());
2083 Free(top(), old_linear_size);
2084 SetTopAndLimit(NULL, NULL);
2085 }
2077 2086
2078 void Allocate(int bytes) { accounting_stats_.AllocateBytes(bytes); } 2087 void Allocate(int bytes) { accounting_stats_.AllocateBytes(bytes); }
2079 2088
2080 void IncreaseCapacity(int size); 2089 void IncreaseCapacity(int size);
2081 2090
2082 // Releases an unused page and shrinks the space. 2091 // Releases an unused page and shrinks the space.
2083 void ReleasePage(Page* page); 2092 void ReleasePage(Page* page);
2084 2093
2085 // The dummy page that anchors the linked list of pages. 2094 // The dummy page that anchors the linked list of pages.
2086 Page* anchor() { return &anchor_; } 2095 Page* anchor() { return &anchor_; }
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
2985 count = 0; 2994 count = 0;
2986 } 2995 }
2987 // Must be small, since an iteration is used for lookup. 2996 // Must be small, since an iteration is used for lookup.
2988 static const int kMaxComments = 64; 2997 static const int kMaxComments = 64;
2989 }; 2998 };
2990 #endif 2999 #endif
2991 } // namespace internal 3000 } // namespace internal
2992 } // namespace v8 3001 } // namespace v8
2993 3002
2994 #endif // V8_HEAP_SPACES_H_ 3003 #endif // V8_HEAP_SPACES_H_
OLDNEW
« no previous file with comments | « src/heap/scavenger.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698