Index: src/elements.h |
diff --git a/src/elements.h b/src/elements.h |
index 74e4ad665969971843f248e8f5d6a43f9a7b7c8d..9a4afcddc197de28bf2d0a24757ce79c0f5e5dbb 100644 |
--- a/src/elements.h |
+++ b/src/elements.h |
@@ -41,10 +41,10 @@ class ElementsAccessor { |
virtual ~ElementsAccessor() { } |
virtual MaybeObject* GetWithReceiver(JSObject* obj, |
Object* receiver, |
- uint32_t index) = 0; |
+ uint32_t key) = 0; |
virtual MaybeObject* Delete(JSObject* obj, |
- uint32_t index, |
+ uint32_t key, |
JSReceiver::DeleteMode mode) = 0; |
virtual MaybeObject* AddElementsToFixedArray(FixedArrayBase* from, |
@@ -56,8 +56,33 @@ class ElementsAccessor { |
return elements_accessors_[elements_kind]; |
} |
+ static ElementsAccessor* ForArray(FixedArrayBase* array); |
+ |
static void InitializeOncePerProcess(); |
+ protected: |
+ friend class NonStrictArgumentsElementsAccessor; |
+ |
+ // TODO(danno): GetElement should be merged with GetWithReceiver. |
+ virtual MaybeObject* GetElement(FixedArrayBase* backing_store, |
+ uint32_t key) = 0; |
+ |
+ virtual uint32_t GetCapacity(FixedArrayBase* backing_store) = 0; |
+ |
+ virtual bool HasElementAtIndex(FixedArrayBase* backing_store, |
+ uint32_t index) = 0; |
+ |
+ // Element handlers distinguish between indexes and keys when the manipulate |
+ // elements. Indexes refer to elements in terms of their location in the |
+ // underlying storage's backing store representation, and are between 0 |
+ // GetCapacity. Keys refer to elements in terms of the value that would be |
+ // specific 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; |
+ |
private: |
static ElementsAccessor** elements_accessors_; |