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

Side by Side Diff: src/objects.cc

Issue 2801073006: Decouple root visitors from object visitors. (Closed)
Patch Set: rebase Created 3 years, 8 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
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 10642 matching lines...) Expand 10 before | Expand all | Expand 10 after
10653 return to + ArchiveSpacePerThread(); 10653 return to + ArchiveSpacePerThread();
10654 } 10654 }
10655 10655
10656 10656
10657 // Restore statics that are thread-local. 10657 // Restore statics that are thread-local.
10658 char* Relocatable::RestoreState(Isolate* isolate, char* from) { 10658 char* Relocatable::RestoreState(Isolate* isolate, char* from) {
10659 isolate->set_relocatable_top(*reinterpret_cast<Relocatable**>(from)); 10659 isolate->set_relocatable_top(*reinterpret_cast<Relocatable**>(from));
10660 return from + ArchiveSpacePerThread(); 10660 return from + ArchiveSpacePerThread();
10661 } 10661 }
10662 10662
10663 10663 char* Relocatable::Iterate(RootVisitor* v, char* thread_storage) {
10664 char* Relocatable::Iterate(ObjectVisitor* v, char* thread_storage) {
10665 Relocatable* top = *reinterpret_cast<Relocatable**>(thread_storage); 10664 Relocatable* top = *reinterpret_cast<Relocatable**>(thread_storage);
10666 Iterate(v, top); 10665 Iterate(v, top);
10667 return thread_storage + ArchiveSpacePerThread(); 10666 return thread_storage + ArchiveSpacePerThread();
10668 } 10667 }
10669 10668
10670 10669 void Relocatable::Iterate(Isolate* isolate, RootVisitor* v) {
10671 void Relocatable::Iterate(Isolate* isolate, ObjectVisitor* v) {
10672 Iterate(v, isolate->relocatable_top()); 10670 Iterate(v, isolate->relocatable_top());
10673 } 10671 }
10674 10672
10675 10673 void Relocatable::Iterate(RootVisitor* v, Relocatable* top) {
10676 void Relocatable::Iterate(ObjectVisitor* v, Relocatable* top) {
10677 Relocatable* current = top; 10674 Relocatable* current = top;
10678 while (current != NULL) { 10675 while (current != NULL) {
10679 current->IterateInstance(v); 10676 current->IterateInstance(v);
10680 current = current->prev_; 10677 current = current->prev_;
10681 } 10678 }
10682 } 10679 }
10683 10680
10684 10681
10685 FlatStringReader::FlatStringReader(Isolate* isolate, Handle<String> str) 10682 FlatStringReader::FlatStringReader(Isolate* isolate, Handle<String> str)
10686 : Relocatable(isolate), 10683 : Relocatable(isolate),
(...skipping 3180 matching lines...) Expand 10 before | Expand all | Expand 10 after
13867 if (entry != kNotFound) { 13864 if (entry != kNotFound) {
13868 FixedArray* code_map = optimized_code_map(); 13865 FixedArray* code_map = optimized_code_map();
13869 DCHECK_LE(entry + kEntryLength, code_map->length()); 13866 DCHECK_LE(entry + kEntryLength, code_map->length());
13870 WeakCell* cell = WeakCell::cast(code_map->get(entry + kCachedCodeOffset)); 13867 WeakCell* cell = WeakCell::cast(code_map->get(entry + kCachedCodeOffset));
13871 result = cell->cleared() ? nullptr : Code::cast(cell->value()); 13868 result = cell->cleared() ? nullptr : Code::cast(cell->value());
13872 } 13869 }
13873 return result; 13870 return result;
13874 } 13871 }
13875 13872
13876 13873
13877 #define DECLARE_TAG(ignore1, name, ignore2) name,
13878 const char* const VisitorSynchronization::kTags[
13879 VisitorSynchronization::kNumberOfSyncTags] = {
13880 VISITOR_SYNCHRONIZATION_TAGS_LIST(DECLARE_TAG)
13881 };
13882 #undef DECLARE_TAG
13883
13884
13885 #define DECLARE_TAG(ignore1, ignore2, name) name,
13886 const char* const VisitorSynchronization::kTagNames[
13887 VisitorSynchronization::kNumberOfSyncTags] = {
13888 VISITOR_SYNCHRONIZATION_TAGS_LIST(DECLARE_TAG)
13889 };
13890 #undef DECLARE_TAG
13891
13892
13893 void ObjectVisitor::VisitCodeTarget(RelocInfo* rinfo) { 13874 void ObjectVisitor::VisitCodeTarget(RelocInfo* rinfo) {
13894 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode())); 13875 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode()));
13895 Object* old_pointer = Code::GetCodeFromTargetAddress(rinfo->target_address()); 13876 Object* old_pointer = Code::GetCodeFromTargetAddress(rinfo->target_address());
13896 Object* new_pointer = old_pointer; 13877 Object* new_pointer = old_pointer;
13897 VisitPointer(&new_pointer); 13878 VisitPointer(&new_pointer);
13898 DCHECK_EQ(old_pointer, new_pointer); 13879 DCHECK_EQ(old_pointer, new_pointer);
13899 } 13880 }
13900 13881
13901 13882
13902 void ObjectVisitor::VisitCodeAgeSequence(RelocInfo* rinfo) { 13883 void ObjectVisitor::VisitCodeAgeSequence(RelocInfo* rinfo) {
(...skipping 6551 matching lines...) Expand 10 before | Expand all | Expand 10 after
20454 // depend on this. 20435 // depend on this.
20455 return DICTIONARY_ELEMENTS; 20436 return DICTIONARY_ELEMENTS;
20456 } 20437 }
20457 DCHECK_LE(kind, LAST_ELEMENTS_KIND); 20438 DCHECK_LE(kind, LAST_ELEMENTS_KIND);
20458 return kind; 20439 return kind;
20459 } 20440 }
20460 } 20441 }
20461 20442
20462 } // namespace internal 20443 } // namespace internal
20463 } // namespace v8 20444 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698