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

Unified Diff: src/heap.h

Issue 3764011: Link all global contexts into a weak list. (Closed)
Patch Set: Created 10 years, 2 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
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index b1ef19f535b500a2e274e82eb2a7fcd34ad55086..3d9292eb4c1b59c8cb37862c7bdb6faf15f643d4 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -202,9 +202,10 @@ namespace internal {
V(closure_symbol, "(closure)")
-// Forward declaration of the GCTracer class.
+// Forward declarations.
class GCTracer;
class HeapStats;
+class WeakObjectRetainer;
typedef String* (*ExternalStringTableUpdaterCallback)(Object** pointer);
@@ -767,6 +768,11 @@ class Heap : public AllStatic {
// not match the empty string.
static String* hidden_symbol() { return hidden_symbol_; }
+ static void set_global_contexts_list(Object* object) {
+ global_contexts_list_ = object;
+ }
+ static Object* global_contexts_list() { return global_contexts_list_; }
+
// Iterates over all roots in the heap.
static void IterateRoots(ObjectVisitor* v, VisitMode mode);
// Iterates over all strong roots in the heap.
@@ -870,6 +876,11 @@ class Heap : public AllStatic {
// Generated code can embed this address to get access to the roots.
static Object** roots_address() { return roots_; }
+ // Get address of global contexts list for serialization support.
+ static Object** global_contexts_list_address() {
+ return &global_contexts_list_;
+ }
+
#ifdef DEBUG
static void Print();
static void PrintHandles();
@@ -1051,6 +1062,8 @@ class Heap : public AllStatic {
static void UpdateNewSpaceReferencesInExternalStringTable(
ExternalStringTableUpdaterCallback updater_func);
+ static void ProcessWeakReferences(WeakObjectRetainer* retainer);
+
// Helper function that governs the promotion policy from new space to
// old. If the object's old address lies below the new space's age
// mark or if we've already filled the bottom 1/16th of the to space,
@@ -1157,6 +1170,8 @@ class Heap : public AllStatic {
static Object* roots_[kRootListLength];
+ static Object* global_contexts_list_;
+
struct StringTypeTable {
InstanceType type;
int size;
@@ -2043,6 +2058,19 @@ class ExternalStringTable : public AllStatic {
static List<Object*> old_space_strings_;
};
+
+// Abstract base class for checking whether a weak object should be retained.
+class WeakObjectRetainer {
+ public:
+ virtual ~WeakObjectRetainer() {}
+
+ // Return whether this object should be retained. If NULL is returned the
+ // object has no references. Otherwise the address of the retained object
+ // should be returned as in some GC situations the object has been moved.
+ virtual Object* RetainAs(Object* object) = 0;
+};
+
+
} } // namespace v8::internal
#endif // V8_HEAP_H_

Powered by Google App Engine
This is Rietveld 408576698