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

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

Issue 2397713002: [heap] Remove PromotionMode used by Scavenger (Closed)
Patch Set: Remove introduced tests Created 4 years, 2 months 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/heap-inl.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 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 // objects lie between a 'front' mark and a 'rear' mark that is 1632 // objects lie between a 'front' mark and a 'rear' mark that is
1633 // updated as a side effect of promoting an object. 1633 // updated as a side effect of promoting an object.
1634 // 1634 //
1635 // There is guaranteed to be enough room at the top of the to space 1635 // There is guaranteed to be enough room at the top of the to space
1636 // for the addresses of promoted objects: every object promoted 1636 // for the addresses of promoted objects: every object promoted
1637 // frees up its size in bytes from the top of the new space, and 1637 // frees up its size in bytes from the top of the new space, and
1638 // objects are at least one pointer in size. 1638 // objects are at least one pointer in size.
1639 Address new_space_front = new_space_->ToSpaceStart(); 1639 Address new_space_front = new_space_->ToSpaceStart();
1640 promotion_queue_.Initialize(); 1640 promotion_queue_.Initialize();
1641 1641
1642 PromotionMode promotion_mode = CurrentPromotionMode();
1643 ScavengeVisitor scavenge_visitor(this); 1642 ScavengeVisitor scavenge_visitor(this);
1644 1643
1645 if (FLAG_scavenge_reclaim_unmodified_objects) { 1644 if (FLAG_scavenge_reclaim_unmodified_objects) {
1646 isolate()->global_handles()->IdentifyWeakUnmodifiedObjects( 1645 isolate()->global_handles()->IdentifyWeakUnmodifiedObjects(
1647 &IsUnmodifiedHeapObject); 1646 &IsUnmodifiedHeapObject);
1648 } 1647 }
1649 1648
1650 { 1649 {
1651 // Copy roots. 1650 // Copy roots.
1652 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_ROOTS); 1651 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_ROOTS);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 // Copy objects reachable from the code flushing candidates list. 1684 // Copy objects reachable from the code flushing candidates list.
1686 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_CODE_FLUSH_CANDIDATES); 1685 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_CODE_FLUSH_CANDIDATES);
1687 MarkCompactCollector* collector = mark_compact_collector(); 1686 MarkCompactCollector* collector = mark_compact_collector();
1688 if (collector->is_code_flushing_enabled()) { 1687 if (collector->is_code_flushing_enabled()) {
1689 collector->code_flusher()->IteratePointersToFromSpace(&scavenge_visitor); 1688 collector->code_flusher()->IteratePointersToFromSpace(&scavenge_visitor);
1690 } 1689 }
1691 } 1690 }
1692 1691
1693 { 1692 {
1694 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_SEMISPACE); 1693 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_SEMISPACE);
1695 new_space_front = 1694 new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
1696 DoScavenge(&scavenge_visitor, new_space_front, promotion_mode);
1697 } 1695 }
1698 1696
1699 if (FLAG_scavenge_reclaim_unmodified_objects) { 1697 if (FLAG_scavenge_reclaim_unmodified_objects) {
1700 isolate()->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending( 1698 isolate()->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending(
1701 &IsUnscavengedHeapObject); 1699 &IsUnscavengedHeapObject);
1702 1700
1703 isolate()->global_handles()->IterateNewSpaceWeakUnmodifiedRoots( 1701 isolate()->global_handles()->IterateNewSpaceWeakUnmodifiedRoots(
1704 &scavenge_visitor); 1702 &scavenge_visitor);
1705 new_space_front = 1703 new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
1706 DoScavenge(&scavenge_visitor, new_space_front, promotion_mode);
1707 } else { 1704 } else {
1708 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_OBJECT_GROUPS); 1705 TRACE_GC(tracer(), GCTracer::Scope::SCAVENGER_OBJECT_GROUPS);
1709 while (isolate()->global_handles()->IterateObjectGroups( 1706 while (isolate()->global_handles()->IterateObjectGroups(
1710 &scavenge_visitor, &IsUnscavengedHeapObject)) { 1707 &scavenge_visitor, &IsUnscavengedHeapObject)) {
1711 new_space_front = 1708 new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
1712 DoScavenge(&scavenge_visitor, new_space_front, promotion_mode);
1713 } 1709 }
1714 isolate()->global_handles()->RemoveObjectGroups(); 1710 isolate()->global_handles()->RemoveObjectGroups();
1715 isolate()->global_handles()->RemoveImplicitRefGroups(); 1711 isolate()->global_handles()->RemoveImplicitRefGroups();
1716 1712
1717 isolate()->global_handles()->IdentifyNewSpaceWeakIndependentHandles( 1713 isolate()->global_handles()->IdentifyNewSpaceWeakIndependentHandles(
1718 &IsUnscavengedHeapObject); 1714 &IsUnscavengedHeapObject);
1719 1715
1720 isolate()->global_handles()->IterateNewSpaceWeakIndependentRoots( 1716 isolate()->global_handles()->IterateNewSpaceWeakIndependentRoots(
1721 &scavenge_visitor); 1717 &scavenge_visitor);
1722 new_space_front = 1718 new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
1723 DoScavenge(&scavenge_visitor, new_space_front, promotion_mode);
1724 } 1719 }
1725 1720
1726 UpdateNewSpaceReferencesInExternalStringTable( 1721 UpdateNewSpaceReferencesInExternalStringTable(
1727 &UpdateNewSpaceReferenceInExternalStringTableEntry); 1722 &UpdateNewSpaceReferenceInExternalStringTableEntry);
1728 1723
1729 promotion_queue_.Destroy(); 1724 promotion_queue_.Destroy();
1730 1725
1731 incremental_marking()->UpdateMarkingDequeAfterScavenge(); 1726 incremental_marking()->UpdateMarkingDequeAfterScavenge();
1732 1727
1733 ScavengeWeakObjectRetainer weak_object_retainer(this); 1728 ScavengeWeakObjectRetainer weak_object_retainer(this);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 } 1892 }
1898 1893
1899 private: 1894 private:
1900 v8::ExternalResourceVisitor* visitor_; 1895 v8::ExternalResourceVisitor* visitor_;
1901 } external_string_table_visitor(visitor); 1896 } external_string_table_visitor(visitor);
1902 1897
1903 external_string_table_.Iterate(&external_string_table_visitor); 1898 external_string_table_.Iterate(&external_string_table_visitor);
1904 } 1899 }
1905 1900
1906 Address Heap::DoScavenge(ObjectVisitor* scavenge_visitor, 1901 Address Heap::DoScavenge(ObjectVisitor* scavenge_visitor,
1907 Address new_space_front, 1902 Address new_space_front) {
1908 PromotionMode promotion_mode) {
1909 do { 1903 do {
1910 SemiSpace::AssertValidRange(new_space_front, new_space_->top()); 1904 SemiSpace::AssertValidRange(new_space_front, new_space_->top());
1911 // The addresses new_space_front and new_space_.top() define a 1905 // The addresses new_space_front and new_space_.top() define a
1912 // queue of unprocessed copied objects. Process them until the 1906 // queue of unprocessed copied objects. Process them until the
1913 // queue is empty. 1907 // queue is empty.
1914 while (new_space_front != new_space_->top()) { 1908 while (new_space_front != new_space_->top()) {
1915 if (!Page::IsAlignedToPageSize(new_space_front)) { 1909 if (!Page::IsAlignedToPageSize(new_space_front)) {
1916 HeapObject* object = HeapObject::FromAddress(new_space_front); 1910 HeapObject* object = HeapObject::FromAddress(new_space_front);
1917 if (promotion_mode == PROMOTE_MARKED) { 1911 new_space_front +=
1918 new_space_front += StaticScavengeVisitor<PROMOTE_MARKED>::IterateBody( 1912 StaticScavengeVisitor::IterateBody(object->map(), object);
1919 object->map(), object);
1920 } else {
1921 new_space_front +=
1922 StaticScavengeVisitor<DEFAULT_PROMOTION>::IterateBody(
1923 object->map(), object);
1924 }
1925 } else { 1913 } else {
1926 new_space_front = Page::FromAllocationAreaAddress(new_space_front) 1914 new_space_front = Page::FromAllocationAreaAddress(new_space_front)
1927 ->next_page() 1915 ->next_page()
1928 ->area_start(); 1916 ->area_start();
1929 } 1917 }
1930 } 1918 }
1931 1919
1932 // Promote and process all the to-be-promoted objects. 1920 // Promote and process all the to-be-promoted objects.
1933 { 1921 {
1934 while (!promotion_queue()->is_empty()) { 1922 while (!promotion_queue()->is_empty()) {
(...skipping 3491 matching lines...) Expand 10 before | Expand all | Expand 10 after
5426 space = spaces.next()) { 5414 space = spaces.next()) {
5427 space->EmptyAllocationInfo(); 5415 space->EmptyAllocationInfo();
5428 } 5416 }
5429 } 5417 }
5430 5418
5431 5419
5432 V8_DECLARE_ONCE(initialize_gc_once); 5420 V8_DECLARE_ONCE(initialize_gc_once);
5433 5421
5434 static void InitializeGCOnce() { 5422 static void InitializeGCOnce() {
5435 Scavenger::Initialize(); 5423 Scavenger::Initialize();
5436 StaticScavengeVisitor<DEFAULT_PROMOTION>::Initialize(); 5424 StaticScavengeVisitor::Initialize();
5437 StaticScavengeVisitor<PROMOTE_MARKED>::Initialize();
5438 MarkCompactCollector::Initialize(); 5425 MarkCompactCollector::Initialize();
5439 } 5426 }
5440 5427
5441 5428
5442 bool Heap::SetUp() { 5429 bool Heap::SetUp() {
5443 #ifdef DEBUG 5430 #ifdef DEBUG
5444 allocation_timeout_ = FLAG_gc_interval; 5431 allocation_timeout_ = FLAG_gc_interval;
5445 #endif 5432 #endif
5446 5433
5447 // Initialize heap spaces and initial maps and objects. Whenever something 5434 // Initialize heap spaces and initial maps and objects. Whenever something
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after
6530 } 6517 }
6531 6518
6532 6519
6533 // static 6520 // static
6534 int Heap::GetStaticVisitorIdForMap(Map* map) { 6521 int Heap::GetStaticVisitorIdForMap(Map* map) {
6535 return StaticVisitorBase::GetVisitorId(map); 6522 return StaticVisitorBase::GetVisitorId(map);
6536 } 6523 }
6537 6524
6538 } // namespace internal 6525 } // namespace internal
6539 } // namespace v8 6526 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698