OLD | NEW |
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 #ifndef V8_CONTEXT_MEASURE_H_ | 5 #ifndef V8_CONTEXT_MEASURE_H_ |
6 #define V8_CONTEXT_MEASURE_H_ | 6 #define V8_CONTEXT_MEASURE_H_ |
7 | 7 |
8 #include "src/address-map.h" | 8 #include "src/address-map.h" |
9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 class ContextMeasure : public ObjectVisitor { | 15 class ContextMeasure : public ObjectVisitor { |
16 public: | 16 public: |
17 explicit ContextMeasure(Context* context); | 17 explicit ContextMeasure(Context* context); |
18 | 18 |
19 int Size() { return size_; } | 19 int Size() { return size_; } |
20 int Count() { return count_; } | 20 int Count() { return count_; } |
21 | 21 |
22 void VisitPointers(Object** start, Object** end); | 22 void VisitPointers(Object** start, Object** end) override; |
23 | 23 |
24 private: | 24 private: |
25 void MeasureObject(HeapObject* object); | 25 void MeasureObject(HeapObject* object); |
26 void MeasureDeferredObjects(); | 26 void MeasureDeferredObjects(); |
27 void MeasureAndRecurse(HeapObject* object); | 27 void MeasureAndRecurse(HeapObject* object); |
28 bool IsShared(HeapObject* object); | 28 bool IsShared(HeapObject* object); |
29 | 29 |
30 Context* context_; | 30 Context* context_; |
31 | 31 |
32 BackReferenceMap back_reference_map_; | 32 BackReferenceMap back_reference_map_; |
33 RootIndexMap root_index_map_; | 33 RootIndexMap root_index_map_; |
34 | 34 |
35 static const int kMaxRecursion = 16; | 35 static const int kMaxRecursion = 16; |
36 int recursion_depth_; | 36 int recursion_depth_; |
37 List<HeapObject*> deferred_objects_; | 37 List<HeapObject*> deferred_objects_; |
38 | 38 |
39 int count_; | 39 int count_; |
40 int size_; | 40 int size_; |
41 | 41 |
42 DisallowHeapAllocation no_gc_; | 42 DisallowHeapAllocation no_gc_; |
43 | 43 |
44 DISALLOW_COPY_AND_ASSIGN(ContextMeasure); | 44 DISALLOW_COPY_AND_ASSIGN(ContextMeasure); |
45 }; | 45 }; |
46 } // namespace internal | 46 } // namespace internal |
47 } // namespace v8 | 47 } // namespace v8 |
48 | 48 |
49 #endif // V8_CONTEXT_MEASURE_H_ | 49 #endif // V8_CONTEXT_MEASURE_H_ |
OLD | NEW |