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 1864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2662 i::Handle<JSFunction> f = i::Handle<JSFunction>::cast( | 2661 i::Handle<JSFunction> f = i::Handle<JSFunction>::cast( |
2663 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( | 2662 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( |
2664 CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); | 2663 CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); |
2665 | 2664 |
2666 CHECK(f->IsOptimized()); | 2665 CHECK(f->IsOptimized()); |
2667 | 2666 |
2668 while (!Marking::IsBlack(ObjectMarking::MarkBitFrom(f->code())) && | 2667 while (!Marking::IsBlack(ObjectMarking::MarkBitFrom(f->code())) && |
2669 !marking->IsStopped()) { | 2668 !marking->IsStopped()) { |
2670 // Discard any pending GC requests otherwise we will get GC when we enter | 2669 // Discard any pending GC requests otherwise we will get GC when we enter |
2671 // code below. | 2670 // code below. |
2672 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 2671 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 2672 IncrementalMarking::FORCE_COMPLETION); |
2673 } | 2673 } |
2674 | 2674 |
2675 CHECK(marking->IsMarking()); | 2675 CHECK(marking->IsMarking()); |
2676 | 2676 |
2677 { | 2677 { |
2678 v8::HandleScope scope(CcTest::isolate()); | 2678 v8::HandleScope scope(CcTest::isolate()); |
2679 v8::Local<v8::Object> global = CcTest::global(); | 2679 v8::Local<v8::Object> global = CcTest::global(); |
2680 v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast( | 2680 v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast( |
2681 global->Get(ctx, v8_str("g")).ToLocalChecked()); | 2681 global->Get(ctx, v8_str("g")).ToLocalChecked()); |
2682 g->Call(ctx, global, 0, nullptr).ToLocalChecked(); | 2682 g->Call(ctx, global, 0, nullptr).ToLocalChecked(); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2821 marking->Stop(); | 2821 marking->Stop(); |
2822 CcTest::heap()->StartIncrementalMarking(); | 2822 CcTest::heap()->StartIncrementalMarking(); |
2823 | 2823 |
2824 CHECK_EQ(CcTest::heap()->gc_count(), initial_gc_count); | 2824 CHECK_EQ(CcTest::heap()->gc_count(), initial_gc_count); |
2825 | 2825 |
2826 // TODO(hpayer): We cannot write proper unit test right now for heap. | 2826 // TODO(hpayer): We cannot write proper unit test right now for heap. |
2827 // The ideal test would call kMaxIdleMarkingDelayCounter to test the | 2827 // The ideal test would call kMaxIdleMarkingDelayCounter to test the |
2828 // marking delay counter. | 2828 // marking delay counter. |
2829 | 2829 |
2830 // Perform a huge incremental marking step but don't complete marking. | 2830 // Perform a huge incremental marking step but don't complete marking. |
2831 intptr_t bytes_processed = 0; | |
2832 do { | 2831 do { |
2833 bytes_processed = | 2832 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
2834 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 2833 IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
2835 IncrementalMarking::FORCE_MARKING, | |
2836 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | |
2837 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); | 2834 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); |
2838 } while (bytes_processed); | 2835 } while ( |
| 2836 !CcTest::heap()->mark_compact_collector()->marking_deque()->IsEmpty()); |
2839 | 2837 |
2840 // The next invocations of incremental marking are not going to complete | 2838 // The next invocations of incremental marking are not going to complete |
2841 // marking | 2839 // marking |
2842 // since the completion threshold is not reached | 2840 // since the completion threshold is not reached |
2843 for (size_t i = 0; i < IncrementalMarking::kMaxIdleMarkingDelayCounter - 2; | 2841 for (size_t i = 0; i < IncrementalMarking::kMaxIdleMarkingDelayCounter - 2; |
2844 i++) { | 2842 i++) { |
2845 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 2843 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
2846 IncrementalMarking::FORCE_MARKING, | |
2847 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | 2844 IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
2848 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); | 2845 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); |
2849 } | 2846 } |
2850 | 2847 |
2851 marking->SetWeakClosureWasOverApproximatedForTesting(true); | 2848 marking->SetWeakClosureWasOverApproximatedForTesting(true); |
2852 | 2849 |
2853 // The next idle notification has to finish incremental marking. | 2850 // The next idle notification has to finish incremental marking. |
2854 const double kLongIdleTime = 1000.0; | 2851 const double kLongIdleTime = 1000.0; |
2855 CcTest::isolate()->IdleNotificationDeadline( | 2852 CcTest::isolate()->IdleNotificationDeadline( |
2856 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / | 2853 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / |
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4590 | 4587 |
4591 // Allocate a large object. | 4588 // Allocate a large object. |
4592 int size = Max(1000000, Page::kMaxRegularHeapObjectSize + KB); | 4589 int size = Max(1000000, Page::kMaxRegularHeapObjectSize + KB); |
4593 CHECK(size > Page::kMaxRegularHeapObjectSize); | 4590 CHECK(size > Page::kMaxRegularHeapObjectSize); |
4594 Handle<FixedArray> lo = isolate->factory()->NewFixedArray(size, TENURED); | 4591 Handle<FixedArray> lo = isolate->factory()->NewFixedArray(size, TENURED); |
4595 CHECK(heap->lo_space()->Contains(*lo)); | 4592 CHECK(heap->lo_space()->Contains(*lo)); |
4596 | 4593 |
4597 // Start incremental marking to active write barrier. | 4594 // Start incremental marking to active write barrier. |
4598 heap::SimulateIncrementalMarking(heap, false); | 4595 heap::SimulateIncrementalMarking(heap, false); |
4599 heap->incremental_marking()->AdvanceIncrementalMarking( | 4596 heap->incremental_marking()->AdvanceIncrementalMarking( |
4600 10000000, IncrementalMarking::IdleStepActions()); | 4597 10000000, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 4598 IncrementalMarking::FORCE_COMPLETION); |
4601 | 4599 |
4602 // Create references from the large object to the object on the evacuation | 4600 // Create references from the large object to the object on the evacuation |
4603 // candidate. | 4601 // candidate. |
4604 const int kStep = size / 10; | 4602 const int kStep = size / 10; |
4605 for (int i = 0; i < size; i += kStep) { | 4603 for (int i = 0; i < size; i += kStep) { |
4606 lo->set(i, *lit); | 4604 lo->set(i, *lit); |
4607 CHECK(lo->get(i) == old_location); | 4605 CHECK(lo->get(i) == old_location); |
4608 } | 4606 } |
4609 | 4607 |
4610 // Move the evaucation candidate object. | 4608 // Move the evaucation candidate object. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4651 CompileRun("function f(n) {" | 4649 CompileRun("function f(n) {" |
4652 " var a = new Array(n);" | 4650 " var a = new Array(n);" |
4653 " for (var i = 0; i < n; i += 100) a[i] = i;" | 4651 " for (var i = 0; i < n; i += 100) a[i] = i;" |
4654 "};" | 4652 "};" |
4655 "f(10 * 1024 * 1024);"); | 4653 "f(10 * 1024 * 1024);"); |
4656 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); | 4654 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); |
4657 if (marking->IsStopped()) { | 4655 if (marking->IsStopped()) { |
4658 CcTest::heap()->StartIncrementalMarking(); | 4656 CcTest::heap()->StartIncrementalMarking(); |
4659 } | 4657 } |
4660 // This big step should be sufficient to mark the whole array. | 4658 // This big step should be sufficient to mark the whole array. |
4661 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 4659 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 4660 IncrementalMarking::FORCE_COMPLETION); |
4662 CHECK(marking->IsComplete() || | 4661 CHECK(marking->IsComplete() || |
4663 marking->IsReadyToOverApproximateWeakClosure()); | 4662 marking->IsReadyToOverApproximateWeakClosure()); |
4664 } | 4663 } |
4665 | 4664 |
4666 | 4665 |
4667 TEST(DisableInlineAllocation) { | 4666 TEST(DisableInlineAllocation) { |
4668 i::FLAG_allow_natives_syntax = true; | 4667 i::FLAG_allow_natives_syntax = true; |
4669 CcTest::InitializeVM(); | 4668 CcTest::InitializeVM(); |
4670 v8::HandleScope scope(CcTest::isolate()); | 4669 v8::HandleScope scope(CcTest::isolate()); |
4671 CompileRun("function test() {" | 4670 CompileRun("function test() {" |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5473 for (int i = 0; i < N; i++) { | 5472 for (int i = 0; i < N; i++) { |
5474 HandleScope inner_scope(isolate); | 5473 HandleScope inner_scope(isolate); |
5475 Handle<HeapObject> value = | 5474 Handle<HeapObject> value = |
5476 i == 0 ? survivor : factory->NewFixedArray(1, NOT_TENURED); | 5475 i == 0 ? survivor : factory->NewFixedArray(1, NOT_TENURED); |
5477 Handle<WeakCell> weak_cell = factory->NewWeakCell(value); | 5476 Handle<WeakCell> weak_cell = factory->NewWeakCell(value); |
5478 CHECK(weak_cell->value()->IsFixedArray()); | 5477 CHECK(weak_cell->value()->IsFixedArray()); |
5479 IncrementalMarking* marking = heap->incremental_marking(); | 5478 IncrementalMarking* marking = heap->incremental_marking(); |
5480 if (marking->IsStopped()) { | 5479 if (marking->IsStopped()) { |
5481 heap->StartIncrementalMarking(); | 5480 heap->StartIncrementalMarking(); |
5482 } | 5481 } |
5483 marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 5482 marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 5483 IncrementalMarking::FORCE_COMPLETION); |
5484 heap->CollectGarbage(NEW_SPACE); | 5484 heap->CollectGarbage(NEW_SPACE); |
5485 CHECK(weak_cell->value()->IsFixedArray()); | 5485 CHECK(weak_cell->value()->IsFixedArray()); |
5486 weak_cells[i] = inner_scope.CloseAndEscape(weak_cell); | 5486 weak_cells[i] = inner_scope.CloseAndEscape(weak_cell); |
5487 } | 5487 } |
5488 // Call collect all twice to make sure that we also cleared | 5488 // Call collect all twice to make sure that we also cleared |
5489 // weak cells that were allocated on black pages. | 5489 // weak cells that were allocated on black pages. |
5490 heap->CollectAllGarbage(); | 5490 heap->CollectAllGarbage(); |
5491 heap->CollectAllGarbage(); | 5491 heap->CollectAllGarbage(); |
5492 CHECK_EQ(*survivor, weak_cells[0]->value()); | 5492 CHECK_EQ(*survivor, weak_cells[0]->value()); |
5493 for (int i = 1; i < N; i++) { | 5493 for (int i = 1; i < N; i++) { |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5792 if (marking->IsStopped()) { | 5792 if (marking->IsStopped()) { |
5793 CcTest::heap()->StartIncrementalMarking(); | 5793 CcTest::heap()->StartIncrementalMarking(); |
5794 } | 5794 } |
5795 // Incrementally mark the backing store. | 5795 // Incrementally mark the backing store. |
5796 Handle<JSReceiver> obj = | 5796 Handle<JSReceiver> obj = |
5797 v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result)); | 5797 v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result)); |
5798 Handle<JSWeakCollection> weak_map(reinterpret_cast<JSWeakCollection*>(*obj)); | 5798 Handle<JSWeakCollection> weak_map(reinterpret_cast<JSWeakCollection*>(*obj)); |
5799 while (!Marking::IsBlack( | 5799 while (!Marking::IsBlack( |
5800 ObjectMarking::MarkBitFrom(HeapObject::cast(weak_map->table()))) && | 5800 ObjectMarking::MarkBitFrom(HeapObject::cast(weak_map->table()))) && |
5801 !marking->IsStopped()) { | 5801 !marking->IsStopped()) { |
5802 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 5802 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 5803 IncrementalMarking::FORCE_COMPLETION); |
5803 } | 5804 } |
5804 // Stash the backing store in a handle. | 5805 // Stash the backing store in a handle. |
5805 Handle<Object> save(weak_map->table(), isolate); | 5806 Handle<Object> save(weak_map->table(), isolate); |
5806 // The following line will update the backing store. | 5807 // The following line will update the backing store. |
5807 CompileRun( | 5808 CompileRun( |
5808 "for (var i = 0; i < 50; i++) {" | 5809 "for (var i = 0; i < 50; i++) {" |
5809 " weak_map.set(future_keys[i], i);" | 5810 " weak_map.set(future_keys[i], i);" |
5810 "}"); | 5811 "}"); |
5811 heap->incremental_marking()->set_should_hurry(true); | 5812 heap->incremental_marking()->set_should_hurry(true); |
5812 heap->CollectGarbage(OLD_SPACE); | 5813 heap->CollectGarbage(OLD_SPACE); |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6631 | 6632 |
6632 // Check that we have not marked the interesting array during root scanning. | 6633 // Check that we have not marked the interesting array during root scanning. |
6633 for (int i = 0; i < arr.get()->length(); i++) { | 6634 for (int i = 0; i < arr.get()->length(); i++) { |
6634 CHECK(Marking::IsWhite( | 6635 CHECK(Marking::IsWhite( |
6635 ObjectMarking::MarkBitFrom(HeapObject::cast(arr.get()->get(i))))); | 6636 ObjectMarking::MarkBitFrom(HeapObject::cast(arr.get()->get(i))))); |
6636 } | 6637 } |
6637 | 6638 |
6638 // Now we search for a state where we are in incremental marking and have | 6639 // Now we search for a state where we are in incremental marking and have |
6639 // only partially marked the large object. | 6640 // only partially marked the large object. |
6640 while (!marking->IsComplete()) { | 6641 while (!marking->IsComplete()) { |
6641 marking->Step(i::KB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 6642 marking->Step(i::KB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 6643 IncrementalMarking::FORCE_COMPLETION); |
6642 if (page->IsFlagSet(Page::HAS_PROGRESS_BAR) && page->progress_bar() > 0) { | 6644 if (page->IsFlagSet(Page::HAS_PROGRESS_BAR) && page->progress_bar() > 0) { |
6643 CHECK_NE(page->progress_bar(), arr.get()->Size()); | 6645 CHECK_NE(page->progress_bar(), arr.get()->Size()); |
6644 { | 6646 { |
6645 // Shift by 1, effectively moving one white object across the progress | 6647 // Shift by 1, effectively moving one white object across the progress |
6646 // bar, meaning that we will miss marking it. | 6648 // bar, meaning that we will miss marking it. |
6647 v8::HandleScope scope(CcTest::isolate()); | 6649 v8::HandleScope scope(CcTest::isolate()); |
6648 Handle<JSArray> js_array = isolate->factory()->NewJSArrayWithElements( | 6650 Handle<JSArray> js_array = isolate->factory()->NewJSArrayWithElements( |
6649 Handle<FixedArray>(arr.get())); | 6651 Handle<FixedArray>(arr.get())); |
6650 js_array->GetElementsAccessor()->Shift(js_array); | 6652 js_array->GetElementsAccessor()->Shift(js_array); |
6651 } | 6653 } |
6652 break; | 6654 break; |
6653 } | 6655 } |
6654 } | 6656 } |
6655 | 6657 |
6656 // Finish marking with bigger steps to speed up test. | 6658 // Finish marking with bigger steps to speed up test. |
6657 while (!marking->IsComplete()) { | 6659 while (!marking->IsComplete()) { |
6658 marking->Step(10 * i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 6660 marking->Step(10 * i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 6661 IncrementalMarking::FORCE_COMPLETION); |
6659 if (marking->IsReadyToOverApproximateWeakClosure()) { | 6662 if (marking->IsReadyToOverApproximateWeakClosure()) { |
6660 marking->FinalizeIncrementally(); | 6663 marking->FinalizeIncrementally(); |
6661 } | 6664 } |
6662 } | 6665 } |
6663 CHECK(marking->IsComplete()); | 6666 CHECK(marking->IsComplete()); |
6664 | 6667 |
6665 // All objects need to be black after marking. If a white object crossed the | 6668 // All objects need to be black after marking. If a white object crossed the |
6666 // progress bar, we would fail here. | 6669 // progress bar, we would fail here. |
6667 for (int i = 0; i < arr.get()->length(); i++) { | 6670 for (int i = 0; i < arr.get()->length(); i++) { |
6668 CHECK(Marking::IsBlack( | 6671 CHECK(Marking::IsBlack( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6701 heap->StartIncrementalMarking(); | 6704 heap->StartIncrementalMarking(); |
6702 } | 6705 } |
6703 CHECK(marking->IsMarking()); | 6706 CHECK(marking->IsMarking()); |
6704 marking->StartBlackAllocationForTesting(); | 6707 marking->StartBlackAllocationForTesting(); |
6705 { | 6708 { |
6706 AlwaysAllocateScope always_allocate(CcTest::i_isolate()); | 6709 AlwaysAllocateScope always_allocate(CcTest::i_isolate()); |
6707 v8::HandleScope inner(CcTest::isolate()); | 6710 v8::HandleScope inner(CcTest::isolate()); |
6708 isolate->factory()->NewFixedArray(500, TENURED)->Size(); | 6711 isolate->factory()->NewFixedArray(500, TENURED)->Size(); |
6709 } | 6712 } |
6710 while (!marking->IsComplete()) { | 6713 while (!marking->IsComplete()) { |
6711 marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 6714 marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 6715 IncrementalMarking::FORCE_COMPLETION); |
6712 if (marking->IsReadyToOverApproximateWeakClosure()) { | 6716 if (marking->IsReadyToOverApproximateWeakClosure()) { |
6713 marking->FinalizeIncrementally(); | 6717 marking->FinalizeIncrementally(); |
6714 } | 6718 } |
6715 } | 6719 } |
6716 CHECK(marking->IsComplete()); | 6720 CHECK(marking->IsComplete()); |
6717 intptr_t size_before = heap->SizeOfObjects(); | 6721 intptr_t size_before = heap->SizeOfObjects(); |
6718 CcTest::heap()->CollectAllGarbage(); | 6722 CcTest::heap()->CollectAllGarbage(); |
6719 intptr_t size_after = heap->SizeOfObjects(); | 6723 intptr_t size_after = heap->SizeOfObjects(); |
6720 // Live size does not increase after garbage collection. | 6724 // Live size does not increase after garbage collection. |
6721 CHECK_LE(size_after, size_before); | 6725 CHECK_LE(size_after, size_before); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6760 // Allocate a cons string and promote it to a fresh page in the old space. | 6764 // Allocate a cons string and promote it to a fresh page in the old space. |
6761 heap::SimulateFullSpace(heap->old_space()); | 6765 heap::SimulateFullSpace(heap->old_space()); |
6762 Handle<String> s3; | 6766 Handle<String> s3; |
6763 factory->NewConsString(s1, s2).ToHandle(&s3); | 6767 factory->NewConsString(s1, s2).ToHandle(&s3); |
6764 heap->CollectGarbage(NEW_SPACE); | 6768 heap->CollectGarbage(NEW_SPACE); |
6765 heap->CollectGarbage(NEW_SPACE); | 6769 heap->CollectGarbage(NEW_SPACE); |
6766 | 6770 |
6767 // Finish incremental marking. | 6771 // Finish incremental marking. |
6768 IncrementalMarking* marking = heap->incremental_marking(); | 6772 IncrementalMarking* marking = heap->incremental_marking(); |
6769 while (!marking->IsComplete()) { | 6773 while (!marking->IsComplete()) { |
6770 marking->Step(MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); | 6774 marking->Step(MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 6775 IncrementalMarking::FORCE_COMPLETION); |
6771 if (marking->IsReadyToOverApproximateWeakClosure()) { | 6776 if (marking->IsReadyToOverApproximateWeakClosure()) { |
6772 marking->FinalizeIncrementally(); | 6777 marking->FinalizeIncrementally(); |
6773 } | 6778 } |
6774 } | 6779 } |
6775 | 6780 |
6776 { | 6781 { |
6777 StaticOneByteResource external_string("12345678901234"); | 6782 StaticOneByteResource external_string("12345678901234"); |
6778 s3->MakeExternal(&external_string); | 6783 s3->MakeExternal(&external_string); |
6779 heap->CollectGarbage(OLD_SPACE); | 6784 heap->CollectGarbage(OLD_SPACE); |
6780 } | 6785 } |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7079 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); | 7084 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); |
7080 slots[chunk->area_end() - kPointerSize] = false; | 7085 slots[chunk->area_end() - kPointerSize] = false; |
7081 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { | 7086 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { |
7082 CHECK(slots[addr]); | 7087 CHECK(slots[addr]); |
7083 return KEEP_SLOT; | 7088 return KEEP_SLOT; |
7084 }); | 7089 }); |
7085 } | 7090 } |
7086 | 7091 |
7087 } // namespace internal | 7092 } // namespace internal |
7088 } // namespace v8 | 7093 } // namespace v8 |
OLD | NEW |