From 3bb994c4e4583664f4a89aa0ab8bdf44052abbd0 Mon Sep 17 00:00:00 2001 From: "mstarzinger@chromium.org" Date: Wed, 1 Aug 2012 09:43:05 +0000 Subject: [PATCH] Make test-serialize resilient against --gc-interval. 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 | 6 ++++-- src/heap.h | 6 ++---- src/isolate.cc | 2 -- test/cctest/test-serialize.cc | 1 + 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/heap-inl.h b/src/heap-inl.h index 958fe19..72d88c4 100644 --- a/src/heap-inl.h +++ b/src/heap-inl.h @@ -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 diff --git a/src/heap.h b/src/heap.h index 8d40bd9..8737010 100644 --- a/src/heap.h +++ b/src/heap.h @@ -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 }; diff --git a/src/isolate.cc b/src/isolate.cc index 69ffc5e..c15dccb 100644 --- a/src/isolate.cc +++ b/src/isolate.cc @@ -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(); diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc index e8ba2b4..3ca9b61 100644 --- a/test/cctest/test-serialize.cc +++ b/test/cctest/test-serialize.cc @@ -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; -- 2.7.4