Make test-serialize resilient against --gc-interval.
authormstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 1 Aug 2012 09:43:05 +0000 (09:43 +0000)
committermstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 1 Aug 2012 09:43:05 +0000 (09:43 +0000)
R=erik.corry@gmail.com
TEST=cctest/test-serialize (--gc-interval=100)

Review URL: https://chromiumcodereview.appspot.com/10829097

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12240 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/heap-inl.h
src/heap.h
src/isolate.cc
test/cctest/test-serialize.cc

index 958fe19..72d88c4 100644 (file)
@@ -757,17 +757,19 @@ double GCTracer::SizeOfHeapObjects() {
 }
 
 
-#ifdef DEBUG
 DisallowAllocationFailure::DisallowAllocationFailure() {
+#ifdef DEBUG
   old_state_ = HEAP->disallow_allocation_failure_;
   HEAP->disallow_allocation_failure_ = true;
+#endif
 }
 
 
 DisallowAllocationFailure::~DisallowAllocationFailure() {
+#ifdef DEBUG
   HEAP->disallow_allocation_failure_ = old_state_;
-}
 #endif
+}
 
 
 #ifdef DEBUG
index 8d40bd9..8737010 100644 (file)
@@ -2149,16 +2149,16 @@ class HeapStats {
 };
 
 
-#ifdef DEBUG
 class DisallowAllocationFailure {
  public:
   inline DisallowAllocationFailure();
   inline ~DisallowAllocationFailure();
 
+#ifdef DEBUG
  private:
   bool old_state_;
-};
 #endif
+};
 
 
 class AlwaysAllocateScope {
@@ -2166,11 +2166,9 @@ class AlwaysAllocateScope {
   inline AlwaysAllocateScope();
   inline ~AlwaysAllocateScope();
 
-#ifdef DEBUG
  private:
   // Implicitly disable artificial allocation failures.
   DisallowAllocationFailure disallow_allocation_failure_;
-#endif
 };
 
 
index 69ffc5e..c15dccb 100644 (file)
@@ -1780,10 +1780,8 @@ bool Isolate::Init(Deserializer* des) {
   ASSERT(Isolate::Current() == this);
   TRACE_ISOLATE(init);
 
-#ifdef DEBUG
   // The initialization process does not handle memory exhaustion.
   DisallowAllocationFailure disallow_allocation_failure;
-#endif
 
   InitializeLoggingAndCounters();
 
index e8ba2b4..3ca9b61 100644 (file)
@@ -584,6 +584,7 @@ TEST(LinearAllocation) {
         HEAP->cell_space()->RoundSizeDownToObjectAlignment(paged_space_size),
         size);             // Large object space.
     LinearAllocationScope linear_allocation_scope;
+    DisallowAllocationFailure disallow_allocation_failure;
     const int kSmallFixedArrayLength = 4;
     const int kSmallFixedArraySize =
         FixedArray::kHeaderSize + kSmallFixedArrayLength * kPointerSize;