| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ELEMENTS_H_ | 5 #ifndef V8_ELEMENTS_H_ |
| 6 #define V8_ELEMENTS_H_ | 6 #define V8_ELEMENTS_H_ |
| 7 | 7 |
| 8 #include "src/elements-kind.h" | 8 #include "src/elements-kind.h" |
| 9 #include "src/heap/heap.h" | 9 #include "src/heap/heap.h" |
| 10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 inline bool HasElement(Handle<JSObject> holder, uint32_t index, | 50 inline bool HasElement(Handle<JSObject> holder, uint32_t index, |
| 51 PropertyFilter filter = ALL_PROPERTIES) { | 51 PropertyFilter filter = ALL_PROPERTIES) { |
| 52 return HasElement(holder, index, handle(holder->elements()), filter); | 52 return HasElement(holder, index, handle(holder->elements()), filter); |
| 53 } | 53 } |
| 54 | 54 |
| 55 virtual Handle<Object> Get(Handle<JSObject> holder, uint32_t entry) = 0; | 55 virtual Handle<Object> Get(Handle<JSObject> holder, uint32_t entry) = 0; |
| 56 | 56 |
| 57 virtual PropertyDetails GetDetails(JSObject* holder, uint32_t entry) = 0; | 57 virtual PropertyDetails GetDetails(JSObject* holder, uint32_t entry) = 0; |
| 58 virtual bool HasAccessors(JSObject* holder) = 0; | 58 virtual bool HasAccessors(JSObject* holder) = 0; |
| 59 virtual uint32_t NumberOfElements(JSObject* holder) = 0; |
| 59 | 60 |
| 60 // Modifies the length data property as specified for JSArrays and resizes the | 61 // Modifies the length data property as specified for JSArrays and resizes the |
| 61 // underlying backing store accordingly. The method honors the semantics of | 62 // underlying backing store accordingly. The method honors the semantics of |
| 62 // changing array sizes as defined in EcmaScript 5.1 15.4.5.2, i.e. array that | 63 // changing array sizes as defined in EcmaScript 5.1 15.4.5.2, i.e. array that |
| 63 // have non-deletable elements can only be shrunk to the size of highest | 64 // have non-deletable elements can only be shrunk to the size of highest |
| 64 // element that is non-deletable. | 65 // element that is non-deletable. |
| 65 virtual void SetLength(Handle<JSArray> holder, uint32_t new_length) = 0; | 66 virtual void SetLength(Handle<JSArray> holder, uint32_t new_length) = 0; |
| 66 | 67 |
| 67 // Deletes an element in an object. | 68 // Deletes an element in an object. |
| 68 virtual void Delete(Handle<JSObject> holder, uint32_t entry) = 0; | 69 virtual void Delete(Handle<JSObject> holder, uint32_t entry) = 0; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 friend class LookupIterator; | 179 friend class LookupIterator; |
| 179 | 180 |
| 180 // Element handlers distinguish between entries and indices when they | 181 // Element handlers distinguish between entries and indices when they |
| 181 // manipulate elements. Entries refer to elements in terms of their location | 182 // manipulate elements. Entries refer to elements in terms of their location |
| 182 // in the underlying storage's backing store representation, and are between 0 | 183 // in the underlying storage's backing store representation, and are between 0 |
| 183 // and GetCapacity. Indices refer to elements in terms of the value that would | 184 // and GetCapacity. Indices refer to elements in terms of the value that would |
| 184 // be specified in JavaScript to access the element. In most implementations, | 185 // be specified in JavaScript to access the element. In most implementations, |
| 185 // indices are equivalent to entries. In the NumberDictionary | 186 // indices are equivalent to entries. In the NumberDictionary |
| 186 // ElementsAccessor, entries are mapped to an index using the KeyAt method on | 187 // ElementsAccessor, entries are mapped to an index using the KeyAt method on |
| 187 // the NumberDictionary. | 188 // the NumberDictionary. |
| 188 virtual uint32_t GetEntryForIndex(JSObject* holder, | 189 virtual uint32_t GetEntryForIndex(Isolate* isolate, JSObject* holder, |
| 189 FixedArrayBase* backing_store, | 190 FixedArrayBase* backing_store, |
| 190 uint32_t index) = 0; | 191 uint32_t index) = 0; |
| 191 | 192 |
| 192 // NOTE: this method violates the handlified function signature convention: | 193 // NOTE: this method violates the handlified function signature convention: |
| 193 // raw pointer parameter |source_holder| in the function that allocates. | 194 // raw pointer parameter |source_holder| in the function that allocates. |
| 194 // This is done intentionally to avoid ArrayConcat() builtin performance | 195 // This is done intentionally to avoid ArrayConcat() builtin performance |
| 195 // degradation. | 196 // degradation. |
| 196 virtual void CopyElements(JSObject* source_holder, uint32_t source_start, | 197 virtual void CopyElements(JSObject* source_holder, uint32_t source_start, |
| 197 ElementsKind source_kind, | 198 ElementsKind source_kind, |
| 198 Handle<FixedArrayBase> destination, | 199 Handle<FixedArrayBase> destination, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 209 bool allow_appending = false); | 210 bool allow_appending = false); |
| 210 | 211 |
| 211 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( | 212 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( |
| 212 Handle<JSArray> array, | 213 Handle<JSArray> array, |
| 213 Arguments* args); | 214 Arguments* args); |
| 214 | 215 |
| 215 } // namespace internal | 216 } // namespace internal |
| 216 } // namespace v8 | 217 } // namespace v8 |
| 217 | 218 |
| 218 #endif // V8_ELEMENTS_H_ | 219 #endif // V8_ELEMENTS_H_ |
| OLD | NEW |