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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 HandleScope scope(isolate); | 774 HandleScope scope(isolate); |
775 Handle<Object> marked = factory->NewStringFromStaticChars("marked"); | 775 Handle<Object> marked = factory->NewStringFromStaticChars("marked"); |
776 | 776 |
777 IncrementalMarking* marking = heap->incremental_marking(); | 777 IncrementalMarking* marking = heap->incremental_marking(); |
778 marking->Stop(); | 778 marking->Stop(); |
779 heap->StartIncrementalMarking(i::Heap::kNoGCFlags, | 779 heap->StartIncrementalMarking(i::Heap::kNoGCFlags, |
780 i::GarbageCollectionReason::kTesting); | 780 i::GarbageCollectionReason::kTesting); |
781 while ( | 781 while ( |
782 Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(*marked)))) { | 782 Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(*marked)))) { |
783 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 783 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
784 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | 784 IncrementalMarking::DO_NOT_FORCE_COMPLETION, StepOrigin::kV8); |
785 } | 785 } |
786 | 786 |
787 CcTest::CollectGarbage(NEW_SPACE); | 787 CcTest::CollectGarbage(NEW_SPACE); |
788 | 788 |
789 CHECK(!heap->InNewSpace(*marked)); | 789 CHECK(!heap->InNewSpace(*marked)); |
790 } | 790 } |
791 | 791 |
792 TEST(BytecodeArray) { | 792 TEST(BytecodeArray) { |
793 static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; | 793 static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; |
794 static const int kRawBytesSize = sizeof(kRawBytes); | 794 static const int kRawBytesSize = sizeof(kRawBytes); |
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2684 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( | 2684 v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( |
2685 CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); | 2685 CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked()))); |
2686 | 2686 |
2687 CHECK(f->IsOptimized()); | 2687 CHECK(f->IsOptimized()); |
2688 | 2688 |
2689 while (!Marking::IsBlack(ObjectMarking::MarkBitFrom(f->code())) && | 2689 while (!Marking::IsBlack(ObjectMarking::MarkBitFrom(f->code())) && |
2690 !marking->IsStopped()) { | 2690 !marking->IsStopped()) { |
2691 // Discard any pending GC requests otherwise we will get GC when we enter | 2691 // Discard any pending GC requests otherwise we will get GC when we enter |
2692 // code below. | 2692 // code below. |
2693 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 2693 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
2694 IncrementalMarking::FORCE_COMPLETION); | 2694 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); |
2695 } | 2695 } |
2696 | 2696 |
2697 CHECK(marking->IsMarking()); | 2697 CHECK(marking->IsMarking()); |
2698 | 2698 |
2699 { | 2699 { |
2700 v8::HandleScope scope(CcTest::isolate()); | 2700 v8::HandleScope scope(CcTest::isolate()); |
2701 v8::Local<v8::Object> global = CcTest::global(); | 2701 v8::Local<v8::Object> global = CcTest::global(); |
2702 v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast( | 2702 v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast( |
2703 global->Get(ctx, v8_str("g")).ToLocalChecked()); | 2703 global->Get(ctx, v8_str("g")).ToLocalChecked()); |
2704 g->Call(ctx, global, 0, nullptr).ToLocalChecked(); | 2704 g->Call(ctx, global, 0, nullptr).ToLocalChecked(); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2852 | 2852 |
2853 CHECK_EQ(CcTest::heap()->gc_count(), initial_gc_count); | 2853 CHECK_EQ(CcTest::heap()->gc_count(), initial_gc_count); |
2854 | 2854 |
2855 // TODO(hpayer): We cannot write proper unit test right now for heap. | 2855 // TODO(hpayer): We cannot write proper unit test right now for heap. |
2856 // The ideal test would call kMaxIdleMarkingDelayCounter to test the | 2856 // The ideal test would call kMaxIdleMarkingDelayCounter to test the |
2857 // marking delay counter. | 2857 // marking delay counter. |
2858 | 2858 |
2859 // Perform a huge incremental marking step but don't complete marking. | 2859 // Perform a huge incremental marking step but don't complete marking. |
2860 do { | 2860 do { |
2861 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 2861 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
2862 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | 2862 IncrementalMarking::DO_NOT_FORCE_COMPLETION, StepOrigin::kV8); |
2863 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); | 2863 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); |
2864 } while ( | 2864 } while ( |
2865 !CcTest::heap()->mark_compact_collector()->marking_deque()->IsEmpty()); | 2865 !CcTest::heap()->mark_compact_collector()->marking_deque()->IsEmpty()); |
2866 | 2866 |
2867 // The next invocations of incremental marking are not going to complete | 2867 // The next invocations of incremental marking are not going to complete |
2868 // marking | 2868 // marking |
2869 // since the completion threshold is not reached | 2869 // since the completion threshold is not reached |
2870 for (size_t i = 0; i < IncrementalMarking::kMaxIdleMarkingDelayCounter - 2; | 2870 for (size_t i = 0; i < IncrementalMarking::kMaxIdleMarkingDelayCounter - 2; |
2871 i++) { | 2871 i++) { |
2872 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 2872 marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
2873 IncrementalMarking::DO_NOT_FORCE_COMPLETION); | 2873 IncrementalMarking::DO_NOT_FORCE_COMPLETION, StepOrigin::kV8); |
2874 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); | 2874 CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); |
2875 } | 2875 } |
2876 | 2876 |
2877 marking->SetWeakClosureWasOverApproximatedForTesting(true); | 2877 marking->SetWeakClosureWasOverApproximatedForTesting(true); |
2878 | 2878 |
2879 // The next idle notification has to finish incremental marking. | 2879 // The next idle notification has to finish incremental marking. |
2880 const double kLongIdleTime = 1000.0; | 2880 const double kLongIdleTime = 1000.0; |
2881 CcTest::isolate()->IdleNotificationDeadline( | 2881 CcTest::isolate()->IdleNotificationDeadline( |
2882 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / | 2882 (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / |
2883 static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) + | 2883 static_cast<double>(v8::base::Time::kMicrosecondsPerSecond)) + |
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4617 // Allocate a large object. | 4617 // Allocate a large object. |
4618 int size = Max(1000000, kMaxRegularHeapObjectSize + KB); | 4618 int size = Max(1000000, kMaxRegularHeapObjectSize + KB); |
4619 CHECK(size > kMaxRegularHeapObjectSize); | 4619 CHECK(size > kMaxRegularHeapObjectSize); |
4620 Handle<FixedArray> lo = isolate->factory()->NewFixedArray(size, TENURED); | 4620 Handle<FixedArray> lo = isolate->factory()->NewFixedArray(size, TENURED); |
4621 CHECK(heap->lo_space()->Contains(*lo)); | 4621 CHECK(heap->lo_space()->Contains(*lo)); |
4622 | 4622 |
4623 // Start incremental marking to active write barrier. | 4623 // Start incremental marking to active write barrier. |
4624 heap::SimulateIncrementalMarking(heap, false); | 4624 heap::SimulateIncrementalMarking(heap, false); |
4625 heap->incremental_marking()->AdvanceIncrementalMarking( | 4625 heap->incremental_marking()->AdvanceIncrementalMarking( |
4626 10000000, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 4626 10000000, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
4627 IncrementalMarking::FORCE_COMPLETION); | 4627 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); |
4628 | 4628 |
4629 // Create references from the large object to the object on the evacuation | 4629 // Create references from the large object to the object on the evacuation |
4630 // candidate. | 4630 // candidate. |
4631 const int kStep = size / 10; | 4631 const int kStep = size / 10; |
4632 for (int i = 0; i < size; i += kStep) { | 4632 for (int i = 0; i < size; i += kStep) { |
4633 lo->set(i, *lit); | 4633 lo->set(i, *lit); |
4634 CHECK(lo->get(i) == old_location); | 4634 CHECK(lo->get(i) == old_location); |
4635 } | 4635 } |
4636 | 4636 |
4637 // Move the evaucation candidate object. | 4637 // Move the evaucation candidate object. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4680 " for (var i = 0; i < n; i += 100) a[i] = i;" | 4680 " for (var i = 0; i < n; i += 100) a[i] = i;" |
4681 "};" | 4681 "};" |
4682 "f(10 * 1024 * 1024);"); | 4682 "f(10 * 1024 * 1024);"); |
4683 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); | 4683 IncrementalMarking* marking = CcTest::heap()->incremental_marking(); |
4684 if (marking->IsStopped()) { | 4684 if (marking->IsStopped()) { |
4685 CcTest::heap()->StartIncrementalMarking( | 4685 CcTest::heap()->StartIncrementalMarking( |
4686 i::Heap::kNoGCFlags, i::GarbageCollectionReason::kTesting); | 4686 i::Heap::kNoGCFlags, i::GarbageCollectionReason::kTesting); |
4687 } | 4687 } |
4688 // This big step should be sufficient to mark the whole array. | 4688 // This big step should be sufficient to mark the whole array. |
4689 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 4689 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
4690 IncrementalMarking::FORCE_COMPLETION); | 4690 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); |
4691 CHECK(marking->IsComplete() || | 4691 CHECK(marking->IsComplete() || |
4692 marking->IsReadyToOverApproximateWeakClosure()); | 4692 marking->IsReadyToOverApproximateWeakClosure()); |
4693 } | 4693 } |
4694 | 4694 |
4695 | 4695 |
4696 TEST(DisableInlineAllocation) { | 4696 TEST(DisableInlineAllocation) { |
4697 i::FLAG_allow_natives_syntax = true; | 4697 i::FLAG_allow_natives_syntax = true; |
4698 CcTest::InitializeVM(); | 4698 CcTest::InitializeVM(); |
4699 v8::HandleScope scope(CcTest::isolate()); | 4699 v8::HandleScope scope(CcTest::isolate()); |
4700 CompileRun("function test() {" | 4700 CompileRun("function test() {" |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5499 Handle<HeapObject> value = | 5499 Handle<HeapObject> value = |
5500 i == 0 ? survivor : factory->NewFixedArray(1, NOT_TENURED); | 5500 i == 0 ? survivor : factory->NewFixedArray(1, NOT_TENURED); |
5501 Handle<WeakCell> weak_cell = factory->NewWeakCell(value); | 5501 Handle<WeakCell> weak_cell = factory->NewWeakCell(value); |
5502 CHECK(weak_cell->value()->IsFixedArray()); | 5502 CHECK(weak_cell->value()->IsFixedArray()); |
5503 IncrementalMarking* marking = heap->incremental_marking(); | 5503 IncrementalMarking* marking = heap->incremental_marking(); |
5504 if (marking->IsStopped()) { | 5504 if (marking->IsStopped()) { |
5505 heap->StartIncrementalMarking(i::Heap::kNoGCFlags, | 5505 heap->StartIncrementalMarking(i::Heap::kNoGCFlags, |
5506 i::GarbageCollectionReason::kTesting); | 5506 i::GarbageCollectionReason::kTesting); |
5507 } | 5507 } |
5508 marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 5508 marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
5509 IncrementalMarking::FORCE_COMPLETION); | 5509 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); |
5510 CcTest::CollectGarbage(NEW_SPACE); | 5510 CcTest::CollectGarbage(NEW_SPACE); |
5511 CHECK(weak_cell->value()->IsFixedArray()); | 5511 CHECK(weak_cell->value()->IsFixedArray()); |
5512 weak_cells[i] = inner_scope.CloseAndEscape(weak_cell); | 5512 weak_cells[i] = inner_scope.CloseAndEscape(weak_cell); |
5513 } | 5513 } |
5514 // Call collect all twice to make sure that we also cleared | 5514 // Call collect all twice to make sure that we also cleared |
5515 // weak cells that were allocated on black pages. | 5515 // weak cells that were allocated on black pages. |
5516 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); | 5516 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); |
5517 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); | 5517 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); |
5518 CHECK_EQ(*survivor, weak_cells[0]->value()); | 5518 CHECK_EQ(*survivor, weak_cells[0]->value()); |
5519 for (int i = 1; i < N; i++) { | 5519 for (int i = 1; i < N; i++) { |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5821 i::Heap::kNoGCFlags, i::GarbageCollectionReason::kTesting); | 5821 i::Heap::kNoGCFlags, i::GarbageCollectionReason::kTesting); |
5822 } | 5822 } |
5823 // Incrementally mark the backing store. | 5823 // Incrementally mark the backing store. |
5824 Handle<JSReceiver> obj = | 5824 Handle<JSReceiver> obj = |
5825 v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result)); | 5825 v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result)); |
5826 Handle<JSWeakCollection> weak_map(reinterpret_cast<JSWeakCollection*>(*obj)); | 5826 Handle<JSWeakCollection> weak_map(reinterpret_cast<JSWeakCollection*>(*obj)); |
5827 while (!Marking::IsBlack( | 5827 while (!Marking::IsBlack( |
5828 ObjectMarking::MarkBitFrom(HeapObject::cast(weak_map->table()))) && | 5828 ObjectMarking::MarkBitFrom(HeapObject::cast(weak_map->table()))) && |
5829 !marking->IsStopped()) { | 5829 !marking->IsStopped()) { |
5830 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 5830 marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
5831 IncrementalMarking::FORCE_COMPLETION); | 5831 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); |
5832 } | 5832 } |
5833 // Stash the backing store in a handle. | 5833 // Stash the backing store in a handle. |
5834 Handle<Object> save(weak_map->table(), isolate); | 5834 Handle<Object> save(weak_map->table(), isolate); |
5835 // The following line will update the backing store. | 5835 // The following line will update the backing store. |
5836 CompileRun( | 5836 CompileRun( |
5837 "for (var i = 0; i < 50; i++) {" | 5837 "for (var i = 0; i < 50; i++) {" |
5838 " weak_map.set(future_keys[i], i);" | 5838 " weak_map.set(future_keys[i], i);" |
5839 "}"); | 5839 "}"); |
5840 heap->incremental_marking()->set_should_hurry(true); | 5840 heap->incremental_marking()->set_should_hurry(true); |
5841 CcTest::CollectGarbage(OLD_SPACE); | 5841 CcTest::CollectGarbage(OLD_SPACE); |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6662 // Check that we have not marked the interesting array during root scanning. | 6662 // Check that we have not marked the interesting array during root scanning. |
6663 for (int i = 0; i < arr.get()->length(); i++) { | 6663 for (int i = 0; i < arr.get()->length(); i++) { |
6664 CHECK(Marking::IsWhite( | 6664 CHECK(Marking::IsWhite( |
6665 ObjectMarking::MarkBitFrom(HeapObject::cast(arr.get()->get(i))))); | 6665 ObjectMarking::MarkBitFrom(HeapObject::cast(arr.get()->get(i))))); |
6666 } | 6666 } |
6667 | 6667 |
6668 // Now we search for a state where we are in incremental marking and have | 6668 // Now we search for a state where we are in incremental marking and have |
6669 // only partially marked the large object. | 6669 // only partially marked the large object. |
6670 while (!marking->IsComplete()) { | 6670 while (!marking->IsComplete()) { |
6671 marking->Step(i::KB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 6671 marking->Step(i::KB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
6672 IncrementalMarking::FORCE_COMPLETION); | 6672 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); |
6673 if (page->IsFlagSet(Page::HAS_PROGRESS_BAR) && page->progress_bar() > 0) { | 6673 if (page->IsFlagSet(Page::HAS_PROGRESS_BAR) && page->progress_bar() > 0) { |
6674 CHECK_NE(page->progress_bar(), arr.get()->Size()); | 6674 CHECK_NE(page->progress_bar(), arr.get()->Size()); |
6675 { | 6675 { |
6676 // Shift by 1, effectively moving one white object across the progress | 6676 // Shift by 1, effectively moving one white object across the progress |
6677 // bar, meaning that we will miss marking it. | 6677 // bar, meaning that we will miss marking it. |
6678 v8::HandleScope scope(CcTest::isolate()); | 6678 v8::HandleScope scope(CcTest::isolate()); |
6679 Handle<JSArray> js_array = isolate->factory()->NewJSArrayWithElements( | 6679 Handle<JSArray> js_array = isolate->factory()->NewJSArrayWithElements( |
6680 Handle<FixedArray>(arr.get())); | 6680 Handle<FixedArray>(arr.get())); |
6681 js_array->GetElementsAccessor()->Shift(js_array); | 6681 js_array->GetElementsAccessor()->Shift(js_array); |
6682 } | 6682 } |
6683 break; | 6683 break; |
6684 } | 6684 } |
6685 } | 6685 } |
6686 | 6686 |
6687 // Finish marking with bigger steps to speed up test. | 6687 // Finish marking with bigger steps to speed up test. |
6688 while (!marking->IsComplete()) { | 6688 while (!marking->IsComplete()) { |
6689 marking->Step(10 * i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 6689 marking->Step(10 * i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
6690 IncrementalMarking::FORCE_COMPLETION); | 6690 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); |
6691 if (marking->IsReadyToOverApproximateWeakClosure()) { | 6691 if (marking->IsReadyToOverApproximateWeakClosure()) { |
6692 marking->FinalizeIncrementally(); | 6692 marking->FinalizeIncrementally(); |
6693 } | 6693 } |
6694 } | 6694 } |
6695 CHECK(marking->IsComplete()); | 6695 CHECK(marking->IsComplete()); |
6696 | 6696 |
6697 // All objects need to be black after marking. If a white object crossed the | 6697 // All objects need to be black after marking. If a white object crossed the |
6698 // progress bar, we would fail here. | 6698 // progress bar, we would fail here. |
6699 for (int i = 0; i < arr.get()->length(); i++) { | 6699 for (int i = 0; i < arr.get()->length(); i++) { |
6700 CHECK(Marking::IsBlack( | 6700 CHECK(Marking::IsBlack( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6735 } | 6735 } |
6736 CHECK(marking->IsMarking()); | 6736 CHECK(marking->IsMarking()); |
6737 marking->StartBlackAllocationForTesting(); | 6737 marking->StartBlackAllocationForTesting(); |
6738 { | 6738 { |
6739 AlwaysAllocateScope always_allocate(CcTest::i_isolate()); | 6739 AlwaysAllocateScope always_allocate(CcTest::i_isolate()); |
6740 v8::HandleScope inner(CcTest::isolate()); | 6740 v8::HandleScope inner(CcTest::isolate()); |
6741 isolate->factory()->NewFixedArray(500, TENURED)->Size(); | 6741 isolate->factory()->NewFixedArray(500, TENURED)->Size(); |
6742 } | 6742 } |
6743 while (!marking->IsComplete()) { | 6743 while (!marking->IsComplete()) { |
6744 marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 6744 marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
6745 IncrementalMarking::FORCE_COMPLETION); | 6745 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); |
6746 if (marking->IsReadyToOverApproximateWeakClosure()) { | 6746 if (marking->IsReadyToOverApproximateWeakClosure()) { |
6747 marking->FinalizeIncrementally(); | 6747 marking->FinalizeIncrementally(); |
6748 } | 6748 } |
6749 } | 6749 } |
6750 CHECK(marking->IsComplete()); | 6750 CHECK(marking->IsComplete()); |
6751 intptr_t size_before = heap->SizeOfObjects(); | 6751 intptr_t size_before = heap->SizeOfObjects(); |
6752 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); | 6752 CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); |
6753 intptr_t size_after = heap->SizeOfObjects(); | 6753 intptr_t size_after = heap->SizeOfObjects(); |
6754 // Live size does not increase after garbage collection. | 6754 // Live size does not increase after garbage collection. |
6755 CHECK_LE(size_after, size_before); | 6755 CHECK_LE(size_after, size_before); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6795 heap::SimulateFullSpace(heap->old_space()); | 6795 heap::SimulateFullSpace(heap->old_space()); |
6796 Handle<String> s3; | 6796 Handle<String> s3; |
6797 factory->NewConsString(s1, s2).ToHandle(&s3); | 6797 factory->NewConsString(s1, s2).ToHandle(&s3); |
6798 CcTest::CollectGarbage(NEW_SPACE); | 6798 CcTest::CollectGarbage(NEW_SPACE); |
6799 CcTest::CollectGarbage(NEW_SPACE); | 6799 CcTest::CollectGarbage(NEW_SPACE); |
6800 | 6800 |
6801 // Finish incremental marking. | 6801 // Finish incremental marking. |
6802 IncrementalMarking* marking = heap->incremental_marking(); | 6802 IncrementalMarking* marking = heap->incremental_marking(); |
6803 while (!marking->IsComplete()) { | 6803 while (!marking->IsComplete()) { |
6804 marking->Step(MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 6804 marking->Step(MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
6805 IncrementalMarking::FORCE_COMPLETION); | 6805 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); |
6806 if (marking->IsReadyToOverApproximateWeakClosure()) { | 6806 if (marking->IsReadyToOverApproximateWeakClosure()) { |
6807 marking->FinalizeIncrementally(); | 6807 marking->FinalizeIncrementally(); |
6808 } | 6808 } |
6809 } | 6809 } |
6810 | 6810 |
6811 { | 6811 { |
6812 StaticOneByteResource external_string("12345678901234"); | 6812 StaticOneByteResource external_string("12345678901234"); |
6813 s3->MakeExternal(&external_string); | 6813 s3->MakeExternal(&external_string); |
6814 CcTest::CollectGarbage(OLD_SPACE); | 6814 CcTest::CollectGarbage(OLD_SPACE); |
6815 } | 6815 } |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7118 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); | 7118 chunk, chunk->area_end() - kPointerSize, chunk->area_end()); |
7119 slots[chunk->area_end() - kPointerSize] = false; | 7119 slots[chunk->area_end() - kPointerSize] = false; |
7120 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { | 7120 RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { |
7121 CHECK(slots[addr]); | 7121 CHECK(slots[addr]); |
7122 return KEEP_SLOT; | 7122 return KEEP_SLOT; |
7123 }); | 7123 }); |
7124 } | 7124 } |
7125 | 7125 |
7126 } // namespace internal | 7126 } // namespace internal |
7127 } // namespace v8 | 7127 } // namespace v8 |
OLD | NEW |