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