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

Unified Diff: src/heap.h

Issue 7650010: Avoid some crashes when running without snapshots. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Address review comments Created 9 years, 4 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 | « src/debug.cc ('k') | src/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index 1ee2841b12b6066e43ac0bb4679e96a0180944c2..91cd19bff6e23e8e95fd9a2d6360feeaa5d0c22e 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -913,6 +913,9 @@ class Heap {
// state where we can iterate over the heap visiting all objects.
void CollectAllGarbage(int flags);
+ // Check whether the heap is currently iterable.
+ bool IsHeapIterable();
+
// Ensure that we have swept all spaces in such a way that we can iterate
// over all objects. May cause a GC.
void EnsureHeapIsIterable();
@@ -1929,8 +1932,7 @@ class SpaceIterator : public Malloced {
// A HeapIterator provides iteration over the whole heap. It
// aggregates the specific iterators for the different spaces as
-// these can only iterate over one space only. It can only be guaranteed
-// to iterate over live objects.
+// these can only iterate over one space only.
//
// HeapIterator can skip free list nodes (that is, de-allocated heap
// objects that still remain in the heap). As implementation of free
@@ -1941,18 +1943,28 @@ class HeapObjectsFilter;
class HeapIterator BASE_EMBEDDED {
public:
+ enum HeapObjectsFiltering {
+ kNoFiltering,
+ kFilterFreeListNodes,
+ kFilterUnreachable
+ };
+
HeapIterator();
+ explicit HeapIterator(HeapObjectsFiltering filtering);
~HeapIterator();
- HeapObject* Next();
- void Reset();
+ HeapObject* next();
+ void reset();
private:
// Perform the initialization.
void Init();
// Perform all necessary shutdown (destruction) work.
void Shutdown();
+ HeapObject* NextObject();
+ HeapObjectsFiltering filtering_;
+ HeapObjectsFilter* filter_;
// Space iterator for iterating all the spaces.
SpaceIterator* space_iterator_;
// Object iterator for the space currently being iterated.
@@ -2355,10 +2367,13 @@ class IntrusiveMarking {
ASSERT(IsMarked(object));
}
- static int SizeOfMarkedObject(HeapObject* object) {
+ static Map* MapOfMarkedObject(HeapObject* object) {
uintptr_t map_word = object->map_word().ToRawValue();
- Map* map = MapWord::FromRawValue(map_word | kNotMarkedBit).ToMap();
- return object->SizeFromMap(map);
+ return MapWord::FromRawValue(map_word | kNotMarkedBit).ToMap();
+ }
+
+ static int SizeOfMarkedObject(HeapObject* object) {
+ return object->SizeFromMap(MapOfMarkedObject(object));
}
private:
« no previous file with comments | « src/debug.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698