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

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

Issue 167423004: Add filler at the new space top when forcing scavenge. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove PerformScavenge Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-symbols.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 11 matching lines...) Expand all
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "cctest.h" 28 #include "cctest.h"
29 29
30 using namespace v8::internal; 30 using namespace v8::internal;
31 31
32 TEST(Regress340063) {
33 CcTest::InitializeVM();
34 if (!i::FLAG_allocation_site_pretenuring) return;
35 v8::HandleScope scope(CcTest::isolate());
36 32
33 static void SetUpNewSpaceWithPoisonedMementoAtTop() {
37 Isolate* isolate = CcTest::i_isolate(); 34 Isolate* isolate = CcTest::i_isolate();
38 Heap* heap = isolate->heap(); 35 Heap* heap = isolate->heap();
39 NewSpace* new_space = heap->new_space(); 36 NewSpace* new_space = heap->new_space();
40 37
41 // Make sure we can allocate some objects without causing a GC later. 38 // Make sure we can allocate some objects without causing a GC later.
42 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); 39 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
43 40
44 // Allocate a string, the GC may suspect a memento behind the string. 41 // Allocate a string, the GC may suspect a memento behind the string.
45 Handle<SeqOneByteString> string = isolate->factory()->NewRawOneByteString(12); 42 Handle<SeqOneByteString> string = isolate->factory()->NewRawOneByteString(12);
46 CHECK(*string); 43 CHECK(*string);
47 44
48 // Create an allocation memento behind the string with a garbage allocation 45 // Create an allocation memento behind the string with a garbage allocation
49 // site pointer. 46 // site pointer.
50 AllocationMemento* memento = 47 AllocationMemento* memento =
51 reinterpret_cast<AllocationMemento*>(new_space->top() + kHeapObjectTag); 48 reinterpret_cast<AllocationMemento*>(new_space->top() + kHeapObjectTag);
52 memento->set_map_no_write_barrier(heap->allocation_memento_map()); 49 memento->set_map_no_write_barrier(heap->allocation_memento_map());
53 memento->set_allocation_site( 50 memento->set_allocation_site(
54 reinterpret_cast<AllocationSite*>(kHeapObjectTag), SKIP_WRITE_BARRIER); 51 reinterpret_cast<AllocationSite*>(kHeapObjectTag), SKIP_WRITE_BARRIER);
52 }
53
54
55 TEST(Regress340063) {
56 CcTest::InitializeVM();
57 if (!i::FLAG_allocation_site_pretenuring) return;
58 v8::HandleScope scope(CcTest::isolate());
59
60
61 SetUpNewSpaceWithPoisonedMementoAtTop();
55 62
56 // Call GC to see if we can handle a poisonous memento right after the 63 // Call GC to see if we can handle a poisonous memento right after the
57 // current new space top pointer. 64 // current new space top pointer.
65 Heap* heap = CcTest::i_isolate()->heap();
58 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); 66 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
Hannes Payer (out of office) 2014/02/18 11:41:03 Change it to CcTest::i_isolate()->heap()->CollectA
59 } 67 }
68
69
70 TEST(BadMementoAfterTopForceScavenge) {
71 CcTest::InitializeVM();
72 if (!i::FLAG_allocation_site_pretenuring) return;
73 v8::HandleScope scope(CcTest::isolate());
74
75 SetUpNewSpaceWithPoisonedMementoAtTop();
76
77 // Force GC to test the poisoned memento handling
78 CcTest::i_isolate()->heap()->CollectGarbage(i::NEW_SPACE);
79 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-symbols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698