OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 ASSERT(elements_kind < kElementsKindCount); | 168 ASSERT(elements_kind < kElementsKindCount); |
169 return elements_accessors_[elements_kind]; | 169 return elements_accessors_[elements_kind]; |
170 } | 170 } |
171 | 171 |
172 static ElementsAccessor* ForArray(FixedArrayBase* array); | 172 static ElementsAccessor* ForArray(FixedArrayBase* array); |
173 | 173 |
174 static void InitializeOncePerProcess(); | 174 static void InitializeOncePerProcess(); |
175 static void TearDown(); | 175 static void TearDown(); |
176 | 176 |
177 protected: | 177 protected: |
178 friend class NonStrictArgumentsElementsAccessor; | 178 friend class SloppyArgumentsElementsAccessor; |
179 | 179 |
180 virtual uint32_t GetCapacity(FixedArrayBase* backing_store) = 0; | 180 virtual uint32_t GetCapacity(FixedArrayBase* backing_store) = 0; |
181 | 181 |
182 // Element handlers distinguish between indexes and keys when they manipulate | 182 // Element handlers distinguish between indexes and keys when they manipulate |
183 // elements. Indexes refer to elements in terms of their location in the | 183 // elements. Indexes refer to elements in terms of their location in the |
184 // underlying storage's backing store representation, and are between 0 and | 184 // underlying storage's backing store representation, and are between 0 and |
185 // GetCapacity. Keys refer to elements in terms of the value that would be | 185 // GetCapacity. Keys refer to elements in terms of the value that would be |
186 // specified in JavaScript to access the element. In most implementations, | 186 // specified in JavaScript to access the element. In most implementations, |
187 // keys are equivalent to indexes, and GetKeyForIndex returns the same value | 187 // keys are equivalent to indexes, and GetKeyForIndex returns the same value |
188 // it is passed. In the NumberDictionary ElementsAccessor, GetKeyForIndex maps | 188 // it is passed. In the NumberDictionary ElementsAccessor, GetKeyForIndex maps |
(...skipping 10 matching lines...) Expand all Loading... |
199 | 199 |
200 void CheckArrayAbuse(JSObject* obj, const char* op, uint32_t key, | 200 void CheckArrayAbuse(JSObject* obj, const char* op, uint32_t key, |
201 bool allow_appending = false); | 201 bool allow_appending = false); |
202 | 202 |
203 MUST_USE_RESULT MaybeObject* ArrayConstructInitializeElements( | 203 MUST_USE_RESULT MaybeObject* ArrayConstructInitializeElements( |
204 JSArray* array, Arguments* args); | 204 JSArray* array, Arguments* args); |
205 | 205 |
206 } } // namespace v8::internal | 206 } } // namespace v8::internal |
207 | 207 |
208 #endif // V8_ELEMENTS_H_ | 208 #endif // V8_ELEMENTS_H_ |
OLD | NEW |