| 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/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1778 | 1778 |
| 1779 // Indicator for one component of an AccessorPair. | 1779 // Indicator for one component of an AccessorPair. |
| 1780 enum AccessorComponent { | 1780 enum AccessorComponent { |
| 1781 ACCESSOR_GETTER, | 1781 ACCESSOR_GETTER, |
| 1782 ACCESSOR_SETTER | 1782 ACCESSOR_SETTER |
| 1783 }; | 1783 }; |
| 1784 | 1784 |
| 1785 | 1785 |
| 1786 enum GetKeysConversion { KEEP_NUMBERS, CONVERT_TO_STRING }; | 1786 enum GetKeysConversion { KEEP_NUMBERS, CONVERT_TO_STRING }; |
| 1787 | 1787 |
| 1788 enum KeyCollectionType { OWN_ONLY, INCLUDE_PROTOS }; |
| 1788 | 1789 |
| 1789 // JSReceiver includes types on which properties can be defined, i.e., | 1790 // JSReceiver includes types on which properties can be defined, i.e., |
| 1790 // JSObject and JSProxy. | 1791 // JSObject and JSProxy. |
| 1791 class JSReceiver: public HeapObject { | 1792 class JSReceiver: public HeapObject { |
| 1792 public: | 1793 public: |
| 1793 // [properties]: Backing storage for properties. | 1794 // [properties]: Backing storage for properties. |
| 1794 // properties is a FixedArray in the fast case and a Dictionary in the | 1795 // properties is a FixedArray in the fast case and a Dictionary in the |
| 1795 // slow case. | 1796 // slow case. |
| 1796 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. | 1797 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. |
| 1797 inline void initialize_properties(); | 1798 inline void initialize_properties(); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1939 | 1940 |
| 1940 // Retrieves a permanent object identity hash code. The undefined value might | 1941 // Retrieves a permanent object identity hash code. The undefined value might |
| 1941 // be returned in case no hash was created yet. | 1942 // be returned in case no hash was created yet. |
| 1942 inline Object* GetIdentityHash(); | 1943 inline Object* GetIdentityHash(); |
| 1943 | 1944 |
| 1944 // Retrieves a permanent object identity hash code. May create and store a | 1945 // Retrieves a permanent object identity hash code. May create and store a |
| 1945 // hash code if needed and none exists. | 1946 // hash code if needed and none exists. |
| 1946 inline static Handle<Smi> GetOrCreateIdentityHash( | 1947 inline static Handle<Smi> GetOrCreateIdentityHash( |
| 1947 Handle<JSReceiver> object); | 1948 Handle<JSReceiver> object); |
| 1948 | 1949 |
| 1949 enum KeyCollectionType { OWN_ONLY, INCLUDE_PROTOS }; | |
| 1950 | |
| 1951 // ES6 [[OwnPropertyKeys]] (modulo return type) | 1950 // ES6 [[OwnPropertyKeys]] (modulo return type) |
| 1952 MUST_USE_RESULT static MaybeHandle<FixedArray> OwnPropertyKeys( | 1951 MUST_USE_RESULT static MaybeHandle<FixedArray> OwnPropertyKeys( |
| 1953 Handle<JSReceiver> object) { | 1952 Handle<JSReceiver> object) { |
| 1954 return GetKeys(object, JSReceiver::OWN_ONLY, ALL_PROPERTIES, | 1953 return GetKeys(object, OWN_ONLY, ALL_PROPERTIES, CONVERT_TO_STRING); |
| 1955 CONVERT_TO_STRING); | |
| 1956 } | 1954 } |
| 1957 | 1955 |
| 1958 // Computes the enumerable keys for a JSObject. Used for implementing | 1956 // Computes the enumerable keys for a JSObject. Used for implementing |
| 1959 // "for (n in object) { }". | 1957 // "for (n in object) { }". |
| 1960 MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys( | 1958 MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys( |
| 1961 Handle<JSReceiver> object, KeyCollectionType type, PropertyFilter filter, | 1959 Handle<JSReceiver> object, KeyCollectionType type, PropertyFilter filter, |
| 1962 GetKeysConversion keys_conversion = KEEP_NUMBERS); | 1960 GetKeysConversion keys_conversion = KEEP_NUMBERS); |
| 1963 | 1961 |
| 1964 // Layout description. | 1962 // Layout description. |
| 1965 static const int kPropertiesOffset = HeapObject::kHeaderSize; | 1963 static const int kPropertiesOffset = HeapObject::kHeaderSize; |
| (...skipping 8839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10805 } | 10803 } |
| 10806 return value; | 10804 return value; |
| 10807 } | 10805 } |
| 10808 }; | 10806 }; |
| 10809 | 10807 |
| 10810 | 10808 |
| 10811 } // NOLINT, false-positive due to second-order macros. | 10809 } // NOLINT, false-positive due to second-order macros. |
| 10812 } // NOLINT, false-positive due to second-order macros. | 10810 } // NOLINT, false-positive due to second-order macros. |
| 10813 | 10811 |
| 10814 #endif // V8_OBJECTS_H_ | 10812 #endif // V8_OBJECTS_H_ |
| OLD | NEW |