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_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/assert-scope.h" | 10 #include "src/assert-scope.h" |
(...skipping 3467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3478 // with the specified attributes. | 3478 // with the specified attributes. |
3479 // TODO(jkummerow): Deprecated, only used by Object.observe. | 3479 // TODO(jkummerow): Deprecated, only used by Object.observe. |
3480 int NumberOfElementsFilterAttributes(PropertyFilter filter); | 3480 int NumberOfElementsFilterAttributes(PropertyFilter filter); |
3481 | 3481 |
3482 // Returns the number of enumerable elements in the dictionary. | 3482 // Returns the number of enumerable elements in the dictionary. |
3483 // TODO(jkummerow): Deprecated, only used by Object.observe. | 3483 // TODO(jkummerow): Deprecated, only used by Object.observe. |
3484 int NumberOfEnumElements() { | 3484 int NumberOfEnumElements() { |
3485 return NumberOfElementsFilterAttributes(ENUMERABLE_STRINGS); | 3485 return NumberOfElementsFilterAttributes(ENUMERABLE_STRINGS); |
3486 } | 3486 } |
3487 | 3487 |
3488 // Returns true if the dictionary contains any elements that are non-writable, | |
3489 // non-configurable, non-enumerable, or have getters/setters. | |
3490 bool HasComplexElements(); | |
3491 | |
3492 enum SortMode { UNSORTED, SORTED }; | 3488 enum SortMode { UNSORTED, SORTED }; |
3493 | 3489 |
3494 // Fill in details for properties into storage. | 3490 // Fill in details for properties into storage. |
3495 // Returns the number of properties added. | 3491 // Returns the number of properties added. |
3496 // TODO(jkummerow): Deprecated, only used by Object.observe. | 3492 // TODO(jkummerow): Deprecated, only used by Object.observe. |
3497 int CopyKeysTo(FixedArray* storage, int index, PropertyFilter filter, | 3493 int CopyKeysTo(FixedArray* storage, int index, PropertyFilter filter, |
3498 SortMode sort_mode); | 3494 SortMode sort_mode); |
3499 // Collect the keys into the given KeyAccumulator, in ascending chronological | 3495 // Collect the keys into the given KeyAccumulator, in ascending chronological |
3500 // order of property creation. | 3496 // order of property creation. |
3501 static void CollectKeysTo(Handle<Dictionary<Derived, Shape, Key> > dictionary, | 3497 static void CollectKeysTo(Handle<Dictionary<Derived, Shape, Key> > dictionary, |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3714 Handle<Object> value, PropertyDetails details, bool used_as_prototype); | 3710 Handle<Object> value, PropertyDetails details, bool used_as_prototype); |
3715 | 3711 |
3716 // Set an existing entry or add a new one if needed. | 3712 // Set an existing entry or add a new one if needed. |
3717 // Return the updated dictionary. | 3713 // Return the updated dictionary. |
3718 MUST_USE_RESULT static Handle<SeededNumberDictionary> Set( | 3714 MUST_USE_RESULT static Handle<SeededNumberDictionary> Set( |
3719 Handle<SeededNumberDictionary> dictionary, uint32_t key, | 3715 Handle<SeededNumberDictionary> dictionary, uint32_t key, |
3720 Handle<Object> value, PropertyDetails details, bool used_as_prototype); | 3716 Handle<Object> value, PropertyDetails details, bool used_as_prototype); |
3721 | 3717 |
3722 void UpdateMaxNumberKey(uint32_t key, bool used_as_prototype); | 3718 void UpdateMaxNumberKey(uint32_t key, bool used_as_prototype); |
3723 | 3719 |
| 3720 // Returns true if the dictionary contains any elements that are non-writable, |
| 3721 // non-configurable, non-enumerable, or have getters/setters. |
| 3722 bool HasComplexElements(); |
| 3723 |
3724 // If slow elements are required we will never go back to fast-case | 3724 // If slow elements are required we will never go back to fast-case |
3725 // for the elements kept in this dictionary. We require slow | 3725 // for the elements kept in this dictionary. We require slow |
3726 // elements if an element has been added at an index larger than | 3726 // elements if an element has been added at an index larger than |
3727 // kRequiresSlowElementsLimit or set_requires_slow_elements() has been called | 3727 // kRequiresSlowElementsLimit or set_requires_slow_elements() has been called |
3728 // when defining a getter or setter with a number key. | 3728 // when defining a getter or setter with a number key. |
3729 inline bool requires_slow_elements(); | 3729 inline bool requires_slow_elements(); |
3730 inline void set_requires_slow_elements(); | 3730 inline void set_requires_slow_elements(); |
3731 | 3731 |
3732 // Get the value of the max number key that has been added to this | 3732 // Get the value of the max number key that has been added to this |
3733 // dictionary. max_number_key can only be called if | 3733 // dictionary. max_number_key can only be called if |
(...skipping 7153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10887 } | 10887 } |
10888 return value; | 10888 return value; |
10889 } | 10889 } |
10890 }; | 10890 }; |
10891 | 10891 |
10892 | 10892 |
10893 } // NOLINT, false-positive due to second-order macros. | 10893 } // NOLINT, false-positive due to second-order macros. |
10894 } // NOLINT, false-positive due to second-order macros. | 10894 } // NOLINT, false-positive due to second-order macros. |
10895 | 10895 |
10896 #endif // V8_OBJECTS_H_ | 10896 #endif // V8_OBJECTS_H_ |
OLD | NEW |