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

Side by Side Diff: src/heap/heap-inl.h

Issue 2862563002: [heap] Pause black allocation during GCs (Closed)
Patch Set: Created 3 years, 7 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/heap.cc ('k') | src/heap/incremental-marking.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_HEAP_INL_H_ 5 #ifndef V8_HEAP_HEAP_INL_H_
6 #define V8_HEAP_HEAP_INL_H_ 6 #define V8_HEAP_HEAP_INL_H_
7 7
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 20 matching lines...) Expand all
31 AllocationSpace AllocationResult::RetrySpace() { 31 AllocationSpace AllocationResult::RetrySpace() {
32 DCHECK(IsRetry()); 32 DCHECK(IsRetry());
33 return static_cast<AllocationSpace>(Smi::cast(object_)->value()); 33 return static_cast<AllocationSpace>(Smi::cast(object_)->value());
34 } 34 }
35 35
36 HeapObject* AllocationResult::ToObjectChecked() { 36 HeapObject* AllocationResult::ToObjectChecked() {
37 CHECK(!IsRetry()); 37 CHECK(!IsRetry());
38 return HeapObject::cast(object_); 38 return HeapObject::cast(object_);
39 } 39 }
40 40
41 void PromotionQueue::insert(HeapObject* target, int32_t size, 41 void PromotionQueue::insert(HeapObject* target, int32_t size) {
42 bool was_marked_black) {
43 if (emergency_stack_ != NULL) { 42 if (emergency_stack_ != NULL) {
44 emergency_stack_->Add(Entry(target, size, was_marked_black)); 43 emergency_stack_->Add(Entry(target, size));
45 return; 44 return;
46 } 45 }
47 46
48 if ((rear_ - 1) < limit_) { 47 if ((rear_ - 1) < limit_) {
49 RelocateQueueHead(); 48 RelocateQueueHead();
50 emergency_stack_->Add(Entry(target, size, was_marked_black)); 49 emergency_stack_->Add(Entry(target, size));
51 return; 50 return;
52 } 51 }
53 52
54 struct Entry* entry = reinterpret_cast<struct Entry*>(--rear_); 53 struct Entry* entry = reinterpret_cast<struct Entry*>(--rear_);
55 entry->obj_ = target; 54 entry->obj_ = target;
56 entry->size_ = size; 55 entry->size_ = size;
57 entry->was_marked_black_ = was_marked_black;
58 56
59 // Assert no overflow into live objects. 57 // Assert no overflow into live objects.
60 #ifdef DEBUG 58 #ifdef DEBUG
61 SemiSpace::AssertValidRange(target->GetIsolate()->heap()->new_space()->top(), 59 SemiSpace::AssertValidRange(target->GetIsolate()->heap()->new_space()->top(),
62 reinterpret_cast<Address>(rear_)); 60 reinterpret_cast<Address>(rear_));
63 #endif 61 #endif
64 } 62 }
65 63
66 void PromotionQueue::remove(HeapObject** target, int32_t* size, 64 void PromotionQueue::remove(HeapObject** target, int32_t* size) {
67 bool* was_marked_black) {
68 DCHECK(!is_empty()); 65 DCHECK(!is_empty());
69 if (front_ == rear_) { 66 if (front_ == rear_) {
70 Entry e = emergency_stack_->RemoveLast(); 67 Entry e = emergency_stack_->RemoveLast();
71 *target = e.obj_; 68 *target = e.obj_;
72 *size = e.size_; 69 *size = e.size_;
73 *was_marked_black = e.was_marked_black_;
74 return; 70 return;
75 } 71 }
76 72
77 struct Entry* entry = reinterpret_cast<struct Entry*>(--front_); 73 struct Entry* entry = reinterpret_cast<struct Entry*>(--front_);
78 *target = entry->obj_; 74 *target = entry->obj_;
79 *size = entry->size_; 75 *size = entry->size_;
80 *was_marked_black = entry->was_marked_black_;
81 76
82 // Assert no underflow. 77 // Assert no underflow.
83 SemiSpace::AssertValidRange(reinterpret_cast<Address>(rear_), 78 SemiSpace::AssertValidRange(reinterpret_cast<Address>(rear_),
84 reinterpret_cast<Address>(front_)); 79 reinterpret_cast<Address>(front_));
85 } 80 }
86 81
87 Page* PromotionQueue::GetHeadPage() { 82 Page* PromotionQueue::GetHeadPage() {
88 return Page::FromAllocationAreaAddress(reinterpret_cast<Address>(rear_)); 83 return Page::FromAllocationAreaAddress(reinterpret_cast<Address>(rear_));
89 } 84 }
90 85
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 void VerifySmisVisitor::VisitRootPointers(Root root, Object** start, 877 void VerifySmisVisitor::VisitRootPointers(Root root, Object** start,
883 Object** end) { 878 Object** end) {
884 for (Object** current = start; current < end; current++) { 879 for (Object** current = start; current < end; current++) {
885 CHECK((*current)->IsSmi()); 880 CHECK((*current)->IsSmi());
886 } 881 }
887 } 882 }
888 } // namespace internal 883 } // namespace internal
889 } // namespace v8 884 } // namespace v8
890 885
891 #endif // V8_HEAP_HEAP_INL_H_ 886 #endif // V8_HEAP_HEAP_INL_H_
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/incremental-marking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698