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
This commit is contained in:
mstarzinger@chromium.org 2012-07-30 13:07:29 +00:00
parent bfd51f29dc
commit 249f29f22b
2 changed files with 19 additions and 12 deletions

View File

@ -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:
//

View File

@ -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++) {