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/heap/array-buffer-tracker.h" | 5 #include "src/heap/array-buffer-tracker.h" |
6 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
7 #include "test/cctest/heap/heap-utils.h" | 7 #include "test/cctest/heap/heap-utils.h" |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 heap::GcAndSweep(heap, OLD_SPACE); | 285 heap::GcAndSweep(heap, OLD_SPACE); |
286 CHECK(IsTracked(JSArrayBuffer::cast(root->get(0)))); | 286 CHECK(IsTracked(JSArrayBuffer::cast(root->get(0)))); |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 UNINITIALIZED_TEST(ArrayBuffer_SemiSpaceCopyMultipleTasks) { | 290 UNINITIALIZED_TEST(ArrayBuffer_SemiSpaceCopyMultipleTasks) { |
291 if (FLAG_optimize_for_size) return; | 291 if (FLAG_optimize_for_size) return; |
292 // Test allocates JSArrayBuffer on different pages before triggering a | 292 // Test allocates JSArrayBuffer on different pages before triggering a |
293 // full GC that performs the semispace copy. If parallelized, this test | 293 // full GC that performs the semispace copy. If parallelized, this test |
294 // ensures proper synchronization in TSAN configurations. | 294 // ensures proper synchronization in TSAN configurations. |
295 FLAG_min_semi_space_size = 2; | 295 FLAG_min_semi_space_size = 2 * Page::kPageSize / MB; |
296 v8::Isolate::CreateParams create_params; | 296 v8::Isolate::CreateParams create_params; |
297 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); | 297 create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); |
298 v8::Isolate* isolate = v8::Isolate::New(create_params); | 298 v8::Isolate* isolate = v8::Isolate::New(create_params); |
299 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 299 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
300 { | 300 { |
301 v8::Isolate::Scope isolate_scope(isolate); | 301 v8::Isolate::Scope isolate_scope(isolate); |
302 v8::HandleScope handle_scope(isolate); | 302 v8::HandleScope handle_scope(isolate); |
303 v8::Context::New(isolate)->Enter(); | 303 v8::Context::New(isolate)->Enter(); |
304 Heap* heap = i_isolate->heap(); | 304 Heap* heap = i_isolate->heap(); |
305 | 305 |
306 Local<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::New(isolate, 100); | 306 Local<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::New(isolate, 100); |
307 Handle<JSArrayBuffer> buf1 = v8::Utils::OpenHandle(*ab1); | 307 Handle<JSArrayBuffer> buf1 = v8::Utils::OpenHandle(*ab1); |
308 heap::FillCurrentPage(heap->new_space()); | 308 heap::FillCurrentPage(heap->new_space()); |
309 Local<v8::ArrayBuffer> ab2 = v8::ArrayBuffer::New(isolate, 100); | 309 Local<v8::ArrayBuffer> ab2 = v8::ArrayBuffer::New(isolate, 100); |
310 Handle<JSArrayBuffer> buf2 = v8::Utils::OpenHandle(*ab2); | 310 Handle<JSArrayBuffer> buf2 = v8::Utils::OpenHandle(*ab2); |
311 CHECK_NE(Page::FromAddress(buf1->address()), | 311 CHECK_NE(Page::FromAddress(buf1->address()), |
312 Page::FromAddress(buf2->address())); | 312 Page::FromAddress(buf2->address())); |
313 heap::GcAndSweep(heap, OLD_SPACE); | 313 heap::GcAndSweep(heap, OLD_SPACE); |
314 } | 314 } |
315 } | 315 } |
316 | 316 |
317 } // namespace internal | 317 } // namespace internal |
318 } // namespace v8 | 318 } // namespace v8 |
OLD | NEW |