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/heap/spaces.h" | 7 #include "src/heap/spaces.h" |
8 #include "src/isolate.h" | 8 #include "src/isolate.h" |
9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
10 #include "test/cctest/cctest.h" | 10 #include "test/cctest/cctest.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 Page::FromAddress(buf->address())->MarkNeverEvacuate(); | 107 Page::FromAddress(buf->address())->MarkNeverEvacuate(); |
108 } | 108 } |
109 // 2 GCs are needed because we promote to old space as live, meaning that | 109 // 2 GCs are needed because we promote to old space as live, meaning that |
110 // we will survive one GC. | 110 // we will survive one GC. |
111 heap::GcAndSweep(heap, OLD_SPACE); | 111 heap::GcAndSweep(heap, OLD_SPACE); |
112 heap::GcAndSweep(heap, OLD_SPACE); | 112 heap::GcAndSweep(heap, OLD_SPACE); |
113 CHECK(!IsTracked(raw_ab)); | 113 CHECK(!IsTracked(raw_ab)); |
114 } | 114 } |
115 | 115 |
116 TEST(ArrayBuffer_Compaction) { | 116 TEST(ArrayBuffer_Compaction) { |
| 117 FLAG_concurrent_marking = false; |
117 FLAG_stress_incremental_marking = false; | 118 FLAG_stress_incremental_marking = false; |
118 FLAG_manual_evacuation_candidates_selection = true; | 119 FLAG_manual_evacuation_candidates_selection = true; |
119 CcTest::InitializeVM(); | 120 CcTest::InitializeVM(); |
120 LocalContext env; | 121 LocalContext env; |
121 v8::Isolate* isolate = env->GetIsolate(); | 122 v8::Isolate* isolate = env->GetIsolate(); |
122 Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap(); | 123 Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap(); |
123 heap::AbandonCurrentlyFreeMemory(heap->old_space()); | 124 heap::AbandonCurrentlyFreeMemory(heap->old_space()); |
124 | 125 |
125 v8::HandleScope handle_scope(isolate); | 126 v8::HandleScope handle_scope(isolate); |
126 Local<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::New(isolate, 100); | 127 Local<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::New(isolate, 100); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 Local<v8::ArrayBuffer> ab2 = v8::ArrayBuffer::New(isolate, 100); | 324 Local<v8::ArrayBuffer> ab2 = v8::ArrayBuffer::New(isolate, 100); |
324 Handle<JSArrayBuffer> buf2 = v8::Utils::OpenHandle(*ab2); | 325 Handle<JSArrayBuffer> buf2 = v8::Utils::OpenHandle(*ab2); |
325 CHECK_NE(Page::FromAddress(buf1->address()), | 326 CHECK_NE(Page::FromAddress(buf1->address()), |
326 Page::FromAddress(buf2->address())); | 327 Page::FromAddress(buf2->address())); |
327 heap::GcAndSweep(heap, OLD_SPACE); | 328 heap::GcAndSweep(heap, OLD_SPACE); |
328 } | 329 } |
329 } | 330 } |
330 | 331 |
331 } // namespace internal | 332 } // namespace internal |
332 } // namespace v8 | 333 } // namespace v8 |
OLD | NEW |