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 4731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4742 inline void set_attached_to_shared_function_info(bool value); | 4742 inline void set_attached_to_shared_function_info(bool value); |
4743 | 4743 |
4744 inline bool attached_to_shared_function_info(); | 4744 inline bool attached_to_shared_function_info(); |
4745 | 4745 |
4746 // Tells whether the map is shared between objects that may have different | 4746 // Tells whether the map is shared between objects that may have different |
4747 // behavior. If true, the map should never be modified, instead a clone | 4747 // behavior. If true, the map should never be modified, instead a clone |
4748 // should be created and modified. | 4748 // should be created and modified. |
4749 inline void set_is_shared(bool value); | 4749 inline void set_is_shared(bool value); |
4750 inline bool is_shared(); | 4750 inline bool is_shared(); |
4751 | 4751 |
4752 // Tells whether the map is used for an object that is a prototype for another | |
4753 // object or is the prototype on a function. Such maps are made faster by | |
4754 // tweaking the heuristics that distinguish between regular object-oriented | |
4755 // objects and the objects that are being used as hash maps. This flag is | |
4756 // for optimization, not correctness. | |
4757 inline void set_used_for_prototype(bool value); | |
4758 inline bool used_for_prototype(); | |
4759 | |
4760 // Tells whether the instance needs security checks when accessing its | 4752 // Tells whether the instance needs security checks when accessing its |
4761 // properties. | 4753 // properties. |
4762 inline void set_is_access_check_needed(bool access_check_needed); | 4754 inline void set_is_access_check_needed(bool access_check_needed); |
4763 inline bool is_access_check_needed(); | 4755 inline bool is_access_check_needed(); |
4764 | 4756 |
4765 // [prototype]: implicit prototype object. | 4757 // [prototype]: implicit prototype object. |
4766 DECL_ACCESSORS(prototype, Object) | 4758 DECL_ACCESSORS(prototype, Object) |
4767 | 4759 |
4768 // [constructor]: points back to the function responsible for this map. | 4760 // [constructor]: points back to the function responsible for this map. |
4769 DECL_ACCESSORS(constructor, Object) | 4761 DECL_ACCESSORS(constructor, Object) |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4937 typedef void (*TraverseCallback)(Map* map, void* data); | 4929 typedef void (*TraverseCallback)(Map* map, void* data); |
4938 | 4930 |
4939 void TraverseTransitionTree(TraverseCallback callback, void* data); | 4931 void TraverseTransitionTree(TraverseCallback callback, void* data); |
4940 | 4932 |
4941 // When you set the prototype of an object using the __proto__ accessor you | 4933 // When you set the prototype of an object using the __proto__ accessor you |
4942 // need a new map for the object (the prototype is stored in the map). In | 4934 // need a new map for the object (the prototype is stored in the map). In |
4943 // order not to multiply maps unnecessarily we store these as transitions in | 4935 // order not to multiply maps unnecessarily we store these as transitions in |
4944 // the original map. That way we can transition to the same map if the same | 4936 // the original map. That way we can transition to the same map if the same |
4945 // prototype is set, rather than creating a new map every time. The | 4937 // prototype is set, rather than creating a new map every time. The |
4946 // transitions are in the form of a map where the keys are prototype objects | 4938 // transitions are in the form of a map where the keys are prototype objects |
4947 // and the values are the maps the are transitioned to. The special key | 4939 // and the values are the maps the are transitioned to. |
4948 // the_hole denotes the map we should transition to when the | |
4949 // used_for_prototype flag is set. | |
4950 static const int kMaxCachedPrototypeTransitions = 256; | 4940 static const int kMaxCachedPrototypeTransitions = 256; |
4951 | 4941 |
4952 Map* GetPrototypeTransition(Object* prototype); | 4942 Map* GetPrototypeTransition(Object* prototype); |
4953 | 4943 |
4954 MUST_USE_RESULT MaybeObject* PutPrototypeTransition(Object* prototype, | 4944 MUST_USE_RESULT MaybeObject* PutPrototypeTransition(Object* prototype, |
4955 Map* map); | 4945 Map* map); |
4956 | 4946 |
4957 static const int kMaxPreAllocatedPropertyFields = 255; | 4947 static const int kMaxPreAllocatedPropertyFields = 255; |
4958 | 4948 |
4959 // Layout description. | 4949 // Layout description. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5035 static const int8_t kMaximumBitField2FastHoleyElementValue = | 5025 static const int8_t kMaximumBitField2FastHoleyElementValue = |
5036 static_cast<int8_t>((FAST_HOLEY_ELEMENTS + 1) << | 5026 static_cast<int8_t>((FAST_HOLEY_ELEMENTS + 1) << |
5037 Map::kElementsKindShift) - 1; | 5027 Map::kElementsKindShift) - 1; |
5038 static const int8_t kMaximumBitField2FastHoleySmiElementValue = | 5028 static const int8_t kMaximumBitField2FastHoleySmiElementValue = |
5039 static_cast<int8_t>((FAST_HOLEY_SMI_ELEMENTS + 1) << | 5029 static_cast<int8_t>((FAST_HOLEY_SMI_ELEMENTS + 1) << |
5040 Map::kElementsKindShift) - 1; | 5030 Map::kElementsKindShift) - 1; |
5041 | 5031 |
5042 // Bit positions for bit field 3 | 5032 // Bit positions for bit field 3 |
5043 static const int kIsShared = 0; | 5033 static const int kIsShared = 0; |
5044 static const int kFunctionWithPrototype = 1; | 5034 static const int kFunctionWithPrototype = 1; |
5045 static const int kUsedForPrototype = 2; | |
5046 | 5035 |
5047 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, | 5036 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, |
5048 kPointerFieldsEndOffset, | 5037 kPointerFieldsEndOffset, |
5049 kSize> BodyDescriptor; | 5038 kSize> BodyDescriptor; |
5050 | 5039 |
5051 private: | 5040 private: |
5052 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); | 5041 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); |
5053 }; | 5042 }; |
5054 | 5043 |
5055 | 5044 |
(...skipping 3736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8792 } else { | 8781 } else { |
8793 value &= ~(1 << bit_position); | 8782 value &= ~(1 << bit_position); |
8794 } | 8783 } |
8795 return value; | 8784 return value; |
8796 } | 8785 } |
8797 }; | 8786 }; |
8798 | 8787 |
8799 } } // namespace v8::internal | 8788 } } // namespace v8::internal |
8800 | 8789 |
8801 #endif // V8_OBJECTS_H_ | 8790 #endif // V8_OBJECTS_H_ |
OLD | NEW |