| Index: vm/scavenger.h
|
| ===================================================================
|
| --- vm/scavenger.h (revision 2792)
|
| +++ vm/scavenger.h (working copy)
|
| @@ -5,10 +5,13 @@
|
| #ifndef VM_SCAVENGER_H_
|
| #define VM_SCAVENGER_H_
|
|
|
| +#include "vm/assert.h"
|
| +#include "vm/flags.h"
|
| #include "vm/globals.h"
|
| -#include "vm/object.h"
|
| +#include "vm/raw_object.h"
|
| #include "vm/utils.h"
|
| #include "vm/virtual_memory.h"
|
| +#include "vm/visitor.h"
|
|
|
| namespace dart {
|
|
|
| @@ -16,6 +19,8 @@
|
| class Heap;
|
| class Isolate;
|
|
|
| +DECLARE_FLAG(bool, gc_at_alloc);
|
| +
|
| class Scavenger {
|
| public:
|
| Scavenger(Heap* heap, intptr_t max_capacity, uword object_alignment);
|
| @@ -74,6 +79,25 @@
|
| void ProcessToSpace(ObjectPointerVisitor* visitor);
|
| void Epilogue();
|
|
|
| + // During a scavenge we need to remember the promoted objects.
|
| + // This is implemented as a stack of objects at the end of the to space. As
|
| + // object sizes are always greater than sizeof(uword) and promoted objects do
|
| + // not consume space in the to space they leave enough room for this stack.
|
| + void PushToPromotedStack(uword addr) {
|
| + end_ -= sizeof(addr);
|
| + ASSERT(end_ > top_);
|
| + *reinterpret_cast<uword*>(end_) = addr;
|
| + }
|
| + uword PopFromPromotedStack() {
|
| + uword result = *reinterpret_cast<uword*>(end_);
|
| + end_ += sizeof(result);
|
| + ASSERT(end_ <= to_->end());
|
| + return result;
|
| + }
|
| + bool PromotedStackHasMore() const {
|
| + return end_ < to_->end();
|
| + }
|
| +
|
| VirtualMemory* space_;
|
| MemoryRegion* to_;
|
| MemoryRegion* from_;
|
| @@ -85,6 +109,9 @@
|
| uword top_;
|
| uword end_;
|
|
|
| + // Objects below this address have survived a scavenge.
|
| + uword survivor_end_;
|
| +
|
| // All object are aligned to this value.
|
| uword object_alignment_;
|
|
|
| @@ -92,6 +119,8 @@
|
| int count_;
|
| // Keep track whether a scavenge is currently running.
|
| bool scavenging_;
|
| + // Keep track whether the scavenge had a promotion failure.
|
| + bool had_promotion_failure_;
|
|
|
| friend class ScavengerVisitor;
|
| friend class ScavengerWeakVisitor;
|
|
|