| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 FixedArray* to = FixedArray::cast(to_base); | 180 FixedArray* to = FixedArray::cast(to_base); |
| 181 uint32_t to_length = to->length(); | 181 uint32_t to_length = to->length(); |
| 182 if (to_start + copy_size > to_length) { | 182 if (to_start + copy_size > to_length) { |
| 183 copy_size = to_length - to_start; | 183 copy_size = to_length - to_start; |
| 184 } | 184 } |
| 185 WriteBarrierMode write_barrier_mode = IsFastObjectElementsKind(to_kind) | 185 WriteBarrierMode write_barrier_mode = IsFastObjectElementsKind(to_kind) |
| 186 ? UPDATE_WRITE_BARRIER | 186 ? UPDATE_WRITE_BARRIER |
| 187 : SKIP_WRITE_BARRIER; | 187 : SKIP_WRITE_BARRIER; |
| 188 Isolate* isolate = from->GetIsolate(); | 188 Isolate* isolate = from->GetIsolate(); |
| 189 for (int i = 0; i < copy_size; i++) { | 189 for (int i = 0; i < copy_size; i++) { |
| 190 int entry = from->FindEntry(isolate, i + from_start); | 190 int entry = from->FindEntry(i + from_start); |
| 191 if (entry != SeededNumberDictionary::kNotFound) { | 191 if (entry != SeededNumberDictionary::kNotFound) { |
| 192 Object* value = from->ValueAt(entry); | 192 Object* value = from->ValueAt(entry); |
| 193 DCHECK(!value->IsTheHole(isolate)); | 193 DCHECK(!value->IsTheHole(isolate)); |
| 194 to->set(i + to_start, value, write_barrier_mode); | 194 to->set(i + to_start, value, write_barrier_mode); |
| 195 } else { | 195 } else { |
| 196 to->set_the_hole(isolate, i + to_start); | 196 to->set_the_hole(isolate, i + to_start); |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 | 200 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 FixedDoubleArray::cast(to_base)->set_the_hole(i); | 410 FixedDoubleArray::cast(to_base)->set_the_hole(i); |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 } | 413 } |
| 414 if (copy_size == 0) return; | 414 if (copy_size == 0) return; |
| 415 FixedDoubleArray* to = FixedDoubleArray::cast(to_base); | 415 FixedDoubleArray* to = FixedDoubleArray::cast(to_base); |
| 416 uint32_t to_length = to->length(); | 416 uint32_t to_length = to->length(); |
| 417 if (to_start + copy_size > to_length) { | 417 if (to_start + copy_size > to_length) { |
| 418 copy_size = to_length - to_start; | 418 copy_size = to_length - to_start; |
| 419 } | 419 } |
| 420 Isolate* isolate = from->GetIsolate(); | |
| 421 for (int i = 0; i < copy_size; i++) { | 420 for (int i = 0; i < copy_size; i++) { |
| 422 int entry = from->FindEntry(isolate, i + from_start); | 421 int entry = from->FindEntry(i + from_start); |
| 423 if (entry != SeededNumberDictionary::kNotFound) { | 422 if (entry != SeededNumberDictionary::kNotFound) { |
| 424 to->set(i + to_start, from->ValueAt(entry)->Number()); | 423 to->set(i + to_start, from->ValueAt(entry)->Number()); |
| 425 } else { | 424 } else { |
| 426 to->set_the_hole(i + to_start); | 425 to->set_the_hole(i + to_start); |
| 427 } | 426 } |
| 428 } | 427 } |
| 429 } | 428 } |
| 430 | 429 |
| 431 static void TraceTopFrame(Isolate* isolate) { | 430 static void TraceTopFrame(Isolate* isolate) { |
| 432 StackFrameIterator it(isolate); | 431 StackFrameIterator it(isolate); |
| (...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 isolate, receiver, value, start_from, length, &result)) { | 1621 isolate, receiver, value, start_from, length, &result)) { |
| 1623 return result; | 1622 return result; |
| 1624 } | 1623 } |
| 1625 } | 1624 } |
| 1626 | 1625 |
| 1627 Handle<SeededNumberDictionary> dictionary( | 1626 Handle<SeededNumberDictionary> dictionary( |
| 1628 SeededNumberDictionary::cast(receiver->elements()), isolate); | 1627 SeededNumberDictionary::cast(receiver->elements()), isolate); |
| 1629 // Iterate through entire range, as accessing elements out of order is | 1628 // Iterate through entire range, as accessing elements out of order is |
| 1630 // observable | 1629 // observable |
| 1631 for (uint32_t k = start_from; k < length; ++k) { | 1630 for (uint32_t k = start_from; k < length; ++k) { |
| 1632 int entry = dictionary->FindEntry(isolate, k); | 1631 int entry = dictionary->FindEntry(k); |
| 1633 if (entry == SeededNumberDictionary::kNotFound) { | 1632 if (entry == SeededNumberDictionary::kNotFound) { |
| 1634 if (search_for_hole) return Just(true); | 1633 if (search_for_hole) return Just(true); |
| 1635 continue; | 1634 continue; |
| 1636 } | 1635 } |
| 1637 | 1636 |
| 1638 PropertyDetails details = GetDetailsImpl(*dictionary, entry); | 1637 PropertyDetails details = GetDetailsImpl(*dictionary, entry); |
| 1639 switch (details.kind()) { | 1638 switch (details.kind()) { |
| 1640 case kData: { | 1639 case kData: { |
| 1641 Object* element_k = dictionary->ValueAt(entry); | 1640 Object* element_k = dictionary->ValueAt(entry); |
| 1642 if (value->SameValueZero(element_k)) return Just(true); | 1641 if (value->SameValueZero(element_k)) return Just(true); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1688 Handle<JSObject> receiver, | 1687 Handle<JSObject> receiver, |
| 1689 Handle<Object> value, | 1688 Handle<Object> value, |
| 1690 uint32_t start_from, uint32_t length) { | 1689 uint32_t start_from, uint32_t length) { |
| 1691 DCHECK(JSObject::PrototypeHasNoElements(isolate, *receiver)); | 1690 DCHECK(JSObject::PrototypeHasNoElements(isolate, *receiver)); |
| 1692 | 1691 |
| 1693 Handle<SeededNumberDictionary> dictionary( | 1692 Handle<SeededNumberDictionary> dictionary( |
| 1694 SeededNumberDictionary::cast(receiver->elements()), isolate); | 1693 SeededNumberDictionary::cast(receiver->elements()), isolate); |
| 1695 // Iterate through entire range, as accessing elements out of order is | 1694 // Iterate through entire range, as accessing elements out of order is |
| 1696 // observable. | 1695 // observable. |
| 1697 for (uint32_t k = start_from; k < length; ++k) { | 1696 for (uint32_t k = start_from; k < length; ++k) { |
| 1698 int entry = dictionary->FindEntry(isolate, k); | 1697 int entry = dictionary->FindEntry(k); |
| 1699 if (entry == SeededNumberDictionary::kNotFound) { | 1698 if (entry == SeededNumberDictionary::kNotFound) { |
| 1700 continue; | 1699 continue; |
| 1701 } | 1700 } |
| 1702 | 1701 |
| 1703 PropertyDetails details = GetDetailsImpl(*dictionary, entry); | 1702 PropertyDetails details = GetDetailsImpl(*dictionary, entry); |
| 1704 switch (details.kind()) { | 1703 switch (details.kind()) { |
| 1705 case kData: { | 1704 case kData: { |
| 1706 Object* element_k = dictionary->ValueAt(entry); | 1705 Object* element_k = dictionary->ValueAt(entry); |
| 1707 if (value->StrictEquals(element_k)) { | 1706 if (value->StrictEquals(element_k)) { |
| 1708 return Just<int64_t>(k); | 1707 return Just<int64_t>(k); |
| (...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3854 insertion_index += len; | 3853 insertion_index += len; |
| 3855 } | 3854 } |
| 3856 | 3855 |
| 3857 DCHECK_EQ(insertion_index, result_len); | 3856 DCHECK_EQ(insertion_index, result_len); |
| 3858 return result_array; | 3857 return result_array; |
| 3859 } | 3858 } |
| 3860 | 3859 |
| 3861 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; | 3860 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; |
| 3862 } // namespace internal | 3861 } // namespace internal |
| 3863 } // namespace v8 | 3862 } // namespace v8 |
| OLD | NEW |