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

Unified Diff: src/heap/heap.h

Issue 1783313003: [heap] Use struct Entry to fill inlined promotion queue entries. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | src/heap/heap.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index 05ed81e791e4b20c46d851104d27e03e69dabf0c..ea053c26a847be4eed43144a23f6eebca90496b1 100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -356,9 +356,9 @@ class PromotionQueue {
(emergency_stack_ == NULL || emergency_stack_->length() == 0);
}
- inline void insert(HeapObject* target, int size);
+ inline void insert(HeapObject* target, intptr_t size);
- void remove(HeapObject** target, int* size) {
+ void remove(HeapObject** target, intptr_t* size) {
DCHECK(!is_empty());
if (front_ == rear_) {
Entry e = emergency_stack_->RemoveLast();
@@ -367,8 +367,11 @@ class PromotionQueue {
return;
}
- *target = reinterpret_cast<HeapObject*>(*(--front_));
- *size = static_cast<int>(*(--front_));
+ front_ -= kEntrySizeInWords;
+ struct Entry* entry = reinterpret_cast<struct Entry*>(front_);
+ *target = entry->obj_;
+ *size = entry->size_;
+
// Assert no underflow.
SemiSpace::AssertValidRange(reinterpret_cast<Address>(rear_),
reinterpret_cast<Address>(front_));
@@ -383,10 +386,10 @@ class PromotionQueue {
static const int kEntrySizeInWords = 2;
struct Entry {
- Entry(HeapObject* obj, int size) : obj_(obj), size_(size) {}
+ Entry(HeapObject* obj, intptr_t size) : obj_(obj), size_(size) {}
HeapObject* obj_;
- int size_;
+ intptr_t size_;
};
List<Entry>* emergency_stack_;
@@ -394,6 +397,8 @@ class PromotionQueue {
void RelocateQueueHead();
+ STATIC_ASSERT(sizeof(struct Entry) == kEntrySizeInWords * kPointerSize);
+
DISALLOW_COPY_AND_ASSIGN(PromotionQueue);
};
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | src/heap/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698