Chromium Code Reviews| Index: src/elements.h |
| diff --git a/src/elements.h b/src/elements.h |
| index 6fe19559996e695e91c8ba8e8cf38e1f707428c8..3a24d6ea1c7a54fae5e466a34897be7da761c5a9 100644 |
| --- a/src/elements.h |
| +++ b/src/elements.h |
| @@ -26,32 +26,28 @@ class ElementsAccessor { |
| // is found. |
| virtual void Validate(Handle<JSObject> obj) = 0; |
| - // Returns true if a holder contains an element with the specified key |
| + // Returns true if a holder contains an element with the specified index |
| // without iterating up the prototype chain. The caller can optionally pass |
| // in the backing store to use for the check, which must be compatible with |
| // the ElementsKind of the ElementsAccessor. If backing_store is NULL, the |
| // holder->elements() is used as the backing store. |
| - virtual bool HasElement( |
| - Handle<JSObject> holder, |
| - uint32_t key, |
| - Handle<FixedArrayBase> backing_store) = 0; |
| - |
| - inline bool HasElement( |
| - Handle<JSObject> holder, |
| - uint32_t key) { |
| - return HasElement(holder, key, handle(holder->elements())); |
| + virtual bool HasElement(Handle<JSObject> holder, uint32_t index, |
| + Handle<FixedArrayBase> backing_store) = 0; |
| + |
| + inline bool HasElement(Handle<JSObject> holder, uint32_t index) { |
| + return HasElement(holder, index, handle(holder->elements())); |
| } |
| - // Returns the element with the specified key or undefined if there is no such |
| - // element. This method doesn't iterate up the prototype chain. The caller |
| - // can optionally pass in the backing store to use for the check, which must |
| - // be compatible with the ElementsKind of the ElementsAccessor. If |
| + // Returns the element with the specified index or undefined if there is no |
| + // such element. This method doesn't iterate up the prototype chain. The |
| + // caller can optionally pass in the backing store to use for the check, which |
| + // must be compatible with the ElementsKind of the ElementsAccessor. If |
| // backing_store is NULL, the holder->elements() is used as the backing store. |
| - virtual Handle<Object> Get(Handle<JSObject> holder, uint32_t key, |
| + virtual Handle<Object> Get(Handle<JSObject> holder, uint32_t index, |
| Handle<FixedArrayBase> backing_store) = 0; |
| - inline Handle<Object> Get(Handle<JSObject> holder, uint32_t key) { |
| - return Get(holder, key, handle(holder->elements())); |
| + inline Handle<Object> Get(Handle<JSObject> holder, uint32_t index) { |
| + return Get(holder, index, handle(holder->elements())); |
| } |
| // Modifies the length data property as specified for JSArrays and resizes the |
| @@ -62,7 +58,7 @@ class ElementsAccessor { |
| virtual void SetLength(Handle<JSArray> holder, uint32_t new_length) = 0; |
| // Deletes an element in an object. |
| - virtual void Delete(Handle<JSObject> holder, uint32_t index) = 0; |
| + virtual void Delete(Handle<JSObject> holder, uint32_t entry) = 0; |
| // If kCopyToEnd is specified as the copy_size to CopyElements, it copies all |
| // of elements from source after source_start to the destination array. |
| @@ -123,13 +119,13 @@ class ElementsAccessor { |
| static void InitializeOncePerProcess(); |
| static void TearDown(); |
| - virtual void Set(FixedArrayBase* backing_store, uint32_t key, |
| + virtual void Set(FixedArrayBase* backing_store, uint32_t index, |
| Object* value) = 0; |
| virtual void Reconfigure(Handle<JSObject> object, |
| - Handle<FixedArrayBase> backing_store, uint32_t index, |
| + Handle<FixedArrayBase> backing_store, uint32_t entry, |
| Handle<Object> value, |
| PropertyAttributes attributes) = 0; |
| - virtual void Add(Handle<JSObject> object, uint32_t index, |
| + virtual void Add(Handle<JSObject> object, uint32_t entry, |
| Handle<Object> value, PropertyAttributes attributes, |
| uint32_t new_capacity) = 0; |
| @@ -141,22 +137,20 @@ class ElementsAccessor { |
| virtual uint32_t GetCapacity(JSObject* holder, |
| FixedArrayBase* backing_store) = 0; |
| - // Element handlers distinguish between indexes and keys when they manipulate |
| - // elements. Indexes refer to elements in terms of their location in the |
| - // underlying storage's backing store representation, and are between 0 and |
| - // GetCapacity. Keys refer to elements in terms of the value that would be |
| - // specified in JavaScript to access the element. In most implementations, |
| - // keys are equivalent to indexes, and GetKeyForIndex returns the same value |
| - // it is passed. In the NumberDictionary ElementsAccessor, GetKeyForIndex maps |
| - // the index to a key using the KeyAt method on the NumberDictionary. |
| - virtual uint32_t GetKeyForIndex(FixedArrayBase* backing_store, |
| - uint32_t index) = 0; |
| - virtual uint32_t GetIndexForKey(JSObject* holder, |
| - FixedArrayBase* backing_store, |
| - uint32_t key) = 0; |
| + // Element handlers distinguish between entries and indices when they |
| + // manipulate elements. Entries refer to elements in terms of their location |
| + // in the underlying storage's backing store representation, and are between 0 |
| + // and GetCapacity. Indices refer to elements in terms of the value that would |
| + // be specified in JavaScript to access the element. In most implementations, |
| + // indices are equivalent to entries. In the NumberDictionary |
| + // ElementsAccessor, entries are mapped to an index using the KeyAt method on |
| + // the NumberDictionary. |
| + virtual uint32_t GetEntryForIndex(JSObject* holder, |
| + FixedArrayBase* backing_store, |
| + uint32_t index) = 0; |
| virtual PropertyDetails GetDetails(FixedArrayBase* backing_store, |
| - uint32_t index) = 0; |
| - virtual bool HasIndex(FixedArrayBase* backing_store, uint32_t key) = 0; |
| + uint32_t entry) = 0; |
| + virtual bool HasEntry(FixedArrayBase* backing_store, uint32_t index) = 0; |
|
Igor Sheludko
2015/07/07 11:01:42
This method is also not used.
|
| private: |
| static ElementsAccessor** elements_accessors_; |
| @@ -165,7 +159,7 @@ class ElementsAccessor { |
| DISALLOW_COPY_AND_ASSIGN(ElementsAccessor); |
| }; |
| -void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key, |
| +void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t index, |
| bool allow_appending = false); |
| MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( |