Chromium Code Reviews| Index: src/objects.h |
| diff --git a/src/objects.h b/src/objects.h |
| index 45f5ba0c0a3c7f3d1cb5250abbfd7711bd3c760c..2d358048957998409514bcab8214aaf59879ab48 100644 |
| --- a/src/objects.h |
| +++ b/src/objects.h |
| @@ -1062,6 +1062,7 @@ template <class C> inline bool Is(Object* obj); |
| V(DependentCode) \ |
| V(HandlerTable) \ |
| V(FixedArray) \ |
| + V(ConstantProperties) \ |
| V(FixedDoubleArray) \ |
| V(WeakFixedArray) \ |
| V(ArrayList) \ |
| @@ -2914,6 +2915,28 @@ class FixedArray: public FixedArrayBase { |
| DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray); |
| }; |
| +// ConstantProperties is a special FixedArray of constant properties that |
| +// provides access to the total number of properties (constant and |
| +// non-constant). |
| +// Usually, the number of properties is half the length of the |
| +// FixedArray (half because it consists of key-value pairs), but there could |
| +// have been non-constant property names for which we need to allocate space in |
| +// the property backing store as well. |
| +// The parser stores the total number after the last object in |
| +// the FixedArray. ConstantProperties simplifies access to this number. |
|
Toon Verwaest
2017/01/18 08:49:53
What about also adding name(i) and value(i) which
Franzi
2017/01/18 14:23:10
name() and value() looks nice. Thanks! Changed the
|
| +class ConstantProperties : public FixedArray { |
| + public: |
| + // Number of constant and non-constant properties. |
| + int const number_of_properties(); |
| + // Actual size of the FixedArray, i.e., twice the number of constant |
| + // properties without the field that contains the total number. |
| + int const length(); |
| + |
| + DECLARE_CAST(ConstantProperties) |
| + |
| + private: |
| + bool const has_number_of_properties(); |
| +}; |
| // FixedDoubleArray describes fixed-sized arrays with element type double. |
| class FixedDoubleArray: public FixedArrayBase { |
| @@ -6397,7 +6420,6 @@ class Map: public HeapObject { |
| static const int kInstanceTypeAndBitFieldOffset = |
| kInstanceAttributesOffset + 0; |
| static const int kBitField2Offset = kInstanceAttributesOffset + 2; |
| - static const int kUnusedPropertyFieldsByte = 3; |
|
Toon Verwaest
2017/01/18 08:49:53
why remove this?
Franzi
2017/01/18 14:23:10
Noticed that it's unused. Any reason we need to ke
|
| static const int kUnusedPropertyFieldsOffset = kInstanceAttributesOffset + 3; |
| STATIC_ASSERT(kInstanceTypeAndBitFieldOffset == |