Index: test/cctest/test-alloc.cc |
diff --git a/test/cctest/test-alloc.cc b/test/cctest/test-alloc.cc |
index 66f69f8b574d68ab57147c2f739bc8cb64aef851..74388d1785047b9319a5a521791a3bb14fc98c09 100644 |
--- a/test/cctest/test-alloc.cc |
+++ b/test/cctest/test-alloc.cc |
@@ -38,9 +38,16 @@ using namespace v8::internal; |
static AllocationResult AllocateAfterFailures() { |
static int attempts = 0; |
- if (++attempts < 3) return AllocationResult::Retry(); |
+ // The first 4 times we simulate a full heap, by returning retry. |
+ if (++attempts < 4) return AllocationResult::Retry(); |
+ |
+ // Expose some private stuff on Heap. |
TestHeap* heap = CcTest::test_heap(); |
+ // Now that we have returned 'retry' 4 times, we are in a last-chance |
+ // scenario, with always_allocate. See CALL_AND_RETRY. Test that all |
+ // allocations succeed. |
+ |
// New space. |
SimulateFullSpace(heap->new_space()); |
heap->AllocateByteArray(100).ToObjectChecked(); |