| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 bool IsTransition() { | 141 bool IsTransition() { |
| 142 PropertyType t = type(); | 142 PropertyType t = type(); |
| 143 ASSERT(t != INTERCEPTOR); | 143 ASSERT(t != INTERCEPTOR); |
| 144 return t == MAP_TRANSITION || t == CONSTANT_TRANSITION; | 144 return t == MAP_TRANSITION || t == CONSTANT_TRANSITION; |
| 145 } | 145 } |
| 146 | 146 |
| 147 PropertyAttributes attributes() { return AttributesField::decode(value_); } | 147 PropertyAttributes attributes() { return AttributesField::decode(value_); } |
| 148 | 148 |
| 149 int index() { return IndexField::decode(value_); } | 149 int index() { return IndexField::decode(value_); } |
| 150 | 150 |
| 151 inline PropertyDetails AsDeleted(); |
| 152 |
| 151 static bool IsValidIndex(int index) { return IndexField::is_valid(index); } | 153 static bool IsValidIndex(int index) { return IndexField::is_valid(index); } |
| 152 | 154 |
| 153 bool IsReadOnly() { return (attributes() & READ_ONLY) != 0; } | 155 bool IsReadOnly() { return (attributes() & READ_ONLY) != 0; } |
| 154 bool IsDontDelete() { return (attributes() & DONT_DELETE) != 0; } | 156 bool IsDontDelete() { return (attributes() & DONT_DELETE) != 0; } |
| 155 bool IsDontEnum() { return (attributes() & DONT_ENUM) != 0; } | 157 bool IsDontEnum() { return (attributes() & DONT_ENUM) != 0; } |
| 158 bool IsDeleted() { return DeletedField::decode(value_) != 0;} |
| 156 | 159 |
| 157 // Bit fields in value_ (type, shift, size). Must be public so the | 160 // Bit fields in value_ (type, shift, size). Must be public so the |
| 158 // constants can be embedded in generated code. | 161 // constants can be embedded in generated code. |
| 159 class TypeField: public BitField<PropertyType, 0, 3> {}; | 162 class TypeField: public BitField<PropertyType, 0, 3> {}; |
| 160 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; | 163 class AttributesField: public BitField<PropertyAttributes, 3, 3> {}; |
| 161 class IndexField: public BitField<uint32_t, 6, 31-6> {}; | 164 class DeletedField: public BitField<uint32_t, 6, 1> {}; |
| 165 class IndexField: public BitField<uint32_t, 7, 31-7> {}; |
| 162 | 166 |
| 163 static const int kInitialIndex = 1; | 167 static const int kInitialIndex = 1; |
| 164 | |
| 165 private: | 168 private: |
| 166 uint32_t value_; | 169 uint32_t value_; |
| 167 }; | 170 }; |
| 168 | 171 |
| 169 | 172 |
| 170 // Setter that skips the write barrier if mode is SKIP_WRITE_BARRIER. | 173 // Setter that skips the write barrier if mode is SKIP_WRITE_BARRIER. |
| 171 enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER }; | 174 enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER }; |
| 172 | 175 |
| 173 | 176 |
| 174 // PropertyNormalizationMode is used to specify whether to keep | 177 // PropertyNormalizationMode is used to specify whether to keep |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 // Sets the property value in a normalized object given a lookup result. | 1187 // Sets the property value in a normalized object given a lookup result. |
| 1185 // Handles the special representation of JS global objects. | 1188 // Handles the special representation of JS global objects. |
| 1186 Object* SetNormalizedProperty(LookupResult* result, Object* value); | 1189 Object* SetNormalizedProperty(LookupResult* result, Object* value); |
| 1187 | 1190 |
| 1188 // Sets the property value in a normalized object given (key, value, details). | 1191 // Sets the property value in a normalized object given (key, value, details). |
| 1189 // Handles the special representation of JS global objects. | 1192 // Handles the special representation of JS global objects. |
| 1190 Object* SetNormalizedProperty(String* name, | 1193 Object* SetNormalizedProperty(String* name, |
| 1191 Object* value, | 1194 Object* value, |
| 1192 PropertyDetails details); | 1195 PropertyDetails details); |
| 1193 | 1196 |
| 1197 // Deletes the named property in a normalized object. |
| 1198 Object* DeleteNormalizedProperty(String* name); |
| 1199 |
| 1194 // Sets a property that currently has lazy loading. | 1200 // Sets a property that currently has lazy loading. |
| 1195 Object* SetLazyProperty(LookupResult* result, | 1201 Object* SetLazyProperty(LookupResult* result, |
| 1196 String* name, | 1202 String* name, |
| 1197 Object* value, | 1203 Object* value, |
| 1198 PropertyAttributes attributes); | 1204 PropertyAttributes attributes); |
| 1199 | 1205 |
| 1200 // Returns the class name ([[Class]] property in the specification). | 1206 // Returns the class name ([[Class]] property in the specification). |
| 1201 String* class_name(); | 1207 String* class_name(); |
| 1202 | 1208 |
| 1203 // Retrieve interceptors. | 1209 // Retrieve interceptors. |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1831 } | 1837 } |
| 1832 | 1838 |
| 1833 static const int kNumberOfElementsIndex = 0; | 1839 static const int kNumberOfElementsIndex = 0; |
| 1834 static const int kCapacityIndex = 1; | 1840 static const int kCapacityIndex = 1; |
| 1835 static const int kPrefixStartIndex = 2; | 1841 static const int kPrefixStartIndex = 2; |
| 1836 static const int kElementsStartIndex = kPrefixStartIndex + prefix_size; | 1842 static const int kElementsStartIndex = kPrefixStartIndex + prefix_size; |
| 1837 static const int kElementSize = element_size; | 1843 static const int kElementSize = element_size; |
| 1838 static const int kElementsStartOffset = | 1844 static const int kElementsStartOffset = |
| 1839 kHeaderSize + kElementsStartIndex * kPointerSize; | 1845 kHeaderSize + kElementsStartIndex * kPointerSize; |
| 1840 | 1846 |
| 1847 // Constant used for denoting a absent entry. |
| 1848 static const int kNotFound = -1; |
| 1849 |
| 1841 protected: | 1850 protected: |
| 1842 // Find entry for key otherwise return -1. | 1851 // Find entry for key otherwise return -1. |
| 1843 int FindEntry(HashTableKey* key); | 1852 int FindEntry(HashTableKey* key); |
| 1844 | 1853 |
| 1845 // Find the entry at which to insert element with the given key that | 1854 // Find the entry at which to insert element with the given key that |
| 1846 // has the given hash value. | 1855 // has the given hash value. |
| 1847 uint32_t FindInsertionEntry(Object* key, uint32_t hash); | 1856 uint32_t FindInsertionEntry(Object* key, uint32_t hash); |
| 1848 | 1857 |
| 1849 // Returns the index for an entry (of the key) | 1858 // Returns the index for an entry (of the key) |
| 1850 static inline int EntryToIndex(int entry) { | 1859 static inline int EntryToIndex(int entry) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1927 // fast-case properties array. | 1936 // fast-case properties array. |
| 1928 // | 1937 // |
| 1929 // LookupCaches are used to avoid repeatedly searching instance | 1938 // LookupCaches are used to avoid repeatedly searching instance |
| 1930 // descriptors. | 1939 // descriptors. |
| 1931 class LookupCache: public HashTable<0, 2> { | 1940 class LookupCache: public HashTable<0, 2> { |
| 1932 public: | 1941 public: |
| 1933 int Lookup(Map* map, String* name); | 1942 int Lookup(Map* map, String* name); |
| 1934 Object* Put(Map* map, String* name, int offset); | 1943 Object* Put(Map* map, String* name, int offset); |
| 1935 static inline LookupCache* cast(Object* obj); | 1944 static inline LookupCache* cast(Object* obj); |
| 1936 | 1945 |
| 1937 // Constant returned by Lookup when the key was not found. | |
| 1938 static const int kNotFound = -1; | |
| 1939 | |
| 1940 private: | 1946 private: |
| 1941 DISALLOW_IMPLICIT_CONSTRUCTORS(LookupCache); | 1947 DISALLOW_IMPLICIT_CONSTRUCTORS(LookupCache); |
| 1942 }; | 1948 }; |
| 1943 | 1949 |
| 1944 | 1950 |
| 1945 // Dictionary for keeping properties and elements in slow case. | 1951 // Dictionary for keeping properties and elements in slow case. |
| 1946 // | 1952 // |
| 1947 // One element in the prefix is used for storing non-element | 1953 // One element in the prefix is used for storing non-element |
| 1948 // information about the dictionary. | 1954 // information about the dictionary. |
| 1949 // | 1955 // |
| (...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4300 } else { | 4306 } else { |
| 4301 value &= ~(1 << bit_position); | 4307 value &= ~(1 << bit_position); |
| 4302 } | 4308 } |
| 4303 return value; | 4309 return value; |
| 4304 } | 4310 } |
| 4305 }; | 4311 }; |
| 4306 | 4312 |
| 4307 } } // namespace v8::internal | 4313 } } // namespace v8::internal |
| 4308 | 4314 |
| 4309 #endif // V8_OBJECTS_H_ | 4315 #endif // V8_OBJECTS_H_ |
| OLD | NEW |