| 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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 CcTest::CollectGarbage(NEW_SPACE); | 742 CcTest::CollectGarbage(NEW_SPACE); |
| 743 | 743 |
| 744 CHECK(!WeakPointerCleared); | 744 CHECK(!WeakPointerCleared); |
| 745 | 745 |
| 746 // Mark-compact treats weak reference properly. | 746 // Mark-compact treats weak reference properly. |
| 747 CcTest::CollectGarbage(OLD_SPACE); | 747 CcTest::CollectGarbage(OLD_SPACE); |
| 748 | 748 |
| 749 CHECK(WeakPointerCleared); | 749 CHECK(WeakPointerCleared); |
| 750 } | 750 } |
| 751 | 751 |
| 752 TEST(DoNotPromoteWhiteObjectsOnScavenge) { | |
| 753 CcTest::InitializeVM(); | |
| 754 Isolate* isolate = CcTest::i_isolate(); | |
| 755 Heap* heap = isolate->heap(); | |
| 756 Factory* factory = isolate->factory(); | |
| 757 | |
| 758 HandleScope scope(isolate); | |
| 759 Handle<Object> white = factory->NewStringFromStaticChars("white"); | |
| 760 | |
| 761 CHECK(Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(*white)))); | |
| 762 | |
| 763 CcTest::CollectGarbage(NEW_SPACE); | |
| 764 | |
| 765 CHECK(heap->InNewSpace(*white)); | |
| 766 } | |
| 767 | |
| 768 TEST(PromoteGreyOrBlackObjectsOnScavenge) { | |
| 769 CcTest::InitializeVM(); | |
| 770 Isolate* isolate = CcTest::i_isolate(); | |
| 771 Heap* heap = isolate->heap(); | |
| 772 Factory* factory = isolate->factory(); | |
| 773 | |
| 774 HandleScope scope(isolate); | |
| 775 Handle<Object> marked = factory->NewStringFromStaticChars("marked"); | |
| 776 | |
| 777 IncrementalMarking* marking = heap->incremental_marking(); | |
| 778 marking->Stop(); | |
| 779 heap->StartIncrementalMarking(i::Heap::kNoGCFlags, | |
| 780 i::GarbageCollectionReason::kTesting); | |
| 781 while ( | |
| 782 Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(*marked)))) { | |
| 783 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | |
| 784 IncrementalMarking::DO_NOT_FORCE_COMPLETION, StepOrigin::kV8); | |
| 785 } | |
| 786 | |
| 787 CcTest::CollectGarbage(NEW_SPACE); | |
| 788 | |
| 789 CHECK(!heap->InNewSpace(*marked)); | |
| 790 } | |
| 791 | |
| 792 TEST(BytecodeArray) { | 752 TEST(BytecodeArray) { |
| 793 static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; | 753 static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; |
| 794 static const int kRawBytesSize = sizeof(kRawBytes); | 754 static const int kRawBytesSize = sizeof(kRawBytes); |
| 795 static const int kFrameSize = 32; | 755 static const int kFrameSize = 32; |
| 796 static const int kParameterCount = 2; | 756 static const int kParameterCount = 2; |
| 797 | 757 |
| 798 i::FLAG_manual_evacuation_candidates_selection = true; | 758 i::FLAG_manual_evacuation_candidates_selection = true; |
| 799 CcTest::InitializeVM(); | 759 CcTest::InitializeVM(); |
| 800 Isolate* isolate = CcTest::i_isolate(); | 760 Isolate* isolate = CcTest::i_isolate(); |
| 801 Heap* heap = isolate->heap(); | 761 Heap* heap = isolate->heap(); |
| (...skipping 6303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7105 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); | 7065 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); |
| 7106 slots[chunk->area_end() - kPointerSize] = false; | 7066 slots[chunk->area_end() - kPointerSize] = false; |
| 7107 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { | 7067 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { |
| 7108 CHECK(slots[addr]); | 7068 CHECK(slots[addr]); |
| 7109 return KEEP_SLOT; | 7069 return KEEP_SLOT; |
| 7110 }); | 7070 }); |
| 7111 } | 7071 } |
| 7112 | 7072 |
| 7113 } // namespace internal | 7073 } // namespace internal |
| 7114 } // namespace v8 | 7074 } // namespace v8 |
| OLD | NEW |