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/api.h" | 5 #include "src/api.h" |
6 #include "src/heap/array-buffer-tracker.h" | 6 #include "src/heap/array-buffer-tracker.h" |
7 #include "src/isolate.h" | 7 #include "src/isolate.h" |
8 #include "test/cctest/cctest.h" | 8 #include "test/cctest/cctest.h" |
9 #include "test/cctest/heap/heap-utils.h" | 9 #include "test/cctest/heap/heap-utils.h" |
10 | 10 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 heap::AbandonCurrentlyFreeMemory(heap->old_space()); | 120 heap::AbandonCurrentlyFreeMemory(heap->old_space()); |
121 | 121 |
122 v8::HandleScope handle_scope(isolate); | 122 v8::HandleScope handle_scope(isolate); |
123 Local<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::New(isolate, 100); | 123 Local<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::New(isolate, 100); |
124 Handle<JSArrayBuffer> buf1 = v8::Utils::OpenHandle(*ab1); | 124 Handle<JSArrayBuffer> buf1 = v8::Utils::OpenHandle(*ab1); |
125 CHECK(IsTracked(*buf1)); | 125 CHECK(IsTracked(*buf1)); |
126 heap::GcAndSweep(heap, NEW_SPACE); | 126 heap::GcAndSweep(heap, NEW_SPACE); |
127 heap::GcAndSweep(heap, NEW_SPACE); | 127 heap::GcAndSweep(heap, NEW_SPACE); |
128 | 128 |
129 Page* page_before_gc = Page::FromAddress(buf1->address()); | 129 Page* page_before_gc = Page::FromAddress(buf1->address()); |
130 page_before_gc->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); | 130 heap::ForceEvacuationCandidate(page_before_gc); |
131 CHECK(IsTracked(*buf1)); | 131 CHECK(IsTracked(*buf1)); |
132 | 132 |
133 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); | 133 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); |
134 | 134 |
135 Page* page_after_gc = Page::FromAddress(buf1->address()); | 135 Page* page_after_gc = Page::FromAddress(buf1->address()); |
136 CHECK(IsTracked(*buf1)); | 136 CHECK(IsTracked(*buf1)); |
137 | 137 |
138 CHECK_NE(page_before_gc, page_after_gc); | 138 CHECK_NE(page_before_gc, page_after_gc); |
139 } | 139 } |
140 | 140 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 Local<v8::ArrayBuffer> ab2 = v8::ArrayBuffer::New(isolate, 100); | 311 Local<v8::ArrayBuffer> ab2 = v8::ArrayBuffer::New(isolate, 100); |
312 Handle<JSArrayBuffer> buf2 = v8::Utils::OpenHandle(*ab2); | 312 Handle<JSArrayBuffer> buf2 = v8::Utils::OpenHandle(*ab2); |
313 CHECK_NE(Page::FromAddress(buf1->address()), | 313 CHECK_NE(Page::FromAddress(buf1->address()), |
314 Page::FromAddress(buf2->address())); | 314 Page::FromAddress(buf2->address())); |
315 heap::GcAndSweep(heap, OLD_SPACE); | 315 heap::GcAndSweep(heap, OLD_SPACE); |
316 } | 316 } |
317 } | 317 } |
318 | 318 |
319 } // namespace internal | 319 } // namespace internal |
320 } // namespace v8 | 320 } // namespace v8 |
OLD | NEW |