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

Unified Diff: src/heap.h

Issue 9121033: Break a circular include dependency. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Incorporated reviewer comments. Created 8 years, 11 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 | « no previous file | src/heap-inl.h » ('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 c8ac927cd254ee5ec27dc07c3fbb8649d523da61..b6d3c181feef42163e722e1bc5c793498946f780 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -45,12 +45,6 @@
namespace v8 {
namespace internal {
-// TODO(isolates): remove HEAP here
-#define HEAP (_inline_get_heap_())
-class Heap;
-inline Heap* _inline_get_heap_();
-
-
// Defines all the roots in Heap.
#define STRONG_ROOT_LIST(V) \
V(Map, byte_array_map, ByteArrayMap) \
@@ -1995,32 +1989,15 @@ class HeapStats {
class AlwaysAllocateScope {
public:
- AlwaysAllocateScope() {
- // We shouldn't hit any nested scopes, because that requires
- // non-handle code to call handle code. The code still works but
- // performance will degrade, so we want to catch this situation
- // in debug mode.
- ASSERT(HEAP->always_allocate_scope_depth_ == 0);
- HEAP->always_allocate_scope_depth_++;
- }
-
- ~AlwaysAllocateScope() {
- HEAP->always_allocate_scope_depth_--;
- ASSERT(HEAP->always_allocate_scope_depth_ == 0);
- }
+ inline AlwaysAllocateScope();
+ inline ~AlwaysAllocateScope();
};
class LinearAllocationScope {
public:
- LinearAllocationScope() {
- HEAP->linear_allocation_scope_depth_++;
- }
-
- ~LinearAllocationScope() {
- HEAP->linear_allocation_scope_depth_--;
- ASSERT(HEAP->linear_allocation_scope_depth_ >= 0);
- }
+ inline LinearAllocationScope();
+ inline ~LinearAllocationScope();
};
@@ -2032,15 +2009,7 @@ class LinearAllocationScope {
// objects in a heap space but above the allocation pointer.
class VerifyPointersVisitor: public ObjectVisitor {
public:
- void VisitPointers(Object** start, Object** end) {
- for (Object** current = start; current < end; current++) {
- if ((*current)->IsHeapObject()) {
- HeapObject* object = HeapObject::cast(*current);
- ASSERT(HEAP->Contains(object));
- ASSERT(object->map()->IsMap());
- }
- }
- }
+ inline void VisitPointers(Object** start, Object** end);
};
#endif
@@ -2266,72 +2235,47 @@ class DescriptorLookupCache {
};
-// A helper class to document/test C++ scopes where we do not
-// expect a GC. Usage:
-//
-// /* Allocation not allowed: we cannot handle a GC in this scope. */
-// { AssertNoAllocation nogc;
-// ...
-// }
-
#ifdef DEBUG
-
class DisallowAllocationFailure {
public:
- DisallowAllocationFailure() {
- old_state_ = HEAP->disallow_allocation_failure_;
- HEAP->disallow_allocation_failure_ = true;
- }
- ~DisallowAllocationFailure() {
- HEAP->disallow_allocation_failure_ = old_state_;
- }
+ inline DisallowAllocationFailure();
+ inline ~DisallowAllocationFailure();
+
private:
bool old_state_;
};
+#endif
+
+// A helper class to document/test C++ scopes where we do not
+// expect a GC. Usage:
+//
+// /* Allocation not allowed: we cannot handle a GC in this scope. */
+// { AssertNoAllocation nogc;
+// ...
+// }
class AssertNoAllocation {
public:
- AssertNoAllocation() {
- old_state_ = HEAP->allow_allocation(false);
- }
-
- ~AssertNoAllocation() {
- HEAP->allow_allocation(old_state_);
- }
+ inline AssertNoAllocation();
+ inline ~AssertNoAllocation();
+#ifdef DEBUG
private:
bool old_state_;
+#endif
};
+
class DisableAssertNoAllocation {
public:
- DisableAssertNoAllocation() {
- old_state_ = HEAP->allow_allocation(true);
- }
-
- ~DisableAssertNoAllocation() {
- HEAP->allow_allocation(old_state_);
- }
+ inline DisableAssertNoAllocation();
+ inline ~DisableAssertNoAllocation();
+#ifdef DEBUG
private:
bool old_state_;
-};
-
-#else // ndef DEBUG
-
-class AssertNoAllocation {
- public:
- AssertNoAllocation() { }
- ~AssertNoAllocation() { }
-};
-
-class DisableAssertNoAllocation {
- public:
- DisableAssertNoAllocation() { }
- ~DisableAssertNoAllocation() { }
-};
-
#endif
+};
// GCTracer collects and prints ONE line after each garbage collector
// invocation IFF --trace_gc is used.
@@ -2394,9 +2338,7 @@ class GCTracer BASE_EMBEDDED {
const char* CollectorString();
// Returns size of object in heap (in MB).
- double SizeOfHeapObjects() {
- return (static_cast<double>(HEAP->SizeOfObjects())) / MB;
- }
+ inline double SizeOfHeapObjects();
double start_time_; // Timestamp set in the constructor.
intptr_t start_size_; // Size of objects in heap set in constructor.
@@ -2646,6 +2588,4 @@ class PathTracer : public ObjectVisitor {
} } // namespace v8::internal
-#undef HEAP
-
#endif // V8_HEAP_H_
« no previous file with comments | « no previous file | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698