Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: test/cctest/heap/test-array-buffer-tracker.cc

Issue 2498583002: [heap] Minor MC: Add marking (Closed)
Patch Set: Move to concurrent uncomitting of marking deque Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/heap/heap-utils.cc ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // |Externalize| will cause the buffer to be |Unregister|ed. Without 181 // |Externalize| will cause the buffer to be |Unregister|ed. Without
182 // barriers and proper synchronization this will trigger a data race on 182 // barriers and proper synchronization this will trigger a data race on
183 // TSAN. 183 // TSAN.
184 v8::ArrayBuffer::Contents contents = ab->Externalize(); 184 v8::ArrayBuffer::Contents contents = ab->Externalize();
185 heap->isolate()->array_buffer_allocator()->Free(contents.Data(), 185 heap->isolate()->array_buffer_allocator()->Free(contents.Data(),
186 contents.ByteLength()); 186 contents.ByteLength());
187 } 187 }
188 } 188 }
189 189
190 TEST(ArrayBuffer_NonLivePromotion) { 190 TEST(ArrayBuffer_NonLivePromotion) {
191 if (!FLAG_incremental_marking) return;
191 // The test verifies that the marking state is preserved when promoting 192 // The test verifies that the marking state is preserved when promoting
192 // a buffer to old space. 193 // a buffer to old space.
193 CcTest::InitializeVM(); 194 CcTest::InitializeVM();
194 LocalContext env; 195 LocalContext env;
195 v8::Isolate* isolate = env->GetIsolate(); 196 v8::Isolate* isolate = env->GetIsolate();
196 Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap(); 197 Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap();
197 198
198 JSArrayBuffer* raw_ab = nullptr; 199 JSArrayBuffer* raw_ab = nullptr;
199 { 200 {
200 v8::HandleScope handle_scope(isolate); 201 v8::HandleScope handle_scope(isolate);
(...skipping 15 matching lines...) Expand all
216 root->set(0, heap->undefined_value()); 217 root->set(0, heap->undefined_value());
217 heap::SimulateIncrementalMarking(heap, true); 218 heap::SimulateIncrementalMarking(heap, true);
218 // Prohibit page from being released. 219 // Prohibit page from being released.
219 Page::FromAddress(raw_ab->address())->MarkNeverEvacuate(); 220 Page::FromAddress(raw_ab->address())->MarkNeverEvacuate();
220 heap::GcAndSweep(heap, OLD_SPACE); 221 heap::GcAndSweep(heap, OLD_SPACE);
221 CHECK(!IsTracked(raw_ab)); 222 CHECK(!IsTracked(raw_ab));
222 } 223 }
223 } 224 }
224 225
225 TEST(ArrayBuffer_LivePromotion) { 226 TEST(ArrayBuffer_LivePromotion) {
227 if (!FLAG_incremental_marking) return;
226 // The test verifies that the marking state is preserved when promoting 228 // The test verifies that the marking state is preserved when promoting
227 // a buffer to old space. 229 // a buffer to old space.
228 CcTest::InitializeVM(); 230 CcTest::InitializeVM();
229 LocalContext env; 231 LocalContext env;
230 v8::Isolate* isolate = env->GetIsolate(); 232 v8::Isolate* isolate = env->GetIsolate();
231 Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap(); 233 Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap();
232 234
233 JSArrayBuffer* raw_ab = nullptr; 235 JSArrayBuffer* raw_ab = nullptr;
234 { 236 {
235 v8::HandleScope handle_scope(isolate); 237 v8::HandleScope handle_scope(isolate);
(...skipping 14 matching lines...) Expand all
250 raw_ab = JSArrayBuffer::cast(root->get(0)); 252 raw_ab = JSArrayBuffer::cast(root->get(0));
251 root->set(0, heap->undefined_value()); 253 root->set(0, heap->undefined_value());
252 // Prohibit page from being released. 254 // Prohibit page from being released.
253 Page::FromAddress(raw_ab->address())->MarkNeverEvacuate(); 255 Page::FromAddress(raw_ab->address())->MarkNeverEvacuate();
254 heap::GcAndSweep(heap, OLD_SPACE); 256 heap::GcAndSweep(heap, OLD_SPACE);
255 CHECK(IsTracked(raw_ab)); 257 CHECK(IsTracked(raw_ab));
256 } 258 }
257 } 259 }
258 260
259 TEST(ArrayBuffer_SemiSpaceCopyThenPagePromotion) { 261 TEST(ArrayBuffer_SemiSpaceCopyThenPagePromotion) {
262 if (!i::FLAG_incremental_marking) return;
260 // The test verifies that the marking state is preserved across semispace 263 // The test verifies that the marking state is preserved across semispace
261 // copy. 264 // copy.
262 CcTest::InitializeVM(); 265 CcTest::InitializeVM();
263 LocalContext env; 266 LocalContext env;
264 v8::Isolate* isolate = env->GetIsolate(); 267 v8::Isolate* isolate = env->GetIsolate();
265 Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap(); 268 Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap();
266 269
267 heap::SealCurrentObjects(heap); 270 heap::SealCurrentObjects(heap);
268 { 271 {
269 v8::HandleScope handle_scope(isolate); 272 v8::HandleScope handle_scope(isolate);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 Local<v8::ArrayBuffer> ab2 = v8::ArrayBuffer::New(isolate, 100); 314 Local<v8::ArrayBuffer> ab2 = v8::ArrayBuffer::New(isolate, 100);
312 Handle<JSArrayBuffer> buf2 = v8::Utils::OpenHandle(*ab2); 315 Handle<JSArrayBuffer> buf2 = v8::Utils::OpenHandle(*ab2);
313 CHECK_NE(Page::FromAddress(buf1->address()), 316 CHECK_NE(Page::FromAddress(buf1->address()),
314 Page::FromAddress(buf2->address())); 317 Page::FromAddress(buf2->address()));
315 heap::GcAndSweep(heap, OLD_SPACE); 318 heap::GcAndSweep(heap, OLD_SPACE);
316 } 319 }
317 } 320 }
318 321
319 } // namespace internal 322 } // namespace internal
320 } // namespace v8 323 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/heap/heap-utils.cc ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698