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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 heap->CollectGarbage(NEW_SPACE); | 704 heap->CollectGarbage(NEW_SPACE); |
705 | 705 |
706 CHECK(!WeakPointerCleared); | 706 CHECK(!WeakPointerCleared); |
707 | 707 |
708 // Mark-compact treats weak reference properly. | 708 // Mark-compact treats weak reference properly. |
709 heap->CollectGarbage(OLD_SPACE); | 709 heap->CollectGarbage(OLD_SPACE); |
710 | 710 |
711 CHECK(WeakPointerCleared); | 711 CHECK(WeakPointerCleared); |
712 } | 712 } |
713 | 713 |
| 714 TEST(DoNotPromoteWhiteObjectsOnScavenge) { |
| 715 CcTest::InitializeVM(); |
| 716 Isolate* isolate = CcTest::i_isolate(); |
| 717 Heap* heap = isolate->heap(); |
| 718 Factory* factory = isolate->factory(); |
| 719 |
| 720 HandleScope scope(isolate); |
| 721 Handle<Object> marked = factory->NewStringFromStaticChars("white"); |
| 722 |
| 723 IncrementalMarking* marking = heap->incremental_marking(); |
| 724 marking->Stop(); |
| 725 heap->StartIncrementalMarking(); |
| 726 |
| 727 heap->CollectGarbage(NEW_SPACE); |
| 728 |
| 729 CHECK(heap->InNewSpace(*marked)); |
| 730 } |
| 731 |
| 732 TEST(PromoteGreyOrBlackObjectsOnScavenge) { |
| 733 CcTest::InitializeVM(); |
| 734 Isolate* isolate = CcTest::i_isolate(); |
| 735 Heap* heap = isolate->heap(); |
| 736 Factory* factory = isolate->factory(); |
| 737 |
| 738 HandleScope scope(isolate); |
| 739 Handle<Object> marked = factory->NewStringFromStaticChars("marked"); |
| 740 |
| 741 IncrementalMarking* marking = heap->incremental_marking(); |
| 742 marking->Stop(); |
| 743 heap->StartIncrementalMarking(); |
| 744 while (Marking::IsWhite(Marking::MarkBitFrom(HeapObject::cast(*marked)))) { |
| 745 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 746 IncrementalMarking::FORCE_MARKING, |
| 747 IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
| 748 } |
| 749 |
| 750 heap->CollectGarbage(NEW_SPACE); |
| 751 |
| 752 CHECK(!heap->InNewSpace(*marked)); |
| 753 } |
714 | 754 |
715 TEST(BytecodeArray) { | 755 TEST(BytecodeArray) { |
716 static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; | 756 static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; |
717 static const int kRawBytesSize = sizeof(kRawBytes); | 757 static const int kRawBytesSize = sizeof(kRawBytes); |
718 static const int kFrameSize = 32; | 758 static const int kFrameSize = 32; |
719 static const int kParameterCount = 2; | 759 static const int kParameterCount = 2; |
720 | 760 |
721 i::FLAG_manual_evacuation_candidates_selection = true; | 761 i::FLAG_manual_evacuation_candidates_selection = true; |
722 CcTest::InitializeVM(); | 762 CcTest::InitializeVM(); |
723 Isolate* isolate = CcTest::i_isolate(); | 763 Isolate* isolate = CcTest::i_isolate(); |
(...skipping 5955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6679 | 6719 |
6680 intptr_t size_before = heap->SizeOfObjects(); | 6720 intptr_t size_before = heap->SizeOfObjects(); |
6681 Handle<FixedArray> array = isolate->factory()->NewFixedArray(200000); | 6721 Handle<FixedArray> array = isolate->factory()->NewFixedArray(200000); |
6682 array->Shrink(1); | 6722 array->Shrink(1); |
6683 intptr_t size_after = heap->SizeOfObjects(); | 6723 intptr_t size_after = heap->SizeOfObjects(); |
6684 CHECK_EQ(size_after, size_before + array->Size()); | 6724 CHECK_EQ(size_after, size_before + array->Size()); |
6685 } | 6725 } |
6686 | 6726 |
6687 } // namespace internal | 6727 } // namespace internal |
6688 } // namespace v8 | 6728 } // namespace v8 |
OLD | NEW |