| 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 #ifndef V8_PROFILER_HEAP_SNAPSHOT_GENERATOR_H_ | 5 #ifndef V8_PROFILER_HEAP_SNAPSHOT_GENERATOR_H_ |
| 6 #define V8_PROFILER_HEAP_SNAPSHOT_GENERATOR_H_ | 6 #define V8_PROFILER_HEAP_SNAPSHOT_GENERATOR_H_ |
| 7 | 7 |
| 8 #include "include/v8-profiler.h" | 8 #include "include/v8-profiler.h" |
| 9 #include "src/base/platform/time.h" | 9 #include "src/base/platform/time.h" |
| 10 #include "src/objects.h" | 10 #include "src/objects.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 return index_; | 43 return index_; |
| 44 } | 44 } |
| 45 const char* name() const { | 45 const char* name() const { |
| 46 DCHECK(type() == kContextVariable || type() == kProperty || | 46 DCHECK(type() == kContextVariable || type() == kProperty || |
| 47 type() == kInternal || type() == kShortcut || type() == kWeak); | 47 type() == kInternal || type() == kShortcut || type() == kWeak); |
| 48 return name_; | 48 return name_; |
| 49 } | 49 } |
| 50 INLINE(HeapEntry* from() const); | 50 INLINE(HeapEntry* from() const); |
| 51 HeapEntry* to() const { return to_entry_; } | 51 HeapEntry* to() const { return to_entry_; } |
| 52 | 52 |
| 53 INLINE(Isolate* isolate() const); |
| 54 |
| 53 private: | 55 private: |
| 54 INLINE(HeapSnapshot* snapshot() const); | 56 INLINE(HeapSnapshot* snapshot() const); |
| 55 int from_index() const { return FromIndexField::decode(bit_field_); } | 57 int from_index() const { return FromIndexField::decode(bit_field_); } |
| 56 | 58 |
| 57 class TypeField : public BitField<Type, 0, 3> {}; | 59 class TypeField : public BitField<Type, 0, 3> {}; |
| 58 class FromIndexField : public BitField<int, 3, 29> {}; | 60 class FromIndexField : public BitField<int, 3, 29> {}; |
| 59 uint32_t bit_field_; | 61 uint32_t bit_field_; |
| 60 union { | 62 union { |
| 61 // During entries population |to_index_| is used for storing the index, | 63 // During entries population |to_index_| is used for storing the index, |
| 62 // afterwards it is replaced with a pointer to the entry. | 64 // afterwards it is replaced with a pointer to the entry. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 size_t self_size() { return self_size_; } | 110 size_t self_size() { return self_size_; } |
| 109 unsigned trace_node_id() const { return trace_node_id_; } | 111 unsigned trace_node_id() const { return trace_node_id_; } |
| 110 INLINE(int index() const); | 112 INLINE(int index() const); |
| 111 int children_count() const { return children_count_; } | 113 int children_count() const { return children_count_; } |
| 112 INLINE(int set_children_index(int index)); | 114 INLINE(int set_children_index(int index)); |
| 113 void add_child(HeapGraphEdge* edge) { | 115 void add_child(HeapGraphEdge* edge) { |
| 114 children_arr()[children_count_++] = edge; | 116 children_arr()[children_count_++] = edge; |
| 115 } | 117 } |
| 116 Vector<HeapGraphEdge*> children() { | 118 Vector<HeapGraphEdge*> children() { |
| 117 return Vector<HeapGraphEdge*>(children_arr(), children_count_); } | 119 return Vector<HeapGraphEdge*>(children_arr(), children_count_); } |
| 120 INLINE(Isolate* isolate() const); |
| 118 | 121 |
| 119 void SetIndexedReference( | 122 void SetIndexedReference( |
| 120 HeapGraphEdge::Type type, int index, HeapEntry* entry); | 123 HeapGraphEdge::Type type, int index, HeapEntry* entry); |
| 121 void SetNamedReference( | 124 void SetNamedReference( |
| 122 HeapGraphEdge::Type type, const char* name, HeapEntry* entry); | 125 HeapGraphEdge::Type type, const char* name, HeapEntry* entry); |
| 123 | 126 |
| 124 void Print( | 127 void Print( |
| 125 const char* prefix, const char* edge_name, int max_depth, int indent); | 128 const char* prefix, const char* edge_name, int max_depth, int indent); |
| 126 | 129 |
| 127 private: | 130 private: |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 friend class HeapSnapshotJSONSerializerIterator; | 620 friend class HeapSnapshotJSONSerializerIterator; |
| 618 | 621 |
| 619 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 622 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
| 620 }; | 623 }; |
| 621 | 624 |
| 622 | 625 |
| 623 } // namespace internal | 626 } // namespace internal |
| 624 } // namespace v8 | 627 } // namespace v8 |
| 625 | 628 |
| 626 #endif // V8_PROFILER_HEAP_SNAPSHOT_GENERATOR_H_ | 629 #endif // V8_PROFILER_HEAP_SNAPSHOT_GENERATOR_H_ |
| OLD | NEW |