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.
5 #ifndef V8_CONTEXT_MEASURE_H_
6 #define V8_CONTEXT_MEASURE_H_
8 #include "src/snapshot/serialize.h"
13 class ContextMeasure : public ObjectVisitor {
15 explicit ContextMeasure(Context* context);
17 int Size() { return size_; }
18 int Count() { return count_; }
20 void VisitPointers(Object** start, Object** end);
23 void MeasureObject(HeapObject* object);
24 void MeasureDeferredObjects();
25 void MeasureAndRecurse(HeapObject* object);
26 bool IsShared(HeapObject* object);
30 BackReferenceMap back_reference_map_;
31 RootIndexMap root_index_map_;
33 static const int kMaxRecursion = 16;
35 List<HeapObject*> deferred_objects_;
40 DisallowHeapAllocation no_gc_;
42 DISALLOW_COPY_AND_ASSIGN(ContextMeasure);
45 } // namespace v8::internal
47 #endif // V8_CONTEXT_MEASURE_H_