OLD | NEW |
---|---|
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1655 // [1]: next enumeration index (Smi), or pointer to small fixed array: | 1655 // [1]: next enumeration index (Smi), or pointer to small fixed array: |
1656 // [0]: next enumeration index (Smi) | 1656 // [0]: next enumeration index (Smi) |
1657 // [1]: pointer to fixed array with enum cache | 1657 // [1]: pointer to fixed array with enum cache |
1658 // [2]: first key | 1658 // [2]: first key |
1659 // [length() - 1]: last key | 1659 // [length() - 1]: last key |
1660 // | 1660 // |
1661 class DescriptorArray: public FixedArray { | 1661 class DescriptorArray: public FixedArray { |
1662 public: | 1662 public: |
1663 // Is this the singleton empty_descriptor_array? | 1663 // Is this the singleton empty_descriptor_array? |
1664 inline bool IsEmpty(); | 1664 inline bool IsEmpty(); |
1665 | |
1665 // Returns the number of descriptors in the array. | 1666 // Returns the number of descriptors in the array. |
1666 int number_of_descriptors() { | 1667 int number_of_descriptors() { |
1667 return IsEmpty() ? 0 : length() - kFirstIndex; | 1668 return IsEmpty() ? 0 : length() - kFirstIndex; |
1668 } | 1669 } |
1669 | 1670 |
1670 int NextEnumerationIndex() { | 1671 int NextEnumerationIndex() { |
1671 if (IsEmpty()) return PropertyDetails::kInitialIndex; | 1672 if (IsEmpty()) return PropertyDetails::kInitialIndex; |
1672 Object* obj = get(kEnumerationIndexIndex); | 1673 Object* obj = get(kEnumerationIndexIndex); |
1673 if (obj->IsSmi()) { | 1674 if (obj->IsSmi()) { |
1674 return Smi::cast(obj)->value(); | 1675 return Smi::cast(obj)->value(); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1794 | 1795 |
1795 // The maximum number of descriptors we want in a descriptor array (should | 1796 // The maximum number of descriptors we want in a descriptor array (should |
1796 // fit in a page). | 1797 // fit in a page). |
1797 static const int kMaxNumberOfDescriptors = 1024 + 512; | 1798 static const int kMaxNumberOfDescriptors = 1024 + 512; |
1798 | 1799 |
1799 private: | 1800 private: |
1800 // Conversion from descriptor number to array indices. | 1801 // Conversion from descriptor number to array indices. |
1801 static int ToKeyIndex(int descriptor_number) { | 1802 static int ToKeyIndex(int descriptor_number) { |
1802 return descriptor_number+kFirstIndex; | 1803 return descriptor_number+kFirstIndex; |
1803 } | 1804 } |
1805 | |
1806 static int ToDetailsIndex(int descriptor_number) { | |
1807 return( descriptor_number << 1) + 1; | |
Mads Ager (chromium)
2009/12/16 16:13:24
Not your code, but move parenthesis.
| |
1808 } | |
1809 | |
1804 static int ToValueIndex(int descriptor_number) { | 1810 static int ToValueIndex(int descriptor_number) { |
1805 return descriptor_number << 1; | 1811 return descriptor_number << 1; |
1806 } | 1812 } |
1807 static int ToDetailsIndex(int descriptor_number) { | |
1808 return( descriptor_number << 1) + 1; | |
1809 } | |
1810 | 1813 |
1811 bool is_null_descriptor(int descriptor_number) { | 1814 bool is_null_descriptor(int descriptor_number) { |
1812 return PropertyDetails(GetDetails(descriptor_number)).type() == | 1815 return PropertyDetails(GetDetails(descriptor_number)).type() == |
1813 NULL_DESCRIPTOR; | 1816 NULL_DESCRIPTOR; |
1814 } | 1817 } |
1815 // Swap operation on FixedArray without using write barriers. | 1818 // Swap operation on FixedArray without using write barriers. |
1816 static inline void fast_swap(FixedArray* array, int first, int second); | 1819 static inline void fast_swap(FixedArray* array, int first, int second); |
1817 | 1820 |
1818 // Swap descriptor first and second. | 1821 // Swap descriptor first and second. |
1819 inline void Swap(int first, int second); | 1822 inline void Swap(int first, int second); |
(...skipping 3043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4863 } else { | 4866 } else { |
4864 value &= ~(1 << bit_position); | 4867 value &= ~(1 << bit_position); |
4865 } | 4868 } |
4866 return value; | 4869 return value; |
4867 } | 4870 } |
4868 }; | 4871 }; |
4869 | 4872 |
4870 } } // namespace v8::internal | 4873 } } // namespace v8::internal |
4871 | 4874 |
4872 #endif // V8_OBJECTS_H_ | 4875 #endif // V8_OBJECTS_H_ |
OLD | NEW |