| 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 29 matching lines...) Expand all Loading... |
| 40 // in the backing store to use for the check, which must be compatible with | 40 // in the backing store to use for the check, which must be compatible with |
| 41 // the ElementsKind of the ElementsAccessor. If backing_store is NULL, the | 41 // the ElementsKind of the ElementsAccessor. If backing_store is NULL, the |
| 42 // holder->elements() is used as the backing store. If a |filter| is | 42 // holder->elements() is used as the backing store. If a |filter| is |
| 43 // specified the PropertyAttributes of the element at the given index | 43 // specified the PropertyAttributes of the element at the given index |
| 44 // are compared to the given |filter|. If they match/overlap the given | 44 // are compared to the given |filter|. If they match/overlap the given |
| 45 // index is ignored. Note that only Dictionary elements have custom | 45 // index is ignored. Note that only Dictionary elements have custom |
| 46 // PropertyAttributes associated, hence the |filter| argument is ignored for | 46 // PropertyAttributes associated, hence the |filter| argument is ignored for |
| 47 // all but DICTIONARY_ELEMENTS and SLOW_SLOPPY_ARGUMENTS_ELEMENTS. | 47 // all but DICTIONARY_ELEMENTS and SLOW_SLOPPY_ARGUMENTS_ELEMENTS. |
| 48 virtual bool HasElement(Handle<JSObject> holder, uint32_t index, | 48 virtual bool HasElement(Handle<JSObject> holder, uint32_t index, |
| 49 Handle<FixedArrayBase> backing_store, | 49 Handle<FixedArrayBase> backing_store, |
| 50 PropertyAttributes filter = NONE) = 0; | 50 PropertyFilter filter = ALL_PROPERTIES) = 0; |
| 51 | 51 |
| 52 inline bool HasElement(Handle<JSObject> holder, uint32_t index, | 52 inline bool HasElement(Handle<JSObject> holder, uint32_t index, |
| 53 PropertyAttributes filter = NONE) { | 53 PropertyFilter filter = ALL_PROPERTIES) { |
| 54 return HasElement(holder, index, handle(holder->elements()), filter); | 54 return HasElement(holder, index, handle(holder->elements()), filter); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Returns true if the backing store is compact in the given range | 57 // Returns true if the backing store is compact in the given range |
| 58 virtual bool IsPacked(Handle<JSObject> holder, | 58 virtual bool IsPacked(Handle<JSObject> holder, |
| 59 Handle<FixedArrayBase> backing_store, uint32_t start, | 59 Handle<FixedArrayBase> backing_store, uint32_t start, |
| 60 uint32_t end) = 0; | 60 uint32_t end) = 0; |
| 61 | 61 |
| 62 virtual Handle<Object> Get(Handle<FixedArrayBase> backing_store, | 62 virtual Handle<Object> Get(Handle<FixedArrayBase> backing_store, |
| 63 uint32_t entry) = 0; | 63 uint32_t entry) = 0; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 *from_holder, 0, from_kind, to, 0, kCopyToEndAndInitializeToHole); | 113 *from_holder, 0, from_kind, to, 0, kCopyToEndAndInitializeToHole); |
| 114 } | 114 } |
| 115 | 115 |
| 116 // Copy all indices that have elements from |object| into the given | 116 // Copy all indices that have elements from |object| into the given |
| 117 // KeyAccumulator. For Dictionary-based element-kinds we filter out elements | 117 // KeyAccumulator. For Dictionary-based element-kinds we filter out elements |
| 118 // whose PropertyAttribute match |filter|. | 118 // whose PropertyAttribute match |filter|. |
| 119 virtual void CollectElementIndices(Handle<JSObject> object, | 119 virtual void CollectElementIndices(Handle<JSObject> object, |
| 120 Handle<FixedArrayBase> backing_store, | 120 Handle<FixedArrayBase> backing_store, |
| 121 KeyAccumulator* keys, | 121 KeyAccumulator* keys, |
| 122 uint32_t range = kMaxUInt32, | 122 uint32_t range = kMaxUInt32, |
| 123 PropertyAttributes filter = NONE, | 123 PropertyFilter filter = ALL_PROPERTIES, |
| 124 uint32_t offset = 0) = 0; | 124 uint32_t offset = 0) = 0; |
| 125 | 125 |
| 126 inline void CollectElementIndices(Handle<JSObject> object, | 126 inline void CollectElementIndices(Handle<JSObject> object, |
| 127 KeyAccumulator* keys, | 127 KeyAccumulator* keys, |
| 128 uint32_t range = kMaxUInt32, | 128 uint32_t range = kMaxUInt32, |
| 129 PropertyAttributes filter = NONE, | 129 PropertyFilter filter = ALL_PROPERTIES, |
| 130 uint32_t offset = 0) { | 130 uint32_t offset = 0) { |
| 131 CollectElementIndices(object, handle(object->elements()), keys, range, | 131 CollectElementIndices(object, handle(object->elements()), keys, range, |
| 132 filter, offset); | 132 filter, offset); |
| 133 } | 133 } |
| 134 | 134 |
| 135 virtual void AddElementsToKeyAccumulator(Handle<JSObject> receiver, | 135 virtual void AddElementsToKeyAccumulator(Handle<JSObject> receiver, |
| 136 KeyAccumulator* accumulator, | 136 KeyAccumulator* accumulator, |
| 137 AddKeyConversion convert) = 0; | 137 AddKeyConversion convert) = 0; |
| 138 | 138 |
| 139 virtual void GrowCapacityAndConvert(Handle<JSObject> object, | 139 virtual void GrowCapacityAndConvert(Handle<JSObject> object, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 bool allow_appending = false); | 213 bool allow_appending = false); |
| 214 | 214 |
| 215 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( | 215 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( |
| 216 Handle<JSArray> array, | 216 Handle<JSArray> array, |
| 217 Arguments* args); | 217 Arguments* args); |
| 218 | 218 |
| 219 } // namespace internal | 219 } // namespace internal |
| 220 } // namespace v8 | 220 } // namespace v8 |
| 221 | 221 |
| 222 #endif // V8_ELEMENTS_H_ | 222 #endif // V8_ELEMENTS_H_ |
| OLD | NEW |