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/heap/spaces-inl.h

Issue 2185613002: [heap] Reland "Remove black pages and use black areas instead." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: move check to left trimming 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/spaces.cc ('k') | src/ia32/assembler-ia32-inl.h » ('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_INL_H_ 5 #ifndef V8_HEAP_SPACES_INL_H_
6 #define V8_HEAP_SPACES_INL_H_ 6 #define V8_HEAP_SPACES_INL_H_
7 7
8 #include "src/heap/incremental-marking.h" 8 #include "src/heap/incremental-marking.h"
9 #include "src/heap/spaces.h" 9 #include "src/heap/spaces.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 16 matching lines...) Expand all
27 operator++(); 27 operator++();
28 return tmp; 28 return tmp;
29 } 29 }
30 30
31 NewSpacePageRange::NewSpacePageRange(Address start, Address limit) 31 NewSpacePageRange::NewSpacePageRange(Address start, Address limit)
32 : range_(Page::FromAddress(start), 32 : range_(Page::FromAddress(start),
33 Page::FromAllocationAreaAddress(limit)->next_page()) { 33 Page::FromAllocationAreaAddress(limit)->next_page()) {
34 SemiSpace::AssertValidRange(start, limit); 34 SemiSpace::AssertValidRange(start, limit);
35 } 35 }
36 36
37
38 // ----------------------------------------------------------------------------- 37 // -----------------------------------------------------------------------------
39 // SemiSpaceIterator 38 // SemiSpaceIterator
40 39
41 HeapObject* SemiSpaceIterator::Next() { 40 HeapObject* SemiSpaceIterator::Next() {
42 while (current_ != limit_) { 41 while (current_ != limit_) {
43 if (Page::IsAlignedToPageSize(current_)) { 42 if (Page::IsAlignedToPageSize(current_)) {
44 Page* page = Page::FromAllocationAreaAddress(current_); 43 Page* page = Page::FromAllocationAreaAddress(current_);
45 page = page->next_page(); 44 page = page->next_page();
46 DCHECK(!page->is_anchor()); 45 DCHECK(!page->is_anchor());
47 current_ = page->area_start(); 46 current_ = page->area_start();
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 234
236 void MemoryChunk::ResetLiveBytes() { 235 void MemoryChunk::ResetLiveBytes() {
237 if (FLAG_trace_live_bytes) { 236 if (FLAG_trace_live_bytes) {
238 PrintIsolate(heap()->isolate(), "live-bytes: reset page=%p %d->0\n", 237 PrintIsolate(heap()->isolate(), "live-bytes: reset page=%p %d->0\n",
239 static_cast<void*>(this), live_byte_count_); 238 static_cast<void*>(this), live_byte_count_);
240 } 239 }
241 live_byte_count_ = 0; 240 live_byte_count_ = 0;
242 } 241 }
243 242
244 void MemoryChunk::IncrementLiveBytes(int by) { 243 void MemoryChunk::IncrementLiveBytes(int by) {
245 if (IsFlagSet(BLACK_PAGE)) return;
246 if (FLAG_trace_live_bytes) { 244 if (FLAG_trace_live_bytes) {
247 PrintIsolate( 245 PrintIsolate(
248 heap()->isolate(), "live-bytes: update page=%p delta=%d %d->%d\n", 246 heap()->isolate(), "live-bytes: update page=%p delta=%d %d->%d\n",
249 static_cast<void*>(this), by, live_byte_count_, live_byte_count_ + by); 247 static_cast<void*>(this), by, live_byte_count_, live_byte_count_ + by);
250 } 248 }
251 live_byte_count_ += by; 249 live_byte_count_ += by;
252 DCHECK_GE(live_byte_count_, 0); 250 DCHECK_GE(live_byte_count_, 0);
253 DCHECK_LE(static_cast<size_t>(live_byte_count_), size_); 251 DCHECK_LE(static_cast<size_t>(live_byte_count_), size_);
254 } 252 }
255 253
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 // Raw allocation. 435 // Raw allocation.
438 AllocationResult PagedSpace::AllocateRawUnaligned( 436 AllocationResult PagedSpace::AllocateRawUnaligned(
439 int size_in_bytes, UpdateSkipList update_skip_list) { 437 int size_in_bytes, UpdateSkipList update_skip_list) {
440 HeapObject* object = AllocateLinearly(size_in_bytes); 438 HeapObject* object = AllocateLinearly(size_in_bytes);
441 439
442 if (object == NULL) { 440 if (object == NULL) {
443 object = free_list_.Allocate(size_in_bytes); 441 object = free_list_.Allocate(size_in_bytes);
444 if (object == NULL) { 442 if (object == NULL) {
445 object = SlowAllocateRaw(size_in_bytes); 443 object = SlowAllocateRaw(size_in_bytes);
446 } 444 }
445 if (object != NULL) {
446 if (heap()->incremental_marking()->black_allocation()) {
447 Marking::MarkBlack(ObjectMarking::MarkBitFrom(object));
448 MemoryChunk::IncrementLiveBytesFromGC(object, size_in_bytes);
449 }
450 }
447 } 451 }
448 452
449 if (object != NULL) { 453 if (object != NULL) {
450 if (update_skip_list == UPDATE_SKIP_LIST && identity() == CODE_SPACE) { 454 if (update_skip_list == UPDATE_SKIP_LIST && identity() == CODE_SPACE) {
451 SkipList::Update(object->address(), size_in_bytes); 455 SkipList::Update(object->address(), size_in_bytes);
452 } 456 }
453 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), size_in_bytes); 457 MSAN_ALLOCATED_UNINITIALIZED_MEMORY(object->address(), size_in_bytes);
454 return object; 458 return object;
455 } 459 }
456 460
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 other->allocation_info_.Reset(nullptr, nullptr); 635 other->allocation_info_.Reset(nullptr, nullptr);
632 return true; 636 return true;
633 } 637 }
634 return false; 638 return false;
635 } 639 }
636 640
637 } // namespace internal 641 } // namespace internal
638 } // namespace v8 642 } // namespace v8
639 643
640 #endif // V8_HEAP_SPACES_INL_H_ 644 #endif // V8_HEAP_SPACES_INL_H_
OLDNEW
« no previous file with comments | « src/heap/spaces.cc ('k') | src/ia32/assembler-ia32-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698