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 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1739 #endif // ENABLE_EXTRA_CHECKS | 1739 #endif // ENABLE_EXTRA_CHECKS |
1740 } | 1740 } |
1741 | 1741 |
1742 | 1742 |
1743 FixedArrayBase* FixedArrayBase::cast(Object* object) { | 1743 FixedArrayBase* FixedArrayBase::cast(Object* object) { |
1744 ASSERT(object->IsFixedArray() || object->IsFixedDoubleArray()); | 1744 ASSERT(object->IsFixedArray() || object->IsFixedDoubleArray()); |
1745 return reinterpret_cast<FixedArrayBase*>(object); | 1745 return reinterpret_cast<FixedArrayBase*>(object); |
1746 } | 1746 } |
1747 | 1747 |
1748 | 1748 |
1749 ElementsKind FixedArrayBase::GetElementsKind() { | |
Michael Starzinger
2012/11/29 09:39:32
I don't like moving this outside of elements acces
Toon Verwaest
2012/11/29 14:04:40
Done.
| |
1750 switch (map()->instance_type()) { | |
1751 case FIXED_ARRAY_TYPE: | |
1752 if (IsDictionary()) { | |
1753 return DICTIONARY_ELEMENTS; | |
1754 } else { | |
1755 return FAST_HOLEY_ELEMENTS; | |
1756 } | |
1757 case FIXED_DOUBLE_ARRAY_TYPE: | |
1758 return FAST_HOLEY_DOUBLE_ELEMENTS; | |
1759 case EXTERNAL_BYTE_ARRAY_TYPE: | |
1760 return EXTERNAL_BYTE_ELEMENTS; | |
1761 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: | |
1762 return EXTERNAL_UNSIGNED_BYTE_ELEMENTS; | |
1763 case EXTERNAL_SHORT_ARRAY_TYPE: | |
1764 return EXTERNAL_SHORT_ELEMENTS; | |
1765 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: | |
1766 return EXTERNAL_UNSIGNED_SHORT_ELEMENTS; | |
1767 case EXTERNAL_INT_ARRAY_TYPE: | |
1768 return EXTERNAL_INT_ELEMENTS; | |
1769 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: | |
1770 return EXTERNAL_UNSIGNED_INT_ELEMENTS; | |
1771 case EXTERNAL_FLOAT_ARRAY_TYPE: | |
1772 return EXTERNAL_FLOAT_ELEMENTS; | |
1773 case EXTERNAL_DOUBLE_ARRAY_TYPE: | |
1774 return EXTERNAL_DOUBLE_ELEMENTS; | |
1775 case EXTERNAL_PIXEL_ARRAY_TYPE: | |
1776 return EXTERNAL_PIXEL_ELEMENTS; | |
1777 default: | |
1778 UNREACHABLE(); | |
1779 } | |
1780 return FAST_HOLEY_ELEMENTS; | |
1781 } | |
1782 | |
1749 Object* FixedArray::get(int index) { | 1783 Object* FixedArray::get(int index) { |
1750 ASSERT(index >= 0 && index < this->length()); | 1784 ASSERT(index >= 0 && index < this->length()); |
1751 return READ_FIELD(this, kHeaderSize + index * kPointerSize); | 1785 return READ_FIELD(this, kHeaderSize + index * kPointerSize); |
1752 } | 1786 } |
1753 | 1787 |
1754 | 1788 |
1755 bool FixedArray::is_the_hole(int index) { | 1789 bool FixedArray::is_the_hole(int index) { |
1756 return get(index) == GetHeap()->the_hole_value(); | 1790 return get(index) == GetHeap()->the_hole_value(); |
1757 } | 1791 } |
1758 | 1792 |
(...skipping 3786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5545 #undef WRITE_UINT32_FIELD | 5579 #undef WRITE_UINT32_FIELD |
5546 #undef READ_SHORT_FIELD | 5580 #undef READ_SHORT_FIELD |
5547 #undef WRITE_SHORT_FIELD | 5581 #undef WRITE_SHORT_FIELD |
5548 #undef READ_BYTE_FIELD | 5582 #undef READ_BYTE_FIELD |
5549 #undef WRITE_BYTE_FIELD | 5583 #undef WRITE_BYTE_FIELD |
5550 | 5584 |
5551 | 5585 |
5552 } } // namespace v8::internal | 5586 } } // namespace v8::internal |
5553 | 5587 |
5554 #endif // V8_OBJECTS_INL_H_ | 5588 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |