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 2617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2628 bool IsConsistentWithBackPointers(Map* current_map); | 2628 bool IsConsistentWithBackPointers(Map* current_map); |
2629 | 2629 |
2630 // Are two DescriptorArrays equal? | 2630 // Are two DescriptorArrays equal? |
2631 bool IsEqualTo(DescriptorArray* other); | 2631 bool IsEqualTo(DescriptorArray* other); |
2632 #endif | 2632 #endif |
2633 | 2633 |
2634 // The maximum number of descriptors we want in a descriptor array (should | 2634 // The maximum number of descriptors we want in a descriptor array (should |
2635 // fit in a page). | 2635 // fit in a page). |
2636 static const int kMaxNumberOfDescriptors = 1024 + 512; | 2636 static const int kMaxNumberOfDescriptors = 1024 + 512; |
2637 | 2637 |
2638 static int SizeFor(int number_of_descriptors) { | 2638 // Returns the fixed array length required to hold number_of_descriptors |
| 2639 // descriptors. |
| 2640 static int LengthFor(int number_of_descriptors) { |
2639 return ToKeyIndex(number_of_descriptors); | 2641 return ToKeyIndex(number_of_descriptors); |
2640 } | 2642 } |
2641 | 2643 |
2642 private: | 2644 private: |
2643 // An entry in a DescriptorArray, represented as an (array, index) pair. | 2645 // An entry in a DescriptorArray, represented as an (array, index) pair. |
2644 class Entry { | 2646 class Entry { |
2645 public: | 2647 public: |
2646 inline explicit Entry(DescriptorArray* descs, int index) : | 2648 inline explicit Entry(DescriptorArray* descs, int index) : |
2647 descs_(descs), index_(index) { } | 2649 descs_(descs), index_(index) { } |
2648 | 2650 |
(...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4889 // with the given holder if the name is found. The holder may be | 4891 // with the given holder if the name is found. The holder may be |
4890 // NULL when this function is used from the compiler. | 4892 // NULL when this function is used from the compiler. |
4891 void LookupDescriptor(JSObject* holder, | 4893 void LookupDescriptor(JSObject* holder, |
4892 String* name, | 4894 String* name, |
4893 LookupResult* result); | 4895 LookupResult* result); |
4894 | 4896 |
4895 void LookupTransition(JSObject* holder, | 4897 void LookupTransition(JSObject* holder, |
4896 String* name, | 4898 String* name, |
4897 LookupResult* result); | 4899 LookupResult* result); |
4898 | 4900 |
| 4901 // The size of transition arrays are limited so they do not end up in large |
| 4902 // object space. Otherwise ClearNonLiveTransitions would leak memory while |
| 4903 // applying in-place right trimming. |
| 4904 inline bool CanHaveMoreTransitions(); |
| 4905 |
4899 void SetLastAdded(int index) { | 4906 void SetLastAdded(int index) { |
4900 set_bit_field3(LastAddedBits::update(bit_field3(), index)); | 4907 set_bit_field3(LastAddedBits::update(bit_field3(), index)); |
4901 } | 4908 } |
4902 | 4909 |
4903 int LastAdded() { | 4910 int LastAdded() { |
4904 return LastAddedBits::decode(bit_field3()); | 4911 return LastAddedBits::decode(bit_field3()); |
4905 } | 4912 } |
4906 | 4913 |
4907 int NumberOfSetDescriptors() { | 4914 int NumberOfSetDescriptors() { |
4908 ASSERT(!instance_descriptors()->IsEmpty()); | 4915 ASSERT(!instance_descriptors()->IsEmpty()); |
(...skipping 3998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8907 } else { | 8914 } else { |
8908 value &= ~(1 << bit_position); | 8915 value &= ~(1 << bit_position); |
8909 } | 8916 } |
8910 return value; | 8917 return value; |
8911 } | 8918 } |
8912 }; | 8919 }; |
8913 | 8920 |
8914 } } // namespace v8::internal | 8921 } } // namespace v8::internal |
8915 | 8922 |
8916 #endif // V8_OBJECTS_H_ | 8923 #endif // V8_OBJECTS_H_ |
OLD | NEW |