Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(730)

Unified Diff: test/cctest/test-alloc.cc

Issue 1372063002: [heap] Move CALL_HEAP_FUNCTION macro into factory.cc file. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-alloc.cc
diff --git a/test/cctest/test-alloc.cc b/test/cctest/test-alloc.cc
index 1ac0adde0f78cc65e75930387580f59a0227cbd7..19e10d5a095a1523cbc491038d940455a8e7ee2c 100644
--- a/test/cctest/test-alloc.cc
+++ b/test/cctest/test-alloc.cc
@@ -37,18 +37,8 @@ using namespace v8::internal;
AllocationResult v8::internal::HeapTester::AllocateAfterFailures() {
- static int attempts = 0;
-
- // The first 4 times we simulate a full heap, by returning retry.
- if (++attempts < 4) return AllocationResult::Retry();
-
- // Expose some private stuff on Heap.
Heap* heap = CcTest::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();
@@ -99,7 +89,12 @@ AllocationResult v8::internal::HeapTester::AllocateAfterFailures() {
Handle<Object> v8::internal::HeapTester::TestAllocateAfterFailures() {
- CALL_HEAP_FUNCTION(CcTest::i_isolate(), AllocateAfterFailures(), Object);
+ // Similar to what the CALL_AND_RETRY macro does in the last-resort case, we
+ // are wrapping the allocator function in an AlwaysAllocateScope. Test that
+ // all allocations succeed immediately without any retry.
+ CcTest::heap()->CollectAllAvailableGarbage("panic");
+ AlwaysAllocateScope scope(CcTest::i_isolate());
+ return handle(AllocateAfterFailures().ToObjectChecked(), CcTest::i_isolate());
}
« no previous file with comments | « src/heap/heap-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698