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

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

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