From 566d088ee3a56b4e9cd62c76db9dd3f97a0b207f Mon Sep 17 00:00:00 2001 From: "kmillikin@chromium.org" Date: Fri, 15 May 2009 14:46:59 +0000 Subject: [PATCH] Fix debug build with a cast. TBR=bak@chromium.org git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1974 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/heap.cc | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/heap.cc b/src/heap.cc index 6d60015..a163527 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -537,6 +537,37 @@ class ScavengeVisitor: public ObjectVisitor { }; +// A queue of pointers and maps of to-be-promoted objects during a +// scavenge collection. +class PromotionQueue { + public: + void Initialize(Address start_address) { + front_ = rear_ = reinterpret_cast(start_address); + } + + bool is_empty() { return front_ <= rear_; } + + void insert(HeapObject* object, Map* map) { + *(--rear_) = object; + *(--rear_) = map; + // Assert no overflow into live objects. + ASSERT(reinterpret_cast
(rear_) >= Heap::new_space()->top()); + } + + void remove(HeapObject** object, Map** map) { + *object = *(--front_); + *map = Map::cast(*(--front_)); + // Assert no underflow. + ASSERT(front_ >= rear_); + } + + private: + // The front of the queue is higher in memory than the rear. + HeapObject** front_; + HeapObject** rear_; +}; + + // Shared state read by the scavenge collector and set by ScavengeObject. static Address promoted_rear = NULL; -- 2.7.4