| 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 #include "src/elements.h" | 5 #include "src/elements.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
| 9 #include "src/factory.h" | 9 #include "src/factory.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1378 DisallowHeapAllocation no_gc; | 1378 DisallowHeapAllocation no_gc; |
| 1379 SeededNumberDictionary* dict = SeededNumberDictionary::cast(backing_store); | 1379 SeededNumberDictionary* dict = SeededNumberDictionary::cast(backing_store); |
| 1380 if (!dict->requires_slow_elements()) return false; | 1380 if (!dict->requires_slow_elements()) return false; |
| 1381 int capacity = dict->Capacity(); | 1381 int capacity = dict->Capacity(); |
| 1382 Isolate* isolate = dict->GetIsolate(); | 1382 Isolate* isolate = dict->GetIsolate(); |
| 1383 for (int i = 0; i < capacity; i++) { | 1383 for (int i = 0; i < capacity; i++) { |
| 1384 Object* key = dict->KeyAt(i); | 1384 Object* key = dict->KeyAt(i); |
| 1385 if (!dict->IsKey(isolate, key)) continue; | 1385 if (!dict->IsKey(isolate, key)) continue; |
| 1386 DCHECK(!dict->IsDeleted(i)); | 1386 DCHECK(!dict->IsDeleted(i)); |
| 1387 PropertyDetails details = dict->DetailsAt(i); | 1387 PropertyDetails details = dict->DetailsAt(i); |
| 1388 if (details.type() == ACCESSOR_CONSTANT) return true; | 1388 if (details.kind() == kAccessor) return true; |
| 1389 } | 1389 } |
| 1390 return false; | 1390 return false; |
| 1391 } | 1391 } |
| 1392 | 1392 |
| 1393 static Object* GetRaw(FixedArrayBase* store, uint32_t entry) { | 1393 static Object* GetRaw(FixedArrayBase* store, uint32_t entry) { |
| 1394 SeededNumberDictionary* backing_store = SeededNumberDictionary::cast(store); | 1394 SeededNumberDictionary* backing_store = SeededNumberDictionary::cast(store); |
| 1395 return backing_store->ValueAt(entry); | 1395 return backing_store->ValueAt(entry); |
| 1396 } | 1396 } |
| 1397 | 1397 |
| 1398 static Handle<Object> GetImpl(Isolate* isolate, FixedArrayBase* backing_store, | 1398 static Handle<Object> GetImpl(Isolate* isolate, FixedArrayBase* backing_store, |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 for (int i = 0; i < capacity; ++i) { | 1588 for (int i = 0; i < capacity; ++i) { |
| 1589 Object* k = dictionary->KeyAt(i); | 1589 Object* k = dictionary->KeyAt(i); |
| 1590 if (k == the_hole) continue; | 1590 if (k == the_hole) continue; |
| 1591 if (k == undefined) continue; | 1591 if (k == undefined) continue; |
| 1592 | 1592 |
| 1593 uint32_t index; | 1593 uint32_t index; |
| 1594 if (!k->ToArrayIndex(&index) || index < start_from || index >= length) { | 1594 if (!k->ToArrayIndex(&index) || index < start_from || index >= length) { |
| 1595 continue; | 1595 continue; |
| 1596 } | 1596 } |
| 1597 | 1597 |
| 1598 if (dictionary->DetailsAt(i).type() == ACCESSOR_CONSTANT) { | 1598 if (dictionary->DetailsAt(i).kind() == kAccessor) { |
| 1599 // Restart from beginning in slow path, otherwise we may observably | 1599 // Restart from beginning in slow path, otherwise we may observably |
| 1600 // access getters out of order | 1600 // access getters out of order |
| 1601 return false; | 1601 return false; |
| 1602 } else if (!found) { | 1602 } else if (!found) { |
| 1603 Object* element_k = dictionary->ValueAt(i); | 1603 Object* element_k = dictionary->ValueAt(i); |
| 1604 if (value->SameValueZero(element_k)) found = true; | 1604 if (value->SameValueZero(element_k)) found = true; |
| 1605 } | 1605 } |
| 1606 } | 1606 } |
| 1607 | 1607 |
| 1608 *result = Just(found); | 1608 *result = Just(found); |
| (...skipping 2245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3854 insertion_index += len; | 3854 insertion_index += len; |
| 3855 } | 3855 } |
| 3856 | 3856 |
| 3857 DCHECK_EQ(insertion_index, result_len); | 3857 DCHECK_EQ(insertion_index, result_len); |
| 3858 return result_array; | 3858 return result_array; |
| 3859 } | 3859 } |
| 3860 | 3860 |
| 3861 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; | 3861 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; |
| 3862 } // namespace internal | 3862 } // namespace internal |
| 3863 } // namespace v8 | 3863 } // namespace v8 |
| OLD | NEW |