OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/heap/heap.h" | 5 #include "src/heap/heap.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/ast/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 incremental_marking()->AdvanceIncrementalMarking( | 936 incremental_marking()->AdvanceIncrementalMarking( |
937 deadline, | 937 deadline, |
938 IncrementalMarking::StepActions(IncrementalMarking::GC_VIA_STACK_GUARD, | 938 IncrementalMarking::StepActions(IncrementalMarking::GC_VIA_STACK_GUARD, |
939 IncrementalMarking::FORCE_MARKING, | 939 IncrementalMarking::FORCE_MARKING, |
940 IncrementalMarking::FORCE_COMPLETION)); | 940 IncrementalMarking::FORCE_COMPLETION)); |
941 } | 941 } |
942 } | 942 } |
943 | 943 |
944 | 944 |
945 void Heap::EnsureFillerObjectAtTop() { | 945 void Heap::EnsureFillerObjectAtTop() { |
946 // There may be an allocation memento behind every object in new space. | 946 // There may be an allocation memento behind objects in new space. Upon |
947 // If we evacuate a not full new space or if we are on the last page of | 947 // evacuation of a non-full new space (or if we are on the last page) there |
948 // the new space, then there may be uninitialized memory behind the top | 948 // may be uninitialized memory behind top. We fill the remainder of the page |
949 // pointer of the new space page. We store a filler object there to | 949 // with a filler. |
950 // identify the unused space. | 950 Address to_top = new_space_.top(); |
951 Address from_top = new_space_.top(); | 951 NewSpacePage* page = NewSpacePage::FromAddress(to_top - kPointerSize); |
952 // Check that from_top is inside its page (i.e., not at the end). | 952 if (page->Contains(to_top)) { |
953 Address space_end = new_space_.ToSpaceEnd(); | 953 int remaining_in_page = static_cast<int>(page->area_end() - to_top); |
954 if (from_top < space_end) { | 954 CreateFillerObjectAt(to_top, remaining_in_page, ClearRecordedSlots::kNo); |
955 Page* page = Page::FromAddress(from_top); | |
956 if (page->Contains(from_top)) { | |
957 int remaining_in_page = static_cast<int>(page->area_end() - from_top); | |
958 CreateFillerObjectAt(from_top, remaining_in_page, | |
959 ClearRecordedSlots::kNo); | |
960 } | |
961 } | 955 } |
962 } | 956 } |
963 | 957 |
964 | 958 |
965 bool Heap::CollectGarbage(GarbageCollector collector, const char* gc_reason, | 959 bool Heap::CollectGarbage(GarbageCollector collector, const char* gc_reason, |
966 const char* collector_reason, | 960 const char* collector_reason, |
967 const v8::GCCallbackFlags gc_callback_flags) { | 961 const v8::GCCallbackFlags gc_callback_flags) { |
968 // The VM is in the GC state until exiting this function. | 962 // The VM is in the GC state until exiting this function. |
969 VMState<GC> state(isolate_); | 963 VMState<GC> state(isolate_); |
970 | 964 |
(...skipping 5466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6437 } | 6431 } |
6438 | 6432 |
6439 | 6433 |
6440 // static | 6434 // static |
6441 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6435 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6442 return StaticVisitorBase::GetVisitorId(map); | 6436 return StaticVisitorBase::GetVisitorId(map); |
6443 } | 6437 } |
6444 | 6438 |
6445 } // namespace internal | 6439 } // namespace internal |
6446 } // namespace v8 | 6440 } // namespace v8 |
OLD | NEW |