From 249f29f22b96039b82bbc5e198b9a312c6726fb5 Mon Sep 17 00:00:00 2001 From: "mstarzinger@chromium.org" Date: Mon, 30 Jul 2012 13:07:29 +0000 Subject: [PATCH] Make AlwaysAllocateScope imply DisallowAllocationFailure. R=erik.corry@gmail.com TEST=cctest/test-api,cctest/test-heap (--gc-interval=100) Review URL: https://chromiumcodereview.appspot.com/10824082 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12229 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/heap.h | 30 ++++++++++++++++++------------ test/cctest/test-heap.cc | 1 + 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/heap.h b/src/heap.h index af6207d..918e25e 100644 --- a/src/heap.h +++ b/src/heap.h @@ -2149,10 +2149,28 @@ class HeapStats { }; +#ifdef DEBUG +class DisallowAllocationFailure { + public: + inline DisallowAllocationFailure(); + inline ~DisallowAllocationFailure(); + + private: + bool old_state_; +}; +#endif + + class AlwaysAllocateScope { public: inline AlwaysAllocateScope(); inline ~AlwaysAllocateScope(); + +#ifdef DEBUG + private: + // Implicitly disable artificial allocation failures. + DisallowAllocationFailure disallow_allocation_failure_; +#endif }; @@ -2397,18 +2415,6 @@ class DescriptorLookupCache { }; -#ifdef DEBUG -class DisallowAllocationFailure { - public: - 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: // diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc index daf45ad..22a3820 100644 --- a/test/cctest/test-heap.cc +++ b/test/cctest/test-heap.cc @@ -1268,6 +1268,7 @@ static void FillUpNewSpace(NewSpace* new_space) { // that the scavenger does not undo the filling. v8::HandleScope scope; AlwaysAllocateScope always_allocate; + LinearAllocationScope allocate_linearly; intptr_t available = new_space->EffectiveCapacity() - new_space->Size(); intptr_t number_of_fillers = (available / FixedArray::SizeFor(32)) - 1; for (intptr_t i = 0; i < number_of_fillers; i++) { -- 2.7.4