Make AlwaysAllocateScope imply DisallowAllocationFailure.
authormstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 30 Jul 2012 13:07:29 +0000 (13:07 +0000)
committermstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 30 Jul 2012 13:07:29 +0000 (13:07 +0000)
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
test/cctest/test-heap.cc

index af6207d..918e25e 100644 (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:
 //
index daf45ad..22a3820 100644 (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++) {