OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/profiler/heap-snapshot-generator.h" | 5 #include "src/profiler/heap-snapshot-generator.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 class IndexedReferencesExtractor : public ObjectVisitor { | 966 class IndexedReferencesExtractor : public ObjectVisitor { |
967 public: | 967 public: |
968 IndexedReferencesExtractor(V8HeapExplorer* generator, HeapObject* parent_obj, | 968 IndexedReferencesExtractor(V8HeapExplorer* generator, HeapObject* parent_obj, |
969 int parent) | 969 int parent) |
970 : generator_(generator), | 970 : generator_(generator), |
971 parent_obj_(parent_obj), | 971 parent_obj_(parent_obj), |
972 parent_start_(HeapObject::RawField(parent_obj_, 0)), | 972 parent_start_(HeapObject::RawField(parent_obj_, 0)), |
973 parent_end_(HeapObject::RawField(parent_obj_, parent_obj_->Size())), | 973 parent_end_(HeapObject::RawField(parent_obj_, parent_obj_->Size())), |
974 parent_(parent), | 974 parent_(parent), |
975 next_index_(0) {} | 975 next_index_(0) {} |
976 void VisitCodeEntry(Address entry_address) override { | 976 void VisitCodeEntry(JSFunction* host, Address entry_address) override { |
977 Code* code = Code::cast(Code::GetObjectFromEntryAddress(entry_address)); | 977 Code* code = Code::cast(Code::GetObjectFromEntryAddress(entry_address)); |
978 generator_->SetInternalReference(parent_obj_, parent_, "code", code); | 978 generator_->SetInternalReference(parent_obj_, parent_, "code", code); |
979 generator_->TagCodeObject(code); | 979 generator_->TagCodeObject(code); |
980 } | 980 } |
981 void VisitPointers(Object** start, Object** end) override { | 981 void VisitPointers(HeapObject* host, Object** start, Object** end) override { |
982 for (Object** p = start; p < end; p++) { | 982 for (Object** p = start; p < end; p++) { |
983 int index = static_cast<int>(p - HeapObject::RawField(parent_obj_, 0)); | 983 int index = static_cast<int>(p - HeapObject::RawField(parent_obj_, 0)); |
984 ++next_index_; | 984 ++next_index_; |
985 // |p| could be outside of the object, e.g., while visiting RelocInfo of | 985 // |p| could be outside of the object, e.g., while visiting RelocInfo of |
986 // code objects. | 986 // code objects. |
987 if (p >= parent_start_ && p < parent_end_ && generator_->marks_[index]) { | 987 if (p >= parent_start_ && p < parent_end_ && generator_->marks_[index]) { |
988 generator_->marks_[index] = false; | 988 generator_->marks_[index] = false; |
989 continue; | 989 continue; |
990 } | 990 } |
991 generator_->SetHiddenReference(parent_obj_, parent_, next_index_, *p, | 991 generator_->SetHiddenReference(parent_obj_, parent_, next_index_, *p, |
(...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3136 for (int i = 1; i < sorted_strings.length(); ++i) { | 3136 for (int i = 1; i < sorted_strings.length(); ++i) { |
3137 writer_->AddCharacter(','); | 3137 writer_->AddCharacter(','); |
3138 SerializeString(sorted_strings[i]); | 3138 SerializeString(sorted_strings[i]); |
3139 if (writer_->aborted()) return; | 3139 if (writer_->aborted()) return; |
3140 } | 3140 } |
3141 } | 3141 } |
3142 | 3142 |
3143 | 3143 |
3144 } // namespace internal | 3144 } // namespace internal |
3145 } // namespace v8 | 3145 } // namespace v8 |
OLD | NEW |