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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 | 777 |
778 HandleScope scope(isolate); | 778 HandleScope scope(isolate); |
779 Handle<Object> marked = factory->NewStringFromStaticChars("marked"); | 779 Handle<Object> marked = factory->NewStringFromStaticChars("marked"); |
780 | 780 |
781 IncrementalMarking* marking = heap->incremental_marking(); | 781 IncrementalMarking* marking = heap->incremental_marking(); |
782 marking->Stop(); | 782 marking->Stop(); |
783 heap->StartIncrementalMarking(); | 783 heap->StartIncrementalMarking(); |
784 while ( | 784 while ( |
785 Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(*marked)))) { | 785 Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(*marked)))) { |
786 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 786 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
787 IncrementalMarking::FORCE_MARKING, | |
788 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | 787 IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
789 } | 788 } |
790 | 789 |
791 heap->CollectGarbage(NEW_SPACE); | 790 heap->CollectGarbage(NEW_SPACE); |
792 | 791 |
793 CHECK(!heap->InNewSpace(*marked)); | 792 CHECK(!heap->InNewSpace(*marked)); |
794 } | 793 } |
795 | 794 |
796 TEST(BytecodeArray) { | 795 TEST(BytecodeArray) { |
797 static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; | 796 static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; |
(...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2674 i::Handle<JSFunction> f = i::Handle<JSFunction>::cast( | 2673 i::Handle<JSFunction> f = i::Handle<JSFunction>::cast( |
2675 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( | 2674 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( |
2676 CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); | 2675 CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); |
2677 | 2676 |
2678 CHECK(f->IsOptimized()); | 2677 CHECK(f->IsOptimized()); |
2679 | 2678 |
2680 while (!Marking::IsBlack(ObjectMarking::MarkBitFrom(f->code())) && | 2679 while (!Marking::IsBlack(ObjectMarking::MarkBitFrom(f->code())) && |
2681 !marking->IsStopped()) { | 2680 !marking->IsStopped()) { |
2682 // Discard any pending GC requests otherwise we will get GC when we enter | 2681 // Discard any pending GC requests otherwise we will get GC when we enter |
2683 // code below. | 2682 // code below. |
2684 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 2683 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 2684 IncrementalMarking::FORCE_COMPLETION); |
2685 } | 2685 } |
2686 | 2686 |
2687 CHECK(marking->IsMarking()); | 2687 CHECK(marking->IsMarking()); |
2688 | 2688 |
2689 { | 2689 { |
2690 v8::HandleScope scope(CcTest::isolate()); | 2690 v8::HandleScope scope(CcTest::isolate()); |
2691 v8::Local<v8::Object> global = CcTest::global(); | 2691 v8::Local<v8::Object> global = CcTest::global(); |
2692 v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast( | 2692 v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast( |
2693 global->Get(ctx, v8_str("g")).ToLocalChecked()); | 2693 global->Get(ctx, v8_str("g")).ToLocalChecked()); |
2694 g->Call(ctx, global, 0, nullptr).ToLocalChecked(); | 2694 g->Call(ctx, global, 0, nullptr).ToLocalChecked(); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2837 marking->Stop(); | 2837 marking->Stop(); |
2838 CcTest::heap()->StartIncrementalMarking(); | 2838 CcTest::heap()->StartIncrementalMarking(); |
2839 | 2839 |
2840 CHECK_EQ(CcTest::heap()->gc_count(), initial_gc_count); | 2840 CHECK_EQ(CcTest::heap()->gc_count(), initial_gc_count); |
2841 | 2841 |
2842 // TODO(hpayer): We cannot write proper unit test right now for heap. | 2842 // TODO(hpayer): We cannot write proper unit test right now for heap. |
2843 // The ideal test would call kMaxIdleMarkingDelayCounter to test the | 2843 // The ideal test would call kMaxIdleMarkingDelayCounter to test the |
2844 // marking delay counter. | 2844 // marking delay counter. |
2845 | 2845 |
2846 // Perform a huge incremental marking step but don't complete marking. | 2846 // Perform a huge incremental marking step but don't complete marking. |
2847 intptr_t bytes_processed = 0; | |
2848 do { | 2847 do { |
2849 bytes_processed = | 2848 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
2850 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 2849 IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
2851 IncrementalMarking::FORCE_MARKING, | |
2852 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | |
2853 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); | 2850 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); |
2854 } while (bytes_processed); | 2851 } while ( |
| 2852 !CcTest::heap()->mark_compact_collector()->marking_deque()->IsEmpty()); |
2855 | 2853 |
2856 // The next invocations of incremental marking are not going to complete | 2854 // The next invocations of incremental marking are not going to complete |
2857 // marking | 2855 // marking |
2858 // since the completion threshold is not reached | 2856 // since the completion threshold is not reached |
2859 for (size_t i = 0; i < IncrementalMarking::kMaxIdleMarkingDelayCounter - 2; | 2857 for (size_t i = 0; i < IncrementalMarking::kMaxIdleMarkingDelayCounter - 2; |
2860 i++) { | 2858 i++) { |
2861 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 2859 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
2862 IncrementalMarking::FORCE_MARKING, | |
2863 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | 2860 IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
2864 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); | 2861 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); |
2865 } | 2862 } |
2866 | 2863 |
2867 marking->SetWeakClosureWasOverApproximatedForTesting(true); | 2864 marking->SetWeakClosureWasOverApproximatedForTesting(true); |
2868 | 2865 |
2869 // The next idle notification has to finish incremental marking. | 2866 // The next idle notification has to finish incremental marking. |
2870 const double kLongIdleTime = 1000.0; | 2867 const double kLongIdleTime = 1000.0; |
2871 CcTest::isolate()->IdleNotificationDeadline( | 2868 CcTest::isolate()->IdleNotificationDeadline( |
2872 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / | 2869 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / |
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4606 | 4603 |
4607 // Allocate a large object. | 4604 // Allocate a large object. |
4608 int size = Max(1000000, Page::kMaxRegularHeapObjectSize + KB); | 4605 int size = Max(1000000, Page::kMaxRegularHeapObjectSize + KB); |
4609 CHECK(size > Page::kMaxRegularHeapObjectSize); | 4606 CHECK(size > Page::kMaxRegularHeapObjectSize); |
4610 Handle<FixedArray> lo = isolate->factory()->NewFixedArray(size, TENURED); | 4607 Handle<FixedArray> lo = isolate->factory()->NewFixedArray(size, TENURED); |
4611 CHECK(heap->lo_space()->Contains(*lo)); | 4608 CHECK(heap->lo_space()->Contains(*lo)); |
4612 | 4609 |
4613 // Start incremental marking to active write barrier. | 4610 // Start incremental marking to active write barrier. |
4614 heap::SimulateIncrementalMarking(heap, false); | 4611 heap::SimulateIncrementalMarking(heap, false); |
4615 heap->incremental_marking()->AdvanceIncrementalMarking( | 4612 heap->incremental_marking()->AdvanceIncrementalMarking( |
4616 10000000, IncrementalMarking::IdleStepActions()); | 4613 10000000, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 4614 IncrementalMarking::FORCE_COMPLETION); |
4617 | 4615 |
4618 // Create references from the large object to the object on the evacuation | 4616 // Create references from the large object to the object on the evacuation |
4619 // candidate. | 4617 // candidate. |
4620 const int kStep = size / 10; | 4618 const int kStep = size / 10; |
4621 for (int i = 0; i < size; i += kStep) { | 4619 for (int i = 0; i < size; i += kStep) { |
4622 lo->set(i, *lit); | 4620 lo->set(i, *lit); |
4623 CHECK(lo->get(i) == old_location); | 4621 CHECK(lo->get(i) == old_location); |
4624 } | 4622 } |
4625 | 4623 |
4626 // Move the evaucation candidate object. | 4624 // Move the evaucation candidate object. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4667 CompileRun("function f(n) {" | 4665 CompileRun("function f(n) {" |
4668 " var a = new Array(n);" | 4666 " var a = new Array(n);" |
4669 " for (var i = 0; i < n; i += 100) a[i] = i;" | 4667 " for (var i = 0; i < n; i += 100) a[i] = i;" |
4670 "};" | 4668 "};" |
4671 "f(10 * 1024 * 1024);"); | 4669 "f(10 * 1024 * 1024);"); |
4672 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); | 4670 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); |
4673 if (marking->IsStopped()) { | 4671 if (marking->IsStopped()) { |
4674 CcTest::heap()->StartIncrementalMarking(); | 4672 CcTest::heap()->StartIncrementalMarking(); |
4675 } | 4673 } |
4676 // This big step should be sufficient to mark the whole array. | 4674 // This big step should be sufficient to mark the whole array. |
4677 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 4675 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 4676 IncrementalMarking::FORCE_COMPLETION); |
4678 CHECK(marking->IsComplete() || | 4677 CHECK(marking->IsComplete() || |
4679 marking->IsReadyToOverApproximateWeakClosure()); | 4678 marking->IsReadyToOverApproximateWeakClosure()); |
4680 } | 4679 } |
4681 | 4680 |
4682 | 4681 |
4683 TEST(DisableInlineAllocation) { | 4682 TEST(DisableInlineAllocation) { |
4684 i::FLAG_allow_natives_syntax = true; | 4683 i::FLAG_allow_natives_syntax = true; |
4685 CcTest::InitializeVM(); | 4684 CcTest::InitializeVM(); |
4686 v8::HandleScope scope(CcTest::isolate()); | 4685 v8::HandleScope scope(CcTest::isolate()); |
4687 CompileRun("function test() {" | 4686 CompileRun("function test() {" |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5489 for (int i = 0; i < N; i++) { | 5488 for (int i = 0; i < N; i++) { |
5490 HandleScope inner_scope(isolate); | 5489 HandleScope inner_scope(isolate); |
5491 Handle<HeapObject> value = | 5490 Handle<HeapObject> value = |
5492 i == 0 ? survivor : factory->NewFixedArray(1, NOT_TENURED); | 5491 i == 0 ? survivor : factory->NewFixedArray(1, NOT_TENURED); |
5493 Handle<WeakCell> weak_cell = factory->NewWeakCell(value); | 5492 Handle<WeakCell> weak_cell = factory->NewWeakCell(value); |
5494 CHECK(weak_cell->value()->IsFixedArray()); | 5493 CHECK(weak_cell->value()->IsFixedArray()); |
5495 IncrementalMarking* marking = heap->incremental_marking(); | 5494 IncrementalMarking* marking = heap->incremental_marking(); |
5496 if (marking->IsStopped()) { | 5495 if (marking->IsStopped()) { |
5497 heap->StartIncrementalMarking(); | 5496 heap->StartIncrementalMarking(); |
5498 } | 5497 } |
5499 marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 5498 marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 5499 IncrementalMarking::FORCE_COMPLETION); |
5500 heap->CollectGarbage(NEW_SPACE); | 5500 heap->CollectGarbage(NEW_SPACE); |
5501 CHECK(weak_cell->value()->IsFixedArray()); | 5501 CHECK(weak_cell->value()->IsFixedArray()); |
5502 weak_cells[i] = inner_scope.CloseAndEscape(weak_cell); | 5502 weak_cells[i] = inner_scope.CloseAndEscape(weak_cell); |
5503 } | 5503 } |
5504 // Call collect all twice to make sure that we also cleared | 5504 // Call collect all twice to make sure that we also cleared |
5505 // weak cells that were allocated on black pages. | 5505 // weak cells that were allocated on black pages. |
5506 heap->CollectAllGarbage(); | 5506 heap->CollectAllGarbage(); |
5507 heap->CollectAllGarbage(); | 5507 heap->CollectAllGarbage(); |
5508 CHECK_EQ(*survivor, weak_cells[0]->value()); | 5508 CHECK_EQ(*survivor, weak_cells[0]->value()); |
5509 for (int i = 1; i < N; i++) { | 5509 for (int i = 1; i < N; i++) { |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5808 if (marking->IsStopped()) { | 5808 if (marking->IsStopped()) { |
5809 CcTest::heap()->StartIncrementalMarking(); | 5809 CcTest::heap()->StartIncrementalMarking(); |
5810 } | 5810 } |
5811 // Incrementally mark the backing store. | 5811 // Incrementally mark the backing store. |
5812 Handle<JSReceiver> obj = | 5812 Handle<JSReceiver> obj = |
5813 v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result)); | 5813 v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result)); |
5814 Handle<JSWeakCollection> weak_map(reinterpret_cast<JSWeakCollection*>(*obj)); | 5814 Handle<JSWeakCollection> weak_map(reinterpret_cast<JSWeakCollection*>(*obj)); |
5815 while (!Marking::IsBlack( | 5815 while (!Marking::IsBlack( |
5816 ObjectMarking::MarkBitFrom(HeapObject::cast(weak_map->table()))) && | 5816 ObjectMarking::MarkBitFrom(HeapObject::cast(weak_map->table()))) && |
5817 !marking->IsStopped()) { | 5817 !marking->IsStopped()) { |
5818 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 5818 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 5819 IncrementalMarking::FORCE_COMPLETION); |
5819 } | 5820 } |
5820 // Stash the backing store in a handle. | 5821 // Stash the backing store in a handle. |
5821 Handle<Object> save(weak_map->table(), isolate); | 5822 Handle<Object> save(weak_map->table(), isolate); |
5822 // The following line will update the backing store. | 5823 // The following line will update the backing store. |
5823 CompileRun( | 5824 CompileRun( |
5824 "for (var i = 0; i < 50; i++) {" | 5825 "for (var i = 0; i < 50; i++) {" |
5825 " weak_map.set(future_keys[i], i);" | 5826 " weak_map.set(future_keys[i], i);" |
5826 "}"); | 5827 "}"); |
5827 heap->incremental_marking()->set_should_hurry(true); | 5828 heap->incremental_marking()->set_should_hurry(true); |
5828 heap->CollectGarbage(OLD_SPACE); | 5829 heap->CollectGarbage(OLD_SPACE); |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6647 | 6648 |
6648 // Check that we have not marked the interesting array during root scanning. | 6649 // Check that we have not marked the interesting array during root scanning. |
6649 for (int i = 0; i < arr.get()->length(); i++) { | 6650 for (int i = 0; i < arr.get()->length(); i++) { |
6650 CHECK(Marking::IsWhite( | 6651 CHECK(Marking::IsWhite( |
6651 ObjectMarking::MarkBitFrom(HeapObject::cast(arr.get()->get(i))))); | 6652 ObjectMarking::MarkBitFrom(HeapObject::cast(arr.get()->get(i))))); |
6652 } | 6653 } |
6653 | 6654 |
6654 // Now we search for a state where we are in incremental marking and have | 6655 // Now we search for a state where we are in incremental marking and have |
6655 // only partially marked the large object. | 6656 // only partially marked the large object. |
6656 while (!marking->IsComplete()) { | 6657 while (!marking->IsComplete()) { |
6657 marking->Step(i::KB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 6658 marking->Step(i::KB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 6659 IncrementalMarking::FORCE_COMPLETION); |
6658 if (page->IsFlagSet(Page::HAS_PROGRESS_BAR) && page->progress_bar() > 0) { | 6660 if (page->IsFlagSet(Page::HAS_PROGRESS_BAR) && page->progress_bar() > 0) { |
6659 CHECK_NE(page->progress_bar(), arr.get()->Size()); | 6661 CHECK_NE(page->progress_bar(), arr.get()->Size()); |
6660 { | 6662 { |
6661 // Shift by 1, effectively moving one white object across the progress | 6663 // Shift by 1, effectively moving one white object across the progress |
6662 // bar, meaning that we will miss marking it. | 6664 // bar, meaning that we will miss marking it. |
6663 v8::HandleScope scope(CcTest::isolate()); | 6665 v8::HandleScope scope(CcTest::isolate()); |
6664 Handle<JSArray> js_array = isolate->factory()->NewJSArrayWithElements( | 6666 Handle<JSArray> js_array = isolate->factory()->NewJSArrayWithElements( |
6665 Handle<FixedArray>(arr.get())); | 6667 Handle<FixedArray>(arr.get())); |
6666 js_array->GetElementsAccessor()->Shift(js_array); | 6668 js_array->GetElementsAccessor()->Shift(js_array); |
6667 } | 6669 } |
6668 break; | 6670 break; |
6669 } | 6671 } |
6670 } | 6672 } |
6671 | 6673 |
6672 // Finish marking with bigger steps to speed up test. | 6674 // Finish marking with bigger steps to speed up test. |
6673 while (!marking->IsComplete()) { | 6675 while (!marking->IsComplete()) { |
6674 marking->Step(10 * i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 6676 marking->Step(10 * i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 6677 IncrementalMarking::FORCE_COMPLETION); |
6675 if (marking->IsReadyToOverApproximateWeakClosure()) { | 6678 if (marking->IsReadyToOverApproximateWeakClosure()) { |
6676 marking->FinalizeIncrementally(); | 6679 marking->FinalizeIncrementally(); |
6677 } | 6680 } |
6678 } | 6681 } |
6679 CHECK(marking->IsComplete()); | 6682 CHECK(marking->IsComplete()); |
6680 | 6683 |
6681 // All objects need to be black after marking. If a white object crossed the | 6684 // All objects need to be black after marking. If a white object crossed the |
6682 // progress bar, we would fail here. | 6685 // progress bar, we would fail here. |
6683 for (int i = 0; i < arr.get()->length(); i++) { | 6686 for (int i = 0; i < arr.get()->length(); i++) { |
6684 CHECK(Marking::IsBlack( | 6687 CHECK(Marking::IsBlack( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6717 heap->StartIncrementalMarking(); | 6720 heap->StartIncrementalMarking(); |
6718 } | 6721 } |
6719 CHECK(marking->IsMarking()); | 6722 CHECK(marking->IsMarking()); |
6720 marking->StartBlackAllocationForTesting(); | 6723 marking->StartBlackAllocationForTesting(); |
6721 { | 6724 { |
6722 AlwaysAllocateScope always_allocate(CcTest::i_isolate()); | 6725 AlwaysAllocateScope always_allocate(CcTest::i_isolate()); |
6723 v8::HandleScope inner(CcTest::isolate()); | 6726 v8::HandleScope inner(CcTest::isolate()); |
6724 isolate->factory()->NewFixedArray(500, TENURED)->Size(); | 6727 isolate->factory()->NewFixedArray(500, TENURED)->Size(); |
6725 } | 6728 } |
6726 while (!marking->IsComplete()) { | 6729 while (!marking->IsComplete()) { |
6727 marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 6730 marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 6731 IncrementalMarking::FORCE_COMPLETION); |
6728 if (marking->IsReadyToOverApproximateWeakClosure()) { | 6732 if (marking->IsReadyToOverApproximateWeakClosure()) { |
6729 marking->FinalizeIncrementally(); | 6733 marking->FinalizeIncrementally(); |
6730 } | 6734 } |
6731 } | 6735 } |
6732 CHECK(marking->IsComplete()); | 6736 CHECK(marking->IsComplete()); |
6733 intptr_t size_before = heap->SizeOfObjects(); | 6737 intptr_t size_before = heap->SizeOfObjects(); |
6734 CcTest::heap()->CollectAllGarbage(); | 6738 CcTest::heap()->CollectAllGarbage(); |
6735 intptr_t size_after = heap->SizeOfObjects(); | 6739 intptr_t size_after = heap->SizeOfObjects(); |
6736 // Live size does not increase after garbage collection. | 6740 // Live size does not increase after garbage collection. |
6737 CHECK_LE(size_after, size_before); | 6741 CHECK_LE(size_after, size_before); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6776 // Allocate a cons string and promote it to a fresh page in the old space. | 6780 // Allocate a cons string and promote it to a fresh page in the old space. |
6777 heap::SimulateFullSpace(heap->old_space()); | 6781 heap::SimulateFullSpace(heap->old_space()); |
6778 Handle<String> s3; | 6782 Handle<String> s3; |
6779 factory->NewConsString(s1, s2).ToHandle(&s3); | 6783 factory->NewConsString(s1, s2).ToHandle(&s3); |
6780 heap->CollectGarbage(NEW_SPACE); | 6784 heap->CollectGarbage(NEW_SPACE); |
6781 heap->CollectGarbage(NEW_SPACE); | 6785 heap->CollectGarbage(NEW_SPACE); |
6782 | 6786 |
6783 // Finish incremental marking. | 6787 // Finish incremental marking. |
6784 IncrementalMarking* marking = heap->incremental_marking(); | 6788 IncrementalMarking* marking = heap->incremental_marking(); |
6785 while (!marking->IsComplete()) { | 6789 while (!marking->IsComplete()) { |
6786 marking->Step(MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 6790 marking->Step(MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 6791 IncrementalMarking::FORCE_COMPLETION); |
6787 if (marking->IsReadyToOverApproximateWeakClosure()) { | 6792 if (marking->IsReadyToOverApproximateWeakClosure()) { |
6788 marking->FinalizeIncrementally(); | 6793 marking->FinalizeIncrementally(); |
6789 } | 6794 } |
6790 } | 6795 } |
6791 | 6796 |
6792 { | 6797 { |
6793 StaticOneByteResource external_string("12345678901234"); | 6798 StaticOneByteResource external_string("12345678901234"); |
6794 s3->MakeExternal(&external_string); | 6799 s3->MakeExternal(&external_string); |
6795 heap->CollectGarbage(OLD_SPACE); | 6800 heap->CollectGarbage(OLD_SPACE); |
6796 } | 6801 } |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7095 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); | 7100 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); |
7096 slots[chunk->area_end() - kPointerSize] = false; | 7101 slots[chunk->area_end() - kPointerSize] = false; |
7097 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { | 7102 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { |
7098 CHECK(slots[addr]); | 7103 CHECK(slots[addr]); |
7099 return KEEP_SLOT; | 7104 return KEEP_SLOT; |
7100 }); | 7105 }); |
7101 } | 7106 } |
7102 | 7107 |
7103 } // namespace internal | 7108 } // namespace internal |
7104 } // namespace v8 | 7109 } // namespace v8 |
OLD | NEW |