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

Side by Side Diff: src/objects.cc

Issue 2801073006: Decouple root visitors from object visitors. (Closed)
Patch Set: rebase Created 3 years, 7 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/objects.h ('k') | src/profiler/heap-snapshot-generator.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 10647 matching lines...) Expand 10 before | Expand all | Expand 10 after
10658 return to + ArchiveSpacePerThread(); 10658 return to + ArchiveSpacePerThread();
10659 } 10659 }
10660 10660
10661 10661
10662 // Restore statics that are thread-local. 10662 // Restore statics that are thread-local.
10663 char* Relocatable::RestoreState(Isolate* isolate, char* from) { 10663 char* Relocatable::RestoreState(Isolate* isolate, char* from) {
10664 isolate->set_relocatable_top(*reinterpret_cast<Relocatable**>(from)); 10664 isolate->set_relocatable_top(*reinterpret_cast<Relocatable**>(from));
10665 return from + ArchiveSpacePerThread(); 10665 return from + ArchiveSpacePerThread();
10666 } 10666 }
10667 10667
10668 10668 char* Relocatable::Iterate(RootVisitor* v, char* thread_storage) {
10669 char* Relocatable::Iterate(ObjectVisitor* v, char* thread_storage) {
10670 Relocatable* top = *reinterpret_cast<Relocatable**>(thread_storage); 10669 Relocatable* top = *reinterpret_cast<Relocatable**>(thread_storage);
10671 Iterate(v, top); 10670 Iterate(v, top);
10672 return thread_storage + ArchiveSpacePerThread(); 10671 return thread_storage + ArchiveSpacePerThread();
10673 } 10672 }
10674 10673
10675 10674 void Relocatable::Iterate(Isolate* isolate, RootVisitor* v) {
10676 void Relocatable::Iterate(Isolate* isolate, ObjectVisitor* v) {
10677 Iterate(v, isolate->relocatable_top()); 10675 Iterate(v, isolate->relocatable_top());
10678 } 10676 }
10679 10677
10680 10678 void Relocatable::Iterate(RootVisitor* v, Relocatable* top) {
10681 void Relocatable::Iterate(ObjectVisitor* v, Relocatable* top) {
10682 Relocatable* current = top; 10679 Relocatable* current = top;
10683 while (current != NULL) { 10680 while (current != NULL) {
10684 current->IterateInstance(v); 10681 current->IterateInstance(v);
10685 current = current->prev_; 10682 current = current->prev_;
10686 } 10683 }
10687 } 10684 }
10688 10685
10689 10686
10690 FlatStringReader::FlatStringReader(Isolate* isolate, Handle<String> str) 10687 FlatStringReader::FlatStringReader(Isolate* isolate, Handle<String> str)
10691 : Relocatable(isolate), 10688 : Relocatable(isolate),
(...skipping 3186 matching lines...) Expand 10 before | Expand all | Expand 10 after
13878 if (entry != kNotFound) { 13875 if (entry != kNotFound) {
13879 FixedArray* code_map = optimized_code_map(); 13876 FixedArray* code_map = optimized_code_map();
13880 DCHECK_LE(entry + kEntryLength, code_map->length()); 13877 DCHECK_LE(entry + kEntryLength, code_map->length());
13881 WeakCell* cell = WeakCell::cast(code_map->get(entry + kCachedCodeOffset)); 13878 WeakCell* cell = WeakCell::cast(code_map->get(entry + kCachedCodeOffset));
13882 result = cell->cleared() ? nullptr : Code::cast(cell->value()); 13879 result = cell->cleared() ? nullptr : Code::cast(cell->value());
13883 } 13880 }
13884 return result; 13881 return result;
13885 } 13882 }
13886 13883
13887 13884
13888 #define DECLARE_TAG(ignore1, name, ignore2) name,
13889 const char* const VisitorSynchronization::kTags[
13890 VisitorSynchronization::kNumberOfSyncTags] = {
13891 VISITOR_SYNCHRONIZATION_TAGS_LIST(DECLARE_TAG)
13892 };
13893 #undef DECLARE_TAG
13894
13895
13896 #define DECLARE_TAG(ignore1, ignore2, name) name,
13897 const char* const VisitorSynchronization::kTagNames[
13898 VisitorSynchronization::kNumberOfSyncTags] = {
13899 VISITOR_SYNCHRONIZATION_TAGS_LIST(DECLARE_TAG)
13900 };
13901 #undef DECLARE_TAG
13902
13903
13904 void ObjectVisitor::VisitCodeTarget(RelocInfo* rinfo) { 13885 void ObjectVisitor::VisitCodeTarget(RelocInfo* rinfo) {
13905 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode())); 13886 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode()));
13906 Object* old_pointer = Code::GetCodeFromTargetAddress(rinfo->target_address()); 13887 Object* old_pointer = Code::GetCodeFromTargetAddress(rinfo->target_address());
13907 Object* new_pointer = old_pointer; 13888 Object* new_pointer = old_pointer;
13908 VisitPointer(&new_pointer); 13889 VisitPointer(&new_pointer);
13909 DCHECK_EQ(old_pointer, new_pointer); 13890 DCHECK_EQ(old_pointer, new_pointer);
13910 } 13891 }
13911 13892
13912 13893
13913 void ObjectVisitor::VisitCodeAgeSequence(RelocInfo* rinfo) { 13894 void ObjectVisitor::VisitCodeAgeSequence(RelocInfo* rinfo) {
(...skipping 6758 matching lines...) Expand 10 before | Expand all | Expand 10 after
20672 // depend on this. 20653 // depend on this.
20673 return DICTIONARY_ELEMENTS; 20654 return DICTIONARY_ELEMENTS;
20674 } 20655 }
20675 DCHECK_LE(kind, LAST_ELEMENTS_KIND); 20656 DCHECK_LE(kind, LAST_ELEMENTS_KIND);
20676 return kind; 20657 return kind;
20677 } 20658 }
20678 } 20659 }
20679 20660
20680 } // namespace internal 20661 } // namespace internal
20681 } // namespace v8 20662 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/profiler/heap-snapshot-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698