| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // all but DICTIONARY_ELEMENTS and SLOW_SLOPPY_ARGUMENTS_ELEMENTS. | 45 // all but DICTIONARY_ELEMENTS and SLOW_SLOPPY_ARGUMENTS_ELEMENTS. |
| 46 virtual bool HasElement(Handle<JSObject> holder, uint32_t index, | 46 virtual bool HasElement(Handle<JSObject> holder, uint32_t index, |
| 47 Handle<FixedArrayBase> backing_store, | 47 Handle<FixedArrayBase> backing_store, |
| 48 PropertyFilter filter = ALL_PROPERTIES) = 0; | 48 PropertyFilter filter = ALL_PROPERTIES) = 0; |
| 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 // Returns true if the backing store is compact in the given range | |
| 56 virtual bool IsPacked(Handle<JSObject> holder, | |
| 57 Handle<FixedArrayBase> backing_store, uint32_t start, | |
| 58 uint32_t end) = 0; | |
| 59 | |
| 60 virtual Handle<Object> Get(Handle<JSObject> holder, uint32_t entry) = 0; | 55 virtual Handle<Object> Get(Handle<JSObject> holder, uint32_t entry) = 0; |
| 61 | 56 |
| 62 virtual PropertyDetails GetDetails(JSObject* holder, uint32_t entry) = 0; | 57 virtual PropertyDetails GetDetails(JSObject* holder, uint32_t entry) = 0; |
| 63 | 58 |
| 64 // Modifies the length data property as specified for JSArrays and resizes the | 59 // Modifies the length data property as specified for JSArrays and resizes the |
| 65 // underlying backing store accordingly. The method honors the semantics of | 60 // underlying backing store accordingly. The method honors the semantics of |
| 66 // changing array sizes as defined in EcmaScript 5.1 15.4.5.2, i.e. array that | 61 // changing array sizes as defined in EcmaScript 5.1 15.4.5.2, i.e. array that |
| 67 // have non-deletable elements can only be shrunk to the size of highest | 62 // have non-deletable elements can only be shrunk to the size of highest |
| 68 // element that is non-deletable. | 63 // element that is non-deletable. |
| 69 virtual void SetLength(Handle<JSArray> holder, uint32_t new_length) = 0; | 64 virtual void SetLength(Handle<JSArray> holder, uint32_t new_length) = 0; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 Handle<Object> value, | 111 Handle<Object> value, |
| 117 PropertyAttributes attributes) = 0; | 112 PropertyAttributes attributes) = 0; |
| 118 | 113 |
| 119 virtual void Add(Handle<JSObject> object, uint32_t index, | 114 virtual void Add(Handle<JSObject> object, uint32_t index, |
| 120 Handle<Object> value, PropertyAttributes attributes, | 115 Handle<Object> value, PropertyAttributes attributes, |
| 121 uint32_t new_capacity) = 0; | 116 uint32_t new_capacity) = 0; |
| 122 | 117 |
| 123 static Handle<JSArray> Concat(Isolate* isolate, Arguments* args, | 118 static Handle<JSArray> Concat(Isolate* isolate, Arguments* args, |
| 124 uint32_t concat_size); | 119 uint32_t concat_size); |
| 125 | 120 |
| 126 virtual uint32_t Push(Handle<JSArray> receiver, | 121 virtual uint32_t Push(Handle<JSArray> receiver, Arguments* args, |
| 127 Handle<FixedArrayBase> backing_store, Arguments* args, | |
| 128 uint32_t push_size) = 0; | 122 uint32_t push_size) = 0; |
| 129 | 123 |
| 130 virtual uint32_t Unshift(Handle<JSArray> receiver, | 124 virtual uint32_t Unshift(Handle<JSArray> receiver, |
| 131 Handle<FixedArrayBase> backing_store, | |
| 132 Arguments* args, uint32_t unshift_size) = 0; | 125 Arguments* args, uint32_t unshift_size) = 0; |
| 133 | 126 |
| 134 virtual Handle<JSArray> Slice(Handle<JSObject> receiver, | 127 virtual Handle<JSArray> Slice(Handle<JSObject> receiver, |
| 135 Handle<FixedArrayBase> backing_store, | |
| 136 uint32_t start, uint32_t end) = 0; | 128 uint32_t start, uint32_t end) = 0; |
| 137 | 129 |
| 138 virtual Handle<JSArray> Splice(Handle<JSArray> receiver, | 130 virtual Handle<JSArray> Splice(Handle<JSArray> receiver, |
| 139 Handle<FixedArrayBase> backing_store, | |
| 140 uint32_t start, uint32_t delete_count, | 131 uint32_t start, uint32_t delete_count, |
| 141 Arguments* args, uint32_t add_count) = 0; | 132 Arguments* args, uint32_t add_count) = 0; |
| 142 | 133 |
| 143 virtual Handle<Object> Pop(Handle<JSArray> receiver, | 134 virtual Handle<Object> Pop(Handle<JSArray> receiver) = 0; |
| 144 Handle<FixedArrayBase> backing_store) = 0; | |
| 145 | 135 |
| 146 virtual Handle<Object> Shift(Handle<JSArray> receiver, | 136 virtual Handle<Object> Shift(Handle<JSArray> receiver) = 0; |
| 147 Handle<FixedArrayBase> backing_store) = 0; | |
| 148 | 137 |
| 149 protected: | 138 protected: |
| 150 friend class LookupIterator; | 139 friend class LookupIterator; |
| 151 | 140 |
| 152 // Element handlers distinguish between entries and indices when they | 141 // Element handlers distinguish between entries and indices when they |
| 153 // manipulate elements. Entries refer to elements in terms of their location | 142 // manipulate elements. Entries refer to elements in terms of their location |
| 154 // in the underlying storage's backing store representation, and are between 0 | 143 // in the underlying storage's backing store representation, and are between 0 |
| 155 // and GetCapacity. Indices refer to elements in terms of the value that would | 144 // and GetCapacity. Indices refer to elements in terms of the value that would |
| 156 // be specified in JavaScript to access the element. In most implementations, | 145 // be specified in JavaScript to access the element. In most implementations, |
| 157 // indices are equivalent to entries. In the NumberDictionary | 146 // indices are equivalent to entries. In the NumberDictionary |
| (...skipping 25 matching lines...) Expand all Loading... |
| 183 bool allow_appending = false); | 172 bool allow_appending = false); |
| 184 | 173 |
| 185 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( | 174 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( |
| 186 Handle<JSArray> array, | 175 Handle<JSArray> array, |
| 187 Arguments* args); | 176 Arguments* args); |
| 188 | 177 |
| 189 } // namespace internal | 178 } // namespace internal |
| 190 } // namespace v8 | 179 } // namespace v8 |
| 191 | 180 |
| 192 #endif // V8_ELEMENTS_H_ | 181 #endif // V8_ELEMENTS_H_ |
| OLD | NEW |