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 25 matching lines...) Expand all Loading... |
36 Handle<JSObject> holder, | 36 Handle<JSObject> holder, |
37 uint32_t key, | 37 uint32_t key, |
38 Handle<FixedArrayBase> backing_store) = 0; | 38 Handle<FixedArrayBase> backing_store) = 0; |
39 | 39 |
40 inline bool HasElement( | 40 inline bool HasElement( |
41 Handle<JSObject> holder, | 41 Handle<JSObject> holder, |
42 uint32_t key) { | 42 uint32_t key) { |
43 return HasElement(holder, key, handle(holder->elements())); | 43 return HasElement(holder, key, handle(holder->elements())); |
44 } | 44 } |
45 | 45 |
46 inline Handle<Object> Set(Handle<JSObject> holder, uint32_t key, | 46 inline void Set(Handle<JSObject> holder, uint32_t key, Handle<Object> value) { |
47 Handle<Object> value) { | 47 Set(holder, key, handle(holder->elements()), value); |
48 return Set(holder, key, handle(holder->elements()), value); | |
49 } | 48 } |
50 | 49 |
51 // Returns the element with the specified key or undefined if there is no such | 50 // Returns the element with the specified key or undefined if there is no such |
52 // element. This method doesn't iterate up the prototype chain. The caller | 51 // element. This method doesn't iterate up the prototype chain. The caller |
53 // can optionally pass in the backing store to use for the check, which must | 52 // can optionally pass in the backing store to use for the check, which must |
54 // be compatible with the ElementsKind of the ElementsAccessor. If | 53 // be compatible with the ElementsKind of the ElementsAccessor. If |
55 // backing_store is NULL, the holder->elements() is used as the backing store. | 54 // backing_store is NULL, the holder->elements() is used as the backing store. |
56 virtual Handle<Object> Get(Handle<JSObject> holder, uint32_t key, | 55 virtual Handle<Object> Get(Handle<JSObject> holder, uint32_t key, |
57 Handle<FixedArrayBase> backing_store) = 0; | 56 Handle<FixedArrayBase> backing_store) = 0; |
58 | 57 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // the index to a key using the KeyAt method on the NumberDictionary. | 172 // the index to a key using the KeyAt method on the NumberDictionary. |
174 virtual uint32_t GetKeyForIndex(FixedArrayBase* backing_store, | 173 virtual uint32_t GetKeyForIndex(FixedArrayBase* backing_store, |
175 uint32_t index) = 0; | 174 uint32_t index) = 0; |
176 virtual uint32_t GetIndexForKey(JSObject* holder, | 175 virtual uint32_t GetIndexForKey(JSObject* holder, |
177 FixedArrayBase* backing_store, | 176 FixedArrayBase* backing_store, |
178 uint32_t key) = 0; | 177 uint32_t key) = 0; |
179 virtual PropertyDetails GetDetails(FixedArrayBase* backing_store, | 178 virtual PropertyDetails GetDetails(FixedArrayBase* backing_store, |
180 uint32_t index) = 0; | 179 uint32_t index) = 0; |
181 virtual bool HasIndex(FixedArrayBase* backing_store, uint32_t key) = 0; | 180 virtual bool HasIndex(FixedArrayBase* backing_store, uint32_t key) = 0; |
182 | 181 |
183 virtual Handle<Object> Set(Handle<JSObject> holder, uint32_t key, | 182 virtual void Set(Handle<JSObject> holder, uint32_t key, |
184 Handle<FixedArrayBase> backing_store, | 183 Handle<FixedArrayBase> backing_store, |
185 Handle<Object> value) = 0; | 184 Handle<Object> value) = 0; |
186 | 185 |
187 private: | 186 private: |
188 static ElementsAccessor** elements_accessors_; | 187 static ElementsAccessor** elements_accessors_; |
189 const char* name_; | 188 const char* name_; |
190 | 189 |
191 DISALLOW_COPY_AND_ASSIGN(ElementsAccessor); | 190 DISALLOW_COPY_AND_ASSIGN(ElementsAccessor); |
192 }; | 191 }; |
193 | 192 |
194 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key, | 193 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key, |
195 bool allow_appending = false); | 194 bool allow_appending = false); |
196 | 195 |
197 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( | 196 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( |
198 Handle<JSArray> array, | 197 Handle<JSArray> array, |
199 Arguments* args); | 198 Arguments* args); |
200 | 199 |
201 } } // namespace v8::internal | 200 } } // namespace v8::internal |
202 | 201 |
203 #endif // V8_ELEMENTS_H_ | 202 #endif // V8_ELEMENTS_H_ |
OLD | NEW |