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_stress_incremental_marking = false; |
117 FLAG_manual_evacuation_candidates_selection = true; | 118 FLAG_manual_evacuation_candidates_selection = true; |
118 CcTest::InitializeVM(); | 119 CcTest::InitializeVM(); |
119 LocalContext env; | 120 LocalContext env; |
120 v8::Isolate* isolate = env->GetIsolate(); | 121 v8::Isolate* isolate = env->GetIsolate(); |
121 Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap(); | 122 Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap(); |
122 heap::AbandonCurrentlyFreeMemory(heap->old_space()); | 123 heap::AbandonCurrentlyFreeMemory(heap->old_space()); |
123 | 124 |
124 v8::HandleScope handle_scope(isolate); | 125 v8::HandleScope handle_scope(isolate); |
125 Local<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::New(isolate, 100); | 126 Local<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::New(isolate, 100); |
126 Handle<JSArrayBuffer> buf1 = v8::Utils::OpenHandle(*ab1); | 127 Handle<JSArrayBuffer> buf1 = v8::Utils::OpenHandle(*ab1); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 Local<v8::ArrayBuffer> ab2 = v8::ArrayBuffer::New(isolate, 100); | 323 Local<v8::ArrayBuffer> ab2 = v8::ArrayBuffer::New(isolate, 100); |
323 Handle<JSArrayBuffer> buf2 = v8::Utils::OpenHandle(*ab2); | 324 Handle<JSArrayBuffer> buf2 = v8::Utils::OpenHandle(*ab2); |
324 CHECK_NE(Page::FromAddress(buf1->address()), | 325 CHECK_NE(Page::FromAddress(buf1->address()), |
325 Page::FromAddress(buf2->address())); | 326 Page::FromAddress(buf2->address())); |
326 heap::GcAndSweep(heap, OLD_SPACE); | 327 heap::GcAndSweep(heap, OLD_SPACE); |
327 } | 328 } |
328 } | 329 } |
329 | 330 |
330 } // namespace internal | 331 } // namespace internal |
331 } // namespace v8 | 332 } // namespace v8 |
OLD | NEW |