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

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

Issue 181453002: Reset trunk to 3.24.35.4 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: 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-mark-compact.cc ('k') | test/cctest/test-microtask-delivery.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());
32 36
33 static void SetUpNewSpaceWithPoisonedMementoAtTop() {
34 Isolate* isolate = CcTest::i_isolate(); 37 Isolate* isolate = CcTest::i_isolate();
35 Heap* heap = isolate->heap(); 38 Heap* heap = isolate->heap();
36 NewSpace* new_space = heap->new_space(); 39 NewSpace* new_space = heap->new_space();
37 40
38 // Make sure we can allocate some objects without causing a GC later. 41 // Make sure we can allocate some objects without causing a GC later.
39 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); 42 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
40 43
41 // Allocate a string, the GC may suspect a memento behind the string. 44 // Allocate a string, the GC may suspect a memento behind the string.
42 Handle<SeqOneByteString> string = isolate->factory()->NewRawOneByteString(12); 45 Handle<SeqOneByteString> string = isolate->factory()->NewRawOneByteString(12);
43 CHECK(*string); 46 CHECK(*string);
44 47
45 // Create an allocation memento behind the string with a garbage allocation 48 // Create an allocation memento behind the string with a garbage allocation
46 // site pointer. 49 // site pointer.
47 AllocationMemento* memento = 50 AllocationMemento* memento =
48 reinterpret_cast<AllocationMemento*>(new_space->top() + kHeapObjectTag); 51 reinterpret_cast<AllocationMemento*>(new_space->top() + kHeapObjectTag);
49 memento->set_map_no_write_barrier(heap->allocation_memento_map()); 52 memento->set_map_no_write_barrier(heap->allocation_memento_map());
50 memento->set_allocation_site( 53 memento->set_allocation_site(
51 reinterpret_cast<AllocationSite*>(kHeapObjectTag), SKIP_WRITE_BARRIER); 54 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();
62 55
63 // Call GC to see if we can handle a poisonous memento right after the 56 // Call GC to see if we can handle a poisonous memento right after the
64 // current new space top pointer. 57 // current new space top pointer.
65 CcTest::i_isolate()->heap()->CollectAllGarbage( 58 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
66 Heap::kAbortIncrementalMarkingMask);
67 } 59 }
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-mark-compact.cc ('k') | test/cctest/test-microtask-delivery.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698