OLD | NEW |
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 // Allocate a string, the GC may suspect a memento behind the string. | 51 // Allocate a string, the GC may suspect a memento behind the string. |
52 Handle<SeqOneByteString> string = | 52 Handle<SeqOneByteString> string = |
53 isolate->factory()->NewRawOneByteString(12).ToHandleChecked(); | 53 isolate->factory()->NewRawOneByteString(12).ToHandleChecked(); |
54 CHECK(*string); | 54 CHECK(*string); |
55 | 55 |
56 // Create an allocation memento behind the string with a garbage allocation | 56 // Create an allocation memento behind the string with a garbage allocation |
57 // site pointer. | 57 // site pointer. |
58 AllocationMemento* memento = | 58 AllocationMemento* memento = |
59 reinterpret_cast<AllocationMemento*>(new_space->top() + kHeapObjectTag); | 59 reinterpret_cast<AllocationMemento*>(new_space->top() + kHeapObjectTag); |
60 memento->set_map_no_write_barrier(heap->allocation_memento_map()); | 60 memento->set_map_after_allocation(heap->allocation_memento_map(), |
| 61 SKIP_WRITE_BARRIER); |
61 memento->set_allocation_site( | 62 memento->set_allocation_site( |
62 reinterpret_cast<AllocationSite*>(kHeapObjectTag), SKIP_WRITE_BARRIER); | 63 reinterpret_cast<AllocationSite*>(kHeapObjectTag), SKIP_WRITE_BARRIER); |
63 } | 64 } |
64 | 65 |
65 | 66 |
66 TEST(Regress340063) { | 67 TEST(Regress340063) { |
67 CcTest::InitializeVM(); | 68 CcTest::InitializeVM(); |
68 if (!i::FLAG_allocation_site_pretenuring) return; | 69 if (!i::FLAG_allocation_site_pretenuring) return; |
69 v8::HandleScope scope(CcTest::isolate()); | 70 v8::HandleScope scope(CcTest::isolate()); |
70 | 71 |
(...skipping 25 matching lines...) Expand all Loading... |
96 TEST(BadMementoAfterTopForceScavenge) { | 97 TEST(BadMementoAfterTopForceScavenge) { |
97 CcTest::InitializeVM(); | 98 CcTest::InitializeVM(); |
98 if (!i::FLAG_allocation_site_pretenuring) return; | 99 if (!i::FLAG_allocation_site_pretenuring) return; |
99 v8::HandleScope scope(CcTest::isolate()); | 100 v8::HandleScope scope(CcTest::isolate()); |
100 | 101 |
101 SetUpNewSpaceWithPoisonedMementoAtTop(); | 102 SetUpNewSpaceWithPoisonedMementoAtTop(); |
102 | 103 |
103 // Force GC to test the poisoned memento handling | 104 // Force GC to test the poisoned memento handling |
104 CcTest::CollectGarbage(i::NEW_SPACE); | 105 CcTest::CollectGarbage(i::NEW_SPACE); |
105 } | 106 } |
OLD | NEW |