OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/key-accumulator.h" | 5 #include "src/key-accumulator.h" |
6 | 6 |
7 #include "src/elements.h" | 7 #include "src/elements.h" |
8 #include "src/factory.h" | 8 #include "src/factory.h" |
9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
10 | 10 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // elements and properties, which breaks the normal assumption for the | 210 // elements and properties, which breaks the normal assumption for the |
211 // KeyAccumulator. | 211 // KeyAccumulator. |
212 AddKeys(array_like, PROXY_MAGIC); | 212 AddKeys(array_like, PROXY_MAGIC); |
213 // Invert the current length to indicate a present proxy, so we can ignore | 213 // Invert the current length to indicate a present proxy, so we can ignore |
214 // element keys for this level. Otherwise we would not fully respect the order | 214 // element keys for this level. Otherwise we would not fully respect the order |
215 // given by the proxy. | 215 // given by the proxy. |
216 level_string_length_ = -level_string_length_; | 216 level_string_length_ = -level_string_length_; |
217 } | 217 } |
218 | 218 |
219 | 219 |
| 220 void KeyAccumulator::AddKeysFromProxy(Handle<FixedArray> keys) { |
| 221 // Proxies define a complete list of keys with no distinction of |
| 222 // elements and properties, which breaks the normal assumption for the |
| 223 // KeyAccumulator. |
| 224 AddKeys(keys, PROXY_MAGIC); |
| 225 // Invert the current length to indicate a present proxy, so we can ignore |
| 226 // element keys for this level. Otherwise we would not fully respect the order |
| 227 // given by the proxy. |
| 228 level_string_length_ = -level_string_length_; |
| 229 } |
| 230 |
| 231 |
220 void KeyAccumulator::AddElementKeysFromInterceptor( | 232 void KeyAccumulator::AddElementKeysFromInterceptor( |
221 Handle<JSObject> array_like) { | 233 Handle<JSObject> array_like) { |
222 AddKeys(array_like, CONVERT_TO_ARRAY_INDEX); | 234 AddKeys(array_like, CONVERT_TO_ARRAY_INDEX); |
223 // The interceptor might introduce duplicates for the current level, since | 235 // The interceptor might introduce duplicates for the current level, since |
224 // these keys get added after the objects's normal element keys. | 236 // these keys get added after the objects's normal element keys. |
225 SortCurrentElementsListRemoveDuplicates(); | 237 SortCurrentElementsListRemoveDuplicates(); |
226 } | 238 } |
227 | 239 |
228 | 240 |
229 void KeyAccumulator::SortCurrentElementsListRemoveDuplicates() { | 241 void KeyAccumulator::SortCurrentElementsListRemoveDuplicates() { |
(...skipping 24 matching lines...) Expand all Loading... |
254 level_lengths_.push_back(level_symbol_length_); | 266 level_lengths_.push_back(level_symbol_length_); |
255 } | 267 } |
256 elements_.push_back(new std::vector<uint32_t>()); | 268 elements_.push_back(new std::vector<uint32_t>()); |
257 level_string_length_ = 0; | 269 level_string_length_ = 0; |
258 level_symbol_length_ = 0; | 270 level_symbol_length_ = 0; |
259 } | 271 } |
260 | 272 |
261 | 273 |
262 } // namespace internal | 274 } // namespace internal |
263 } // namespace v8 | 275 } // namespace v8 |
OLD | NEW |