OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2147 template <typename Shape, typename Key> | 2147 template <typename Shape, typename Key> |
2148 class Dictionary: public HashTable<Shape, Key> { | 2148 class Dictionary: public HashTable<Shape, Key> { |
2149 public: | 2149 public: |
2150 | 2150 |
2151 static inline Dictionary<Shape, Key>* cast(Object* obj) { | 2151 static inline Dictionary<Shape, Key>* cast(Object* obj) { |
2152 return reinterpret_cast<Dictionary<Shape, Key>*>(obj); | 2152 return reinterpret_cast<Dictionary<Shape, Key>*>(obj); |
2153 } | 2153 } |
2154 | 2154 |
2155 // Returns the value at entry. | 2155 // Returns the value at entry. |
2156 Object* ValueAt(int entry) { | 2156 Object* ValueAt(int entry) { |
2157 return get(HashTable<Shape, Key>::EntryToIndex(entry)+1); | 2157 return this->get(HashTable<Shape, Key>::EntryToIndex(entry)+1); |
2158 } | 2158 } |
2159 | 2159 |
2160 // Set the value for entry. | 2160 // Set the value for entry. |
2161 void ValueAtPut(int entry, Object* value) { | 2161 void ValueAtPut(int entry, Object* value) { |
2162 set(HashTable<Shape, Key>::EntryToIndex(entry)+1, value); | 2162 this->set(HashTable<Shape, Key>::EntryToIndex(entry)+1, value); |
2163 } | 2163 } |
2164 | 2164 |
2165 // Returns the property details for the property at entry. | 2165 // Returns the property details for the property at entry. |
2166 PropertyDetails DetailsAt(int entry) { | 2166 PropertyDetails DetailsAt(int entry) { |
2167 ASSERT(entry >= 0); // Not found is -1, which is not caught by get(). | 2167 ASSERT(entry >= 0); // Not found is -1, which is not caught by get(). |
2168 return PropertyDetails( | 2168 return PropertyDetails( |
2169 Smi::cast(get(HashTable<Shape, Key>::EntryToIndex(entry) + 2))); | 2169 Smi::cast(this->get(HashTable<Shape, Key>::EntryToIndex(entry) + 2))); |
2170 } | 2170 } |
2171 | 2171 |
2172 // Set the details for entry. | 2172 // Set the details for entry. |
2173 void DetailsAtPut(int entry, PropertyDetails value) { | 2173 void DetailsAtPut(int entry, PropertyDetails value) { |
2174 set(HashTable<Shape, Key>::EntryToIndex(entry) + 2, value.AsSmi()); | 2174 this->set(HashTable<Shape, Key>::EntryToIndex(entry) + 2, value.AsSmi()); |
2175 } | 2175 } |
2176 | 2176 |
2177 // Sorting support | 2177 // Sorting support |
2178 void CopyValuesTo(FixedArray* elements); | 2178 void CopyValuesTo(FixedArray* elements); |
2179 | 2179 |
2180 // Delete a property from the dictionary. | 2180 // Delete a property from the dictionary. |
2181 Object* DeleteProperty(int entry, JSObject::DeleteMode mode); | 2181 Object* DeleteProperty(int entry, JSObject::DeleteMode mode); |
2182 | 2182 |
2183 // Returns the number of elements in the dictionary filtering out properties | 2183 // Returns the number of elements in the dictionary filtering out properties |
2184 // with the specified attributes. | 2184 // with the specified attributes. |
2185 int NumberOfElementsFilterAttributes(PropertyAttributes filter); | 2185 int NumberOfElementsFilterAttributes(PropertyAttributes filter); |
2186 | 2186 |
2187 // Returns the number of enumerable elements in the dictionary. | 2187 // Returns the number of enumerable elements in the dictionary. |
2188 int NumberOfEnumElements(); | 2188 int NumberOfEnumElements(); |
2189 | 2189 |
2190 // Copies keys to preallocated fixed array. | 2190 // Copies keys to preallocated fixed array. |
2191 void CopyKeysTo(FixedArray* storage, PropertyAttributes filter); | 2191 void CopyKeysTo(FixedArray* storage, PropertyAttributes filter); |
2192 // Fill in details for properties into storage. | 2192 // Fill in details for properties into storage. |
2193 void CopyKeysTo(FixedArray* storage); | 2193 void CopyKeysTo(FixedArray* storage); |
2194 | 2194 |
2195 // Accessors for next enumeration index. | 2195 // Accessors for next enumeration index. |
2196 void SetNextEnumerationIndex(int index) { | 2196 void SetNextEnumerationIndex(int index) { |
2197 fast_set(this, kNextEnumerationIndexIndex, Smi::FromInt(index)); | 2197 this->fast_set(this, kNextEnumerationIndexIndex, Smi::FromInt(index)); |
2198 } | 2198 } |
2199 | 2199 |
2200 int NextEnumerationIndex() { | 2200 int NextEnumerationIndex() { |
2201 return Smi::cast(FixedArray::get(kNextEnumerationIndexIndex))->value(); | 2201 return Smi::cast(FixedArray::get(kNextEnumerationIndexIndex))->value(); |
2202 } | 2202 } |
2203 | 2203 |
2204 // Returns a new array for dictionary usage. Might return Failure. | 2204 // Returns a new array for dictionary usage. Might return Failure. |
2205 static Object* Allocate(int at_least_space_for); | 2205 static Object* Allocate(int at_least_space_for); |
2206 | 2206 |
2207 // Ensure enough space for n additional elements. | 2207 // Ensure enough space for n additional elements. |
(...skipping 2881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5089 } else { | 5089 } else { |
5090 value &= ~(1 << bit_position); | 5090 value &= ~(1 << bit_position); |
5091 } | 5091 } |
5092 return value; | 5092 return value; |
5093 } | 5093 } |
5094 }; | 5094 }; |
5095 | 5095 |
5096 } } // namespace v8::internal | 5096 } } // namespace v8::internal |
5097 | 5097 |
5098 #endif // V8_OBJECTS_H_ | 5098 #endif // V8_OBJECTS_H_ |
OLD | NEW |