| 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 | |
| 232 void KeyAccumulator::AddElementKeysFromInterceptor( | 220 void KeyAccumulator::AddElementKeysFromInterceptor( |
| 233 Handle<JSObject> array_like) { | 221 Handle<JSObject> array_like) { |
| 234 AddKeys(array_like, CONVERT_TO_ARRAY_INDEX); | 222 AddKeys(array_like, CONVERT_TO_ARRAY_INDEX); |
| 235 // The interceptor might introduce duplicates for the current level, since | 223 // The interceptor might introduce duplicates for the current level, since |
| 236 // these keys get added after the objects's normal element keys. | 224 // these keys get added after the objects's normal element keys. |
| 237 SortCurrentElementsListRemoveDuplicates(); | 225 SortCurrentElementsListRemoveDuplicates(); |
| 238 } | 226 } |
| 239 | 227 |
| 240 | 228 |
| 241 void KeyAccumulator::SortCurrentElementsListRemoveDuplicates() { | 229 void KeyAccumulator::SortCurrentElementsListRemoveDuplicates() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 266 level_lengths_.push_back(level_symbol_length_); | 254 level_lengths_.push_back(level_symbol_length_); |
| 267 } | 255 } |
| 268 elements_.push_back(new std::vector<uint32_t>()); | 256 elements_.push_back(new std::vector<uint32_t>()); |
| 269 level_string_length_ = 0; | 257 level_string_length_ = 0; |
| 270 level_symbol_length_ = 0; | 258 level_symbol_length_ = 0; |
| 271 } | 259 } |
| 272 | 260 |
| 273 | 261 |
| 274 } // namespace internal | 262 } // namespace internal |
| 275 } // namespace v8 | 263 } // namespace v8 |
| OLD | NEW |