Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: src/heap/heap.cc

Issue 2498583002: [heap] Minor MC: Add marking (Closed)
Patch Set: Move to concurrent uncomitting of marking deque Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/mark-compact.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/context-slot-cache.h" 9 #include "src/ast/context-slot-cache.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 survived_since_last_expansion_ = 0; 1495 survived_since_last_expansion_ = 0;
1496 } 1496 }
1497 } 1497 }
1498 1498
1499 1499
1500 static bool IsUnscavengedHeapObject(Heap* heap, Object** p) { 1500 static bool IsUnscavengedHeapObject(Heap* heap, Object** p) {
1501 return heap->InNewSpace(*p) && 1501 return heap->InNewSpace(*p) &&
1502 !HeapObject::cast(*p)->map_word().IsForwardingAddress(); 1502 !HeapObject::cast(*p)->map_word().IsForwardingAddress();
1503 } 1503 }
1504 1504
1505
1506 static bool IsUnmodifiedHeapObject(Object** p) {
1507 Object* object = *p;
1508 if (object->IsSmi()) return false;
1509 HeapObject* heap_object = HeapObject::cast(object);
1510 if (!object->IsJSObject()) return false;
1511 JSObject* js_object = JSObject::cast(object);
1512 if (!js_object->WasConstructedFromApiFunction()) return false;
1513 JSFunction* constructor =
1514 JSFunction::cast(js_object->map()->GetConstructor());
1515
1516 return constructor->initial_map() == heap_object->map();
1517 }
1518
1519
1520 void PromotionQueue::Initialize() { 1505 void PromotionQueue::Initialize() {
1521 // The last to-space page may be used for promotion queue. On promotion 1506 // The last to-space page may be used for promotion queue. On promotion
1522 // conflict, we use the emergency stack. 1507 // conflict, we use the emergency stack.
1523 DCHECK((Page::kPageSize - MemoryChunk::kBodyOffset) % (2 * kPointerSize) == 1508 DCHECK((Page::kPageSize - MemoryChunk::kBodyOffset) % (2 * kPointerSize) ==
1524 0); 1509 0);
1525 front_ = rear_ = 1510 front_ = rear_ =
1526 reinterpret_cast<struct Entry*>(heap_->new_space()->ToSpaceEnd()); 1511 reinterpret_cast<struct Entry*>(heap_->new_space()->ToSpaceEnd());
1527 limit_ = reinterpret_cast<struct Entry*>( 1512 limit_ = reinterpret_cast<struct Entry*>(
1528 Page::FromAllocationAreaAddress(reinterpret_cast<Address>(rear_)) 1513 Page::FromAllocationAreaAddress(reinterpret_cast<Address>(rear_))
1529 ->area_start()); 1514 ->area_start());
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 } 1669 }
1685 1670
1686 { 1671 {
1687 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_SEMISPACE); 1672 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_SEMISPACE);
1688 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); 1673 new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
1689 } 1674 }
1690 1675
1691 isolate()->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending( 1676 isolate()->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending(
1692 &IsUnscavengedHeapObject); 1677 &IsUnscavengedHeapObject);
1693 1678
1694 isolate()->global_handles()->IterateNewSpaceWeakUnmodifiedRoots( 1679 isolate()
1695 &scavenge_visitor); 1680 ->global_handles()
1681 ->IterateNewSpaceWeakUnmodifiedRoots<
1682 GlobalHandles::HANDLE_PHANTOM_NODES_VISIT_OTHERS>(&scavenge_visitor);
1696 new_space_front = DoScavenge(&scavenge_visitor, new_space_front); 1683 new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
1697 1684
1698 UpdateNewSpaceReferencesInExternalStringTable( 1685 UpdateNewSpaceReferencesInExternalStringTable(
1699 &UpdateNewSpaceReferenceInExternalStringTableEntry); 1686 &UpdateNewSpaceReferenceInExternalStringTableEntry);
1700 1687
1701 promotion_queue_.Destroy(); 1688 promotion_queue_.Destroy();
1702 1689
1703 incremental_marking()->UpdateMarkingDequeAfterScavenge(); 1690 incremental_marking()->UpdateMarkingDequeAfterScavenge();
1704 1691
1705 ScavengeWeakObjectRetainer weak_object_retainer(this); 1692 ScavengeWeakObjectRetainer weak_object_retainer(this);
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
2905 return false; 2892 return false;
2906 } 2893 }
2907 } 2894 }
2908 2895
2909 2896
2910 bool Heap::RootCanBeTreatedAsConstant(RootListIndex root_index) { 2897 bool Heap::RootCanBeTreatedAsConstant(RootListIndex root_index) {
2911 return !RootCanBeWrittenAfterInitialization(root_index) && 2898 return !RootCanBeWrittenAfterInitialization(root_index) &&
2912 !InNewSpace(root(root_index)); 2899 !InNewSpace(root(root_index));
2913 } 2900 }
2914 2901
2902 bool Heap::IsUnmodifiedHeapObject(Object** p) {
2903 Object* object = *p;
2904 if (object->IsSmi()) return false;
2905 HeapObject* heap_object = HeapObject::cast(object);
2906 if (!object->IsJSObject()) return false;
2907 JSObject* js_object = JSObject::cast(object);
2908 if (!js_object->WasConstructedFromApiFunction()) return false;
2909 JSFunction* constructor =
2910 JSFunction::cast(js_object->map()->GetConstructor());
2911
2912 return constructor->initial_map() == heap_object->map();
2913 }
2915 2914
2916 int Heap::FullSizeNumberStringCacheLength() { 2915 int Heap::FullSizeNumberStringCacheLength() {
2917 // Compute the size of the number string cache based on the max newspace size. 2916 // Compute the size of the number string cache based on the max newspace size.
2918 // The number string cache has a minimum size based on twice the initial cache 2917 // The number string cache has a minimum size based on twice the initial cache
2919 // size to ensure that it is bigger after being made 'full size'. 2918 // size to ensure that it is bigger after being made 'full size'.
2920 size_t number_string_cache_size = max_semi_space_size_ / 512; 2919 size_t number_string_cache_size = max_semi_space_size_ / 512;
2921 number_string_cache_size = 2920 number_string_cache_size =
2922 Max(static_cast<size_t>(kInitialNumberStringCacheSize * 2), 2921 Max(static_cast<size_t>(kInitialNumberStringCacheSize * 2),
2923 Min<size_t>(0x4000u, number_string_cache_size)); 2922 Min<size_t>(0x4000u, number_string_cache_size));
2924 // There is a string and a number per entry so the length is twice the number 2923 // There is a string and a number per entry so the length is twice the number
(...skipping 3546 matching lines...) Expand 10 before | Expand all | Expand 10 after
6471 } 6470 }
6472 6471
6473 6472
6474 // static 6473 // static
6475 int Heap::GetStaticVisitorIdForMap(Map* map) { 6474 int Heap::GetStaticVisitorIdForMap(Map* map) {
6476 return StaticVisitorBase::GetVisitorId(map); 6475 return StaticVisitorBase::GetVisitorId(map);
6477 } 6476 }
6478 6477
6479 } // namespace internal 6478 } // namespace internal
6480 } // namespace v8 6479 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/mark-compact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698