OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/factory.h" | 5 #include "src/factory.h" |
6 #include "src/heap/array-buffer-tracker.h" | 6 #include "src/heap/array-buffer-tracker.h" |
7 #include "src/heap/spaces-inl.h" | 7 #include "src/heap/spaces-inl.h" |
8 #include "src/isolate.h" | 8 #include "src/isolate.h" |
9 // FIXME(mstarzinger, marja): This is weird, but required because of the missing | 9 // FIXME(mstarzinger, marja): This is weird, but required because of the missing |
10 // (disallowed) include: src/factory.h -> src/objects-inl.h | 10 // (disallowed) include: src/factory.h -> src/objects-inl.h |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 v8::Isolate::Scope isolate_scope(isolate); | 108 v8::Isolate::Scope isolate_scope(isolate); |
109 v8::HandleScope handle_scope(isolate); | 109 v8::HandleScope handle_scope(isolate); |
110 v8::Context::New(isolate)->Enter(); | 110 v8::Context::New(isolate)->Enter(); |
111 Heap* heap = i_isolate->heap(); | 111 Heap* heap = i_isolate->heap(); |
112 | 112 |
113 // Fill the current page which potentially contains the age mark. | 113 // Fill the current page which potentially contains the age mark. |
114 heap::FillCurrentPage(heap->new_space()); | 114 heap::FillCurrentPage(heap->new_space()); |
115 // Allocate a buffer we would like to check against. | 115 // Allocate a buffer we would like to check against. |
116 Handle<JSArrayBuffer> buffer = | 116 Handle<JSArrayBuffer> buffer = |
117 i_isolate->factory()->NewJSArrayBuffer(SharedFlag::kNotShared); | 117 i_isolate->factory()->NewJSArrayBuffer(SharedFlag::kNotShared); |
118 JSArrayBuffer::SetupAllocatingData(buffer, i_isolate, 100); | 118 CHECK(JSArrayBuffer::SetupAllocatingData(buffer, i_isolate, 100)); |
119 std::vector<Handle<FixedArray>> handles; | 119 std::vector<Handle<FixedArray>> handles; |
120 // Simulate a full space, filling the interesting page with live objects. | 120 // Simulate a full space, filling the interesting page with live objects. |
121 heap::SimulateFullSpace(heap->new_space(), &handles); | 121 heap::SimulateFullSpace(heap->new_space(), &handles); |
122 CHECK_GT(handles.size(), 0u); | 122 CHECK_GT(handles.size(), 0u); |
123 // Last object in handles should definitely be on the last page which does | 123 // Last object in handles should definitely be on the last page which does |
124 // not contain the age mark. | 124 // not contain the age mark. |
125 Handle<FixedArray> first_object = handles.front(); | 125 Handle<FixedArray> first_object = handles.front(); |
126 Page* to_be_promoted_page = Page::FromAddress(first_object->address()); | 126 Page* to_be_promoted_page = Page::FromAddress(first_object->address()); |
127 CHECK(to_be_promoted_page->Contains(first_object->address())); | 127 CHECK(to_be_promoted_page->Contains(first_object->address())); |
128 CHECK(to_be_promoted_page->Contains(buffer->address())); | 128 CHECK(to_be_promoted_page->Contains(buffer->address())); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting); | 165 heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting); |
166 heap->new_space()->Shrink(); | 166 heap->new_space()->Shrink(); |
167 heap->memory_allocator()->unmapper()->WaitUntilCompleted(); | 167 heap->memory_allocator()->unmapper()->WaitUntilCompleted(); |
168 heap->mark_compact_collector()->sweeper().StartSweeperTasks(); | 168 heap->mark_compact_collector()->sweeper().StartSweeperTasks(); |
169 heap->mark_compact_collector()->EnsureSweepingCompleted(); | 169 heap->mark_compact_collector()->EnsureSweepingCompleted(); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 } // namespace internal | 173 } // namespace internal |
174 } // namespace v8 | 174 } // namespace v8 |
OLD | NEW |