OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3854 // [prototype transitions]: cache of prototype transitions. | 3854 // [prototype transitions]: cache of prototype transitions. |
3855 // Prototype transition is a transition that happens | 3855 // Prototype transition is a transition that happens |
3856 // when we change object's prototype to a new one. | 3856 // when we change object's prototype to a new one. |
3857 // Cache format: | 3857 // Cache format: |
3858 // 0: finger - index of the first free cell in the cache | 3858 // 0: finger - index of the first free cell in the cache |
3859 // 1 + 2 * i: prototype | 3859 // 1 + 2 * i: prototype |
3860 // 2 + 2 * i: target map | 3860 // 2 + 2 * i: target map |
3861 DECL_ACCESSORS(prototype_transitions, FixedArray) | 3861 DECL_ACCESSORS(prototype_transitions, FixedArray) |
3862 inline FixedArray* unchecked_prototype_transitions(); | 3862 inline FixedArray* unchecked_prototype_transitions(); |
3863 | 3863 |
| 3864 static const int kProtoTransitionHeaderSize = 1; |
| 3865 static const int kProtoTransitionNumberOfEntriesOffset = 0; |
| 3866 static const int kProtoTransitionElementsPerEntry = 2; |
| 3867 static const int kProtoTransitionPrototypeOffset = 0; |
| 3868 static const int kProtoTransitionMapOffset = 1; |
| 3869 |
| 3870 inline int NumberOfProtoTransitions() { |
| 3871 FixedArray* cache = unchecked_prototype_transitions(); |
| 3872 if (cache->length() == 0) return 0; |
| 3873 return |
| 3874 Smi::cast(cache->get(kProtoTransitionNumberOfEntriesOffset))->value(); |
| 3875 } |
| 3876 |
| 3877 inline void SetNumberOfProtoTransitions(int value) { |
| 3878 FixedArray* cache = unchecked_prototype_transitions(); |
| 3879 ASSERT(cache->length() != 0); |
| 3880 cache->set_unchecked(kProtoTransitionNumberOfEntriesOffset, |
| 3881 Smi::FromInt(value)); |
| 3882 } |
| 3883 |
3864 // Lookup in the map's instance descriptors and fill out the result | 3884 // Lookup in the map's instance descriptors and fill out the result |
3865 // with the given holder if the name is found. The holder may be | 3885 // with the given holder if the name is found. The holder may be |
3866 // NULL when this function is used from the compiler. | 3886 // NULL when this function is used from the compiler. |
3867 void LookupInDescriptors(JSObject* holder, | 3887 void LookupInDescriptors(JSObject* holder, |
3868 String* name, | 3888 String* name, |
3869 LookupResult* result); | 3889 LookupResult* result); |
3870 | 3890 |
3871 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); | 3891 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); |
3872 | 3892 |
3873 MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode, | 3893 MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode, |
(...skipping 3019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6893 } else { | 6913 } else { |
6894 value &= ~(1 << bit_position); | 6914 value &= ~(1 << bit_position); |
6895 } | 6915 } |
6896 return value; | 6916 return value; |
6897 } | 6917 } |
6898 }; | 6918 }; |
6899 | 6919 |
6900 } } // namespace v8::internal | 6920 } } // namespace v8::internal |
6901 | 6921 |
6902 #endif // V8_OBJECTS_H_ | 6922 #endif // V8_OBJECTS_H_ |
OLD | NEW |