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

Side by Side Diff: test/cctest/test-alloc.cc

Issue 1104113002: Do more to avoid last-resort stop-the-world GC (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test-alloc Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/heap/heap-inl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 20 matching lines...) Expand all
31 #include "src/accessors.h" 31 #include "src/accessors.h"
32 #include "src/api.h" 32 #include "src/api.h"
33 33
34 34
35 using namespace v8::internal; 35 using namespace v8::internal;
36 36
37 37
38 static AllocationResult AllocateAfterFailures() { 38 static AllocationResult AllocateAfterFailures() {
39 static int attempts = 0; 39 static int attempts = 0;
40 40
41 if (++attempts < 3) return AllocationResult::Retry(); 41 // The first 4 times we simulate a full heap, by returning retry.
42 if (++attempts < 4) return AllocationResult::Retry();
43
44 // Expose some private stuff on Heap.
42 TestHeap* heap = CcTest::test_heap(); 45 TestHeap* heap = CcTest::test_heap();
43 46
47 // Now that we have returned 'retry' 4 times, we are in a last-chance
48 // scenario, with always_allocate. See CALL_AND_RETRY. Test that all
49 // allocations succeed.
50
44 // New space. 51 // New space.
45 SimulateFullSpace(heap->new_space()); 52 SimulateFullSpace(heap->new_space());
46 heap->AllocateByteArray(100).ToObjectChecked(); 53 heap->AllocateByteArray(100).ToObjectChecked();
47 heap->AllocateFixedArray(100, NOT_TENURED).ToObjectChecked(); 54 heap->AllocateFixedArray(100, NOT_TENURED).ToObjectChecked();
48 55
49 // Make sure we can allocate through optimized allocation functions 56 // Make sure we can allocate through optimized allocation functions
50 // for specific kinds. 57 // for specific kinds.
51 heap->AllocateFixedArray(100).ToObjectChecked(); 58 heap->AllocateFixedArray(100).ToObjectChecked();
52 heap->AllocateHeapNumber(0.42).ToObjectChecked(); 59 heap->AllocateHeapNumber(0.42).ToObjectChecked();
53 Object* object = heap->AllocateJSObject( 60 Object* object = heap->AllocateJSObject(
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 if (index < blocks.length() - 1) { 237 if (index < blocks.length() - 1) {
231 blocks[index] = blocks.RemoveLast(); 238 blocks[index] = blocks.RemoveLast();
232 } else { 239 } else {
233 blocks.RemoveLast(); 240 blocks.RemoveLast();
234 } 241 }
235 } 242 }
236 } 243 }
237 244
238 code_range.TearDown(); 245 code_range.TearDown();
239 } 246 }
OLDNEW
« 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