Chromium Code Reviews| Index: src/heap-snapshot-generator.h |
| diff --git a/src/heap-snapshot-generator.h b/src/heap-snapshot-generator.h |
| index 646d497085d19c396d97544054d02371dc0af5bf..fb4387617d529ed1c65681826bf89701e2285733 100644 |
| --- a/src/heap-snapshot-generator.h |
| +++ b/src/heap-snapshot-generator.h |
| @@ -28,22 +28,18 @@ class HeapGraphEdge BASE_EMBEDDED { |
| kWeak = v8::HeapGraphEdge::kWeak |
| }; |
| - HeapGraphEdge() { } |
| HeapGraphEdge(Type type, const char* name, int from, int to); |
| HeapGraphEdge(Type type, int index, int from, int to); |
| void ReplaceToIndexWithEntry(HeapSnapshot* snapshot); |
| - Type type() const { return static_cast<Type>(type_); } |
| + Type type() const { return TypeField::decode(bit_field_); } |
| int index() const { |
| - DCHECK(type_ == kElement || type_ == kHidden); |
| + DCHECK(type() == kElement || type() == kHidden); |
| return index_; |
| } |
| const char* name() const { |
| - DCHECK(type_ == kContextVariable |
| - || type_ == kProperty |
| - || type_ == kInternal |
| - || type_ == kShortcut |
| - || type_ == kWeak); |
| + DCHECK(type() == kContextVariable || type() == kProperty || |
| + type() == kInternal || type() == kShortcut || type() == kWeak); |
| return name_; |
| } |
| INLINE(HeapEntry* from() const); |
| @@ -51,9 +47,11 @@ class HeapGraphEdge BASE_EMBEDDED { |
| private: |
| INLINE(HeapSnapshot* snapshot() const); |
| + int from_index() const { return FromIndexField::decode(bit_field_); } |
| - unsigned type_ : 3; |
| - int from_index_ : 29; |
|
brucedawson
2014/11/05 01:33:17
FWIW, I believe that this usage of bit fields is p
|
| + class TypeField : public BitField<Type, 0, 3> {}; |
| + class FromIndexField : public BitField<int, 3, 29> {}; |
| + uint32_t bit_field_; |
| union { |
| // During entries population |to_index_| is used for storing the index, |
| // afterwards it is replaced with a pointer to the entry. |