Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 #include <sys/types.h> | 34 #include <sys/types.h> |
| 35 #include <unistd.h> | 35 #include <unistd.h> |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 #include <utility> | 38 #include <utility> |
| 39 | 39 |
| 40 #include "src/v8.h" | 40 #include "src/v8.h" |
| 41 | 41 |
| 42 #include "src/full-codegen/full-codegen.h" | 42 #include "src/full-codegen/full-codegen.h" |
| 43 #include "src/global-handles.h" | 43 #include "src/global-handles.h" |
| 44 #include "src/heap/concurrent-marking-deque.h" | |
| 44 #include "src/heap/mark-compact-inl.h" | 45 #include "src/heap/mark-compact-inl.h" |
| 45 #include "src/heap/mark-compact.h" | 46 #include "src/heap/mark-compact.h" |
| 47 #include "src/heap/sequential-marking-deque.h" | |
| 46 #include "src/objects-inl.h" | 48 #include "src/objects-inl.h" |
| 47 #include "test/cctest/cctest.h" | 49 #include "test/cctest/cctest.h" |
| 48 #include "test/cctest/heap/heap-tester.h" | 50 #include "test/cctest/heap/heap-tester.h" |
| 49 #include "test/cctest/heap/heap-utils.h" | 51 #include "test/cctest/heap/heap-utils.h" |
| 50 | 52 |
| 51 using namespace v8::internal; | 53 using namespace v8::internal; |
| 52 using v8::Just; | 54 using v8::Just; |
| 53 | 55 |
| 56 TEST(ConcurrentMarkingDeque) { | |
|
Michael Lippautz
2017/05/02 09:39:31
nit: Could be a unit test.
ulan
2017/05/02 13:19:53
Done. Converted it to unit test.
| |
| 57 CcTest::InitializeVM(); | |
| 58 Isolate* isolate = CcTest::i_isolate(); | |
| 59 ConcurrentMarkingDeque marking_deque(isolate->heap()); | |
| 60 v8::HandleScope sc(CcTest::isolate()); | |
| 61 Handle<FixedArray> object = isolate->factory()->NewFixedArray(10); | |
| 62 marking_deque.Push(*object); | |
| 63 CHECK(!marking_deque.IsEmpty()); | |
| 64 CHECK_EQ(1, marking_deque.Size()); | |
| 65 CHECK_EQ(*object, marking_deque.Pop(MarkingThread::kConcurrent)); | |
| 66 CHECK(marking_deque.IsEmpty()); | |
| 67 marking_deque.Push(*object, MarkingThread::kConcurrent, | |
| 68 TargetDeque::kBailout); | |
| 69 CHECK(!marking_deque.IsEmpty()); | |
| 70 CHECK_EQ(1, marking_deque.Size()); | |
| 71 CHECK(nullptr == marking_deque.Pop(MarkingThread::kConcurrent)); | |
| 72 CHECK_EQ(*object, marking_deque.Pop()); | |
| 73 CHECK(nullptr == marking_deque.Pop()); | |
| 74 } | |
| 54 | 75 |
| 55 TEST(MarkingDeque) { | 76 TEST(SequentialMarkingDeque) { |
|
Michael Lippautz
2017/05/02 09:39:31
nit: Similarly, this could also be a unit test.
ulan
2017/05/02 13:19:53
I am keeping it here because it depends on cancela
| |
| 56 CcTest::InitializeVM(); | 77 CcTest::InitializeVM(); |
| 57 MarkingDeque s(CcTest::i_isolate()->heap()); | 78 SequentialMarkingDeque s(CcTest::i_isolate()->heap()); |
| 58 s.SetUp(); | 79 s.SetUp(); |
| 59 s.StartUsing(); | 80 s.StartUsing(); |
| 60 Address original_address = reinterpret_cast<Address>(&s); | 81 Address original_address = reinterpret_cast<Address>(&s); |
| 61 Address current_address = original_address; | 82 Address current_address = original_address; |
| 62 while (!s.IsFull()) { | 83 while (!s.IsFull()) { |
| 63 s.Push(HeapObject::FromAddress(current_address)); | 84 s.Push(HeapObject::FromAddress(current_address)); |
| 64 current_address += kPointerSize; | 85 current_address += kPointerSize; |
| 65 } | 86 } |
| 66 | 87 |
| 67 while (!s.IsEmpty()) { | 88 while (!s.IsEmpty()) { |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 heap->old_space()->EmptyAllocationInfo(); | 377 heap->old_space()->EmptyAllocationInfo(); |
| 357 Page* page = Page::FromAddress(array->address()); | 378 Page* page = Page::FromAddress(array->address()); |
| 358 LiveObjectIterator<kGreyObjects> it(page, MarkingState::Internal(page)); | 379 LiveObjectIterator<kGreyObjects> it(page, MarkingState::Internal(page)); |
| 359 HeapObject* object = nullptr; | 380 HeapObject* object = nullptr; |
| 360 while ((object = it.Next()) != nullptr) { | 381 while ((object = it.Next()) != nullptr) { |
| 361 CHECK(!object->IsFiller()); | 382 CHECK(!object->IsFiller()); |
| 362 } | 383 } |
| 363 } | 384 } |
| 364 | 385 |
| 365 #endif // __linux__ and !USE_SIMULATOR | 386 #endif // __linux__ and !USE_SIMULATOR |
| OLD | NEW |