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