OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // Returns the element with the specified key or undefined if there is no such | 63 // Returns the element with the specified key or undefined if there is no such |
64 // element. This method doesn't iterate up the prototype chain. The caller | 64 // element. This method doesn't iterate up the prototype chain. The caller |
65 // can optionally pass in the backing store to use for the check, which must | 65 // can optionally pass in the backing store to use for the check, which must |
66 // be compatible with the ElementsKind of the ElementsAccessor. If | 66 // be compatible with the ElementsKind of the ElementsAccessor. If |
67 // backing_store is NULL, the holder->elements() is used as the backing store. | 67 // backing_store is NULL, the holder->elements() is used as the backing store. |
68 MUST_USE_RESULT virtual Handle<Object> Get( | 68 MUST_USE_RESULT virtual Handle<Object> Get( |
69 Handle<Object> receiver, | 69 Handle<Object> receiver, |
70 Handle<JSObject> holder, | 70 Handle<JSObject> holder, |
71 uint32_t key, | 71 uint32_t key, |
72 Handle<FixedArrayBase> backing_store = | 72 Handle<FixedArrayBase> backing_store) = 0; |
73 Handle<FixedArrayBase>::null()) = 0; | 73 |
| 74 MUST_USE_RESULT virtual Handle<Object> Get( |
| 75 Handle<Object> receiver, |
| 76 Handle<JSObject> holder, |
| 77 uint32_t key) = 0; |
74 | 78 |
75 MUST_USE_RESULT virtual MaybeObject* Get( | 79 MUST_USE_RESULT virtual MaybeObject* Get( |
76 Object* receiver, | 80 Object* receiver, |
77 JSObject* holder, | 81 JSObject* holder, |
78 uint32_t key, | 82 uint32_t key, |
79 FixedArrayBase* backing_store = NULL) = 0; | 83 FixedArrayBase* backing_store = NULL) = 0; |
80 | 84 |
81 // Returns an element's attributes, or ABSENT if there is no such | 85 // Returns an element's attributes, or ABSENT if there is no such |
82 // element. This method doesn't iterate up the prototype chain. The caller | 86 // element. This method doesn't iterate up the prototype chain. The caller |
83 // can optionally pass in the backing store to use for the check, which must | 87 // can optionally pass in the backing store to use for the check, which must |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // CopyElements, it copies all of elements from source after source_start to | 148 // CopyElements, it copies all of elements from source after source_start to |
145 // destination array, padding any remaining uninitialized elements in the | 149 // destination array, padding any remaining uninitialized elements in the |
146 // destination array with the hole. | 150 // destination array with the hole. |
147 static const int kCopyToEndAndInitializeToHole = -2; | 151 static const int kCopyToEndAndInitializeToHole = -2; |
148 | 152 |
149 // Copy elements from one backing store to another. Typically, callers specify | 153 // Copy elements from one backing store to another. Typically, callers specify |
150 // the source JSObject or JSArray in source_holder. If the holder's backing | 154 // the source JSObject or JSArray in source_holder. If the holder's backing |
151 // store is available, it can be passed in source and source_holder is | 155 // store is available, it can be passed in source and source_holder is |
152 // ignored. | 156 // ignored. |
153 virtual void CopyElements( | 157 virtual void CopyElements( |
154 Handle<JSObject> source_holder, | 158 Handle<FixedArrayBase> source, |
155 uint32_t source_start, | 159 uint32_t source_start, |
156 ElementsKind source_kind, | 160 ElementsKind source_kind, |
157 Handle<FixedArrayBase> destination, | 161 Handle<FixedArrayBase> destination, |
158 uint32_t destination_start, | 162 uint32_t destination_start, |
159 int copy_size, | 163 int copy_size) = 0; |
160 Handle<FixedArrayBase> source = Handle<FixedArrayBase>::null()) = 0; | |
161 | 164 |
162 void CopyElements( | 165 virtual void CopyElements( |
163 Handle<JSObject> from_holder, | 166 JSObject* source_holder, |
| 167 uint32_t source_start, |
| 168 ElementsKind source_kind, |
| 169 Handle<FixedArrayBase> destination, |
| 170 uint32_t destination_start, |
| 171 int copy_size) = 0; |
| 172 |
| 173 inline void CopyElements( |
| 174 JSObject* from_holder, |
164 Handle<FixedArrayBase> to, | 175 Handle<FixedArrayBase> to, |
165 ElementsKind from_kind, | 176 ElementsKind from_kind) { |
166 Handle<FixedArrayBase> from = Handle<FixedArrayBase>::null()) { | 177 CopyElements( |
167 CopyElements(from_holder, 0, from_kind, to, 0, | 178 from_holder, 0, from_kind, to, 0, kCopyToEndAndInitializeToHole); |
168 kCopyToEndAndInitializeToHole, from); | |
169 } | 179 } |
170 | 180 |
171 MUST_USE_RESULT virtual MaybeObject* AddElementsToFixedArray( | 181 MUST_USE_RESULT virtual MaybeObject* AddElementsToFixedArray( |
172 Object* receiver, | 182 Object* receiver, |
173 JSObject* holder, | 183 JSObject* holder, |
174 FixedArray* to, | 184 FixedArray* to, |
175 FixedArrayBase* from = NULL) = 0; | 185 FixedArrayBase* from = NULL) = 0; |
176 | 186 |
177 // Returns a shared ElementsAccessor for the specified ElementsKind. | 187 // Returns a shared ElementsAccessor for the specified ElementsKind. |
178 static ElementsAccessor* ForKind(ElementsKind elements_kind) { | 188 static ElementsAccessor* ForKind(ElementsKind elements_kind) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 220 |
211 void CheckArrayAbuse(JSObject* obj, const char* op, uint32_t key, | 221 void CheckArrayAbuse(JSObject* obj, const char* op, uint32_t key, |
212 bool allow_appending = false); | 222 bool allow_appending = false); |
213 | 223 |
214 Handle<Object> ArrayConstructInitializeElements(Handle<JSArray> array, | 224 Handle<Object> ArrayConstructInitializeElements(Handle<JSArray> array, |
215 Arguments* args); | 225 Arguments* args); |
216 | 226 |
217 } } // namespace v8::internal | 227 } } // namespace v8::internal |
218 | 228 |
219 #endif // V8_ELEMENTS_H_ | 229 #endif // V8_ELEMENTS_H_ |
OLD | NEW |