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, | |
47 Handle<Object> value) { | |
48 return Set(holder, key, handle(holder->elements()), value); | |
49 } | |
Igor Sheludko
2015/06/11 14:38:18
Empty line is missing.
| |
46 // 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 |
47 // 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 |
48 // 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 |
49 // be compatible with the ElementsKind of the ElementsAccessor. If | 53 // be compatible with the ElementsKind of the ElementsAccessor. If |
50 // 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. |
51 virtual Handle<Object> Get(Handle<JSObject> holder, uint32_t key, | 55 virtual Handle<Object> Get(Handle<JSObject> holder, uint32_t key, |
52 Handle<FixedArrayBase> backing_store) = 0; | 56 Handle<FixedArrayBase> backing_store) = 0; |
53 | 57 |
54 inline Handle<Object> Get(Handle<JSObject> holder, uint32_t key) { | 58 inline Handle<Object> Get(Handle<JSObject> holder, uint32_t key) { |
55 return Get(holder, key, handle(holder->elements())); | 59 return Get(holder, key, handle(holder->elements())); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 // the index to a key using the KeyAt method on the NumberDictionary. | 185 // the index to a key using the KeyAt method on the NumberDictionary. |
182 virtual uint32_t GetKeyForIndex(FixedArrayBase* backing_store, | 186 virtual uint32_t GetKeyForIndex(FixedArrayBase* backing_store, |
183 uint32_t index) = 0; | 187 uint32_t index) = 0; |
184 virtual uint32_t GetIndexForKey(FixedArrayBase* backing_store, | 188 virtual uint32_t GetIndexForKey(FixedArrayBase* backing_store, |
185 uint32_t key) = 0; | 189 uint32_t key) = 0; |
186 virtual PropertyDetails GetDetails(FixedArrayBase* backing_store, | 190 virtual PropertyDetails GetDetails(FixedArrayBase* backing_store, |
187 uint32_t index) = 0; | 191 uint32_t index) = 0; |
188 virtual bool HasIndex(FixedArrayBase* backing_store, uint32_t key) = 0; | 192 virtual bool HasIndex(FixedArrayBase* backing_store, uint32_t key) = 0; |
189 | 193 |
190 private: | 194 private: |
195 virtual Handle<Object> Set(Handle<JSObject> holder, uint32_t key, | |
Igor Sheludko
2015/06/11 14:38:18
Please make it protected.
| |
196 Handle<FixedArrayBase> backing_store, | |
197 Handle<Object> value) = 0; | |
198 | |
191 static ElementsAccessor** elements_accessors_; | 199 static ElementsAccessor** elements_accessors_; |
192 const char* name_; | 200 const char* name_; |
193 | 201 |
194 DISALLOW_COPY_AND_ASSIGN(ElementsAccessor); | 202 DISALLOW_COPY_AND_ASSIGN(ElementsAccessor); |
195 }; | 203 }; |
196 | 204 |
197 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key, | 205 void CheckArrayAbuse(Handle<JSObject> obj, const char* op, uint32_t key, |
198 bool allow_appending = false); | 206 bool allow_appending = false); |
199 | 207 |
200 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( | 208 MUST_USE_RESULT MaybeHandle<Object> ArrayConstructInitializeElements( |
201 Handle<JSArray> array, | 209 Handle<JSArray> array, |
202 Arguments* args); | 210 Arguments* args); |
203 | 211 |
204 } } // namespace v8::internal | 212 } } // namespace v8::internal |
205 | 213 |
206 #endif // V8_ELEMENTS_H_ | 214 #endif // V8_ELEMENTS_H_ |
OLD | NEW |