| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // can optionally pass in the backing store to use for the check, which must | 47 // can optionally pass in the backing store to use for the check, which must |
| 48 // be compatible with the ElementsKind of the ElementsAccessor. If | 48 // be compatible with the ElementsKind of the ElementsAccessor. If |
| 49 // backing_store is NULL, the holder->elements() is used as the backing store. | 49 // backing_store is NULL, the holder->elements() is used as the backing store. |
| 50 virtual Handle<Object> Get(Handle<JSObject> holder, uint32_t key, | 50 virtual Handle<Object> Get(Handle<JSObject> holder, uint32_t key, |
| 51 Handle<FixedArrayBase> backing_store) = 0; | 51 Handle<FixedArrayBase> backing_store) = 0; |
| 52 | 52 |
| 53 inline Handle<Object> Get(Handle<JSObject> holder, uint32_t key) { | 53 inline Handle<Object> Get(Handle<JSObject> holder, uint32_t key) { |
| 54 return Get(holder, key, handle(holder->elements())); | 54 return Get(holder, key, handle(holder->elements())); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Returns an element's accessors, or NULL if the element does not exist or | |
| 58 // is plain. This method doesn't iterate up the prototype chain. The caller | |
| 59 // can optionally pass in the backing store to use for the check, which must | |
| 60 // be compatible with the ElementsKind of the ElementsAccessor. If | |
| 61 // backing_store is NULL, the holder->elements() is used as the backing store. | |
| 62 virtual MaybeHandle<AccessorPair> GetAccessorPair( | |
| 63 Handle<JSObject> holder, uint32_t key, | |
| 64 Handle<FixedArrayBase> backing_store) = 0; | |
| 65 | |
| 66 inline MaybeHandle<AccessorPair> GetAccessorPair(Handle<JSObject> holder, | |
| 67 uint32_t key) { | |
| 68 return GetAccessorPair(holder, key, handle(holder->elements())); | |
| 69 } | |
| 70 | |
| 71 // Modifies the length data property as specified for JSArrays and resizes the | 57 // Modifies the length data property as specified for JSArrays and resizes the |
| 72 // underlying backing store accordingly. The method honors the semantics of | 58 // underlying backing store accordingly. The method honors the semantics of |
| 73 // changing array sizes as defined in EcmaScript 5.1 15.4.5.2, i.e. array that | 59 // changing array sizes as defined in EcmaScript 5.1 15.4.5.2, i.e. array that |
| 74 // have non-deletable elements can only be shrunk to the size of highest | 60 // have non-deletable elements can only be shrunk to the size of highest |
| 75 // element that is non-deletable. | 61 // element that is non-deletable. |
| 76 virtual void SetLength(Handle<JSArray> holder, uint32_t new_length) = 0; | 62 virtual void SetLength(Handle<JSArray> holder, uint32_t new_length) = 0; |
| 77 | 63 |
| 78 // Deletes an element in an object. | 64 // Deletes an element in an object. |
| 79 virtual void Delete(Handle<JSObject> holder, uint32_t index) = 0; | 65 virtual void Delete(Handle<JSObject> holder, uint32_t index) = 0; |
| 80 | 66 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key, | 168 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key, |
| 183 bool allow_appending = false); | 169 bool allow_appending = false); |
| 184 | 170 |
| 185 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( | 171 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( |
| 186 Handle<JSArray> array, | 172 Handle<JSArray> array, |
| 187 Arguments* args); | 173 Arguments* args); |
| 188 | 174 |
| 189 } } // namespace v8::internal | 175 } } // namespace v8::internal |
| 190 | 176 |
| 191 #endif // V8_ELEMENTS_H_ | 177 #endif // V8_ELEMENTS_H_ |
| OLD | NEW |