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

Unified Diff: vm/scavenger.h

Issue 9027017: - Promote objects from new gen to old space if they survived a scavenge. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years 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 | « vm/raw_object.cc ('k') | vm/scavenger.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « vm/raw_object.cc ('k') | vm/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698