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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 OMIT_CREATION | 170 OMIT_CREATION |
171 }; | 171 }; |
172 | 172 |
173 | 173 |
174 // Indicates whether transitions can be added to a source map or not. | 174 // Indicates whether transitions can be added to a source map or not. |
175 enum TransitionFlag { | 175 enum TransitionFlag { |
176 INSERT_TRANSITION, | 176 INSERT_TRANSITION, |
177 OMIT_TRANSITION | 177 OMIT_TRANSITION |
178 }; | 178 }; |
179 | 179 |
180 // Indicates whether we are only interested in the descriptors of a particular | |
181 // map, or in all descriptors in the descriptor array. | |
182 enum DescriptorFlag { | |
183 ALL_DESCRIPTORS, | |
184 OWN_DESCRIPTORS | |
185 }; | |
186 | |
187 | 180 |
188 // Instance size sentinel for objects of variable size. | 181 // Instance size sentinel for objects of variable size. |
189 const int kVariableSizeSentinel = 0; | 182 const int kVariableSizeSentinel = 0; |
190 | 183 |
191 const int kStubMajorKeyBits = 6; | 184 const int kStubMajorKeyBits = 6; |
192 const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; | 185 const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits; |
193 | 186 |
194 // All Maps have a field instance_type containing a InstanceType. | 187 // All Maps have a field instance_type containing a InstanceType. |
195 // It describes the type of the instances. | 188 // It describes the type of the instances. |
196 // | 189 // |
(...skipping 2284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2481 inline bool IsEmpty(); | 2474 inline bool IsEmpty(); |
2482 | 2475 |
2483 // Returns the number of descriptors in the array. | 2476 // Returns the number of descriptors in the array. |
2484 int number_of_descriptors() { | 2477 int number_of_descriptors() { |
2485 ASSERT(length() >= kFirstIndex || IsEmpty()); | 2478 ASSERT(length() >= kFirstIndex || IsEmpty()); |
2486 int len = length(); | 2479 int len = length(); |
2487 return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kDescriptorSize; | 2480 return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kDescriptorSize; |
2488 } | 2481 } |
2489 | 2482 |
2490 inline int number_of_entries() { return number_of_descriptors(); } | 2483 inline int number_of_entries() { return number_of_descriptors(); } |
| 2484 inline int NextEnumerationIndex() { return number_of_descriptors() + 1; } |
2491 | 2485 |
2492 bool HasEnumCache() { | 2486 bool HasEnumCache() { |
2493 return !IsEmpty() && !get(kEnumCacheIndex)->IsSmi(); | 2487 return !IsEmpty() && !get(kEnumCacheIndex)->IsSmi(); |
2494 } | 2488 } |
2495 | 2489 |
2496 void CopyEnumCacheFrom(DescriptorArray* array) { | |
2497 set(kEnumCacheIndex, array->get(kEnumCacheIndex)); | |
2498 } | |
2499 | |
2500 Object* GetEnumCache() { | 2490 Object* GetEnumCache() { |
2501 ASSERT(HasEnumCache()); | 2491 ASSERT(HasEnumCache()); |
2502 FixedArray* bridge = FixedArray::cast(get(kEnumCacheIndex)); | 2492 FixedArray* bridge = FixedArray::cast(get(kEnumCacheIndex)); |
2503 return bridge->get(kEnumCacheBridgeCacheIndex); | 2493 return bridge->get(kEnumCacheBridgeCacheIndex); |
2504 } | 2494 } |
2505 | 2495 |
2506 Object** GetEnumCacheSlot() { | 2496 Object** GetEnumCacheSlot() { |
2507 ASSERT(HasEnumCache()); | 2497 ASSERT(HasEnumCache()); |
2508 return HeapObject::RawField(reinterpret_cast<HeapObject*>(this), | 2498 return HeapObject::RawField(reinterpret_cast<HeapObject*>(this), |
2509 kEnumCacheOffset); | 2499 kEnumCacheOffset); |
2510 } | 2500 } |
2511 | 2501 |
2512 void ClearEnumCache(); | |
2513 | |
2514 // Initialize or change the enum cache, | 2502 // Initialize or change the enum cache, |
2515 // using the supplied storage for the small "bridge". | 2503 // using the supplied storage for the small "bridge". |
2516 void SetEnumCache(FixedArray* bridge_storage, | 2504 void SetEnumCache(FixedArray* bridge_storage, |
2517 FixedArray* new_cache, | 2505 FixedArray* new_cache, |
2518 Object* new_index_cache); | 2506 Object* new_index_cache); |
2519 | 2507 |
2520 // Accessors for fetching instance descriptor at descriptor number. | 2508 // Accessors for fetching instance descriptor at descriptor number. |
2521 inline String* GetKey(int descriptor_number); | 2509 inline String* GetKey(int descriptor_number); |
2522 inline Object** GetKeySlot(int descriptor_number); | 2510 inline Object** GetKeySlot(int descriptor_number); |
2523 inline Object* GetValue(int descriptor_number); | 2511 inline Object* GetValue(int descriptor_number); |
(...skipping 22 matching lines...) Expand all Loading... |
2546 const WhitenessWitness&, | 2534 const WhitenessWitness&, |
2547 int number_of_set_descriptors); | 2535 int number_of_set_descriptors); |
2548 | 2536 |
2549 // Transfer a complete descriptor from the src descriptor array to this | 2537 // Transfer a complete descriptor from the src descriptor array to this |
2550 // descriptor array. | 2538 // descriptor array. |
2551 void CopyFrom(int dst_index, | 2539 void CopyFrom(int dst_index, |
2552 DescriptorArray* src, | 2540 DescriptorArray* src, |
2553 int src_index, | 2541 int src_index, |
2554 const WhitenessWitness&); | 2542 const WhitenessWitness&); |
2555 | 2543 |
2556 MUST_USE_RESULT MaybeObject* CopyUpTo(int enumeration_index); | |
2557 | |
2558 // Sort the instance descriptors by the hash codes of their keys. | 2544 // Sort the instance descriptors by the hash codes of their keys. |
2559 void Sort(); | 2545 void Sort(); |
| 2546 inline void SwapSortedKeys(int first, int second); |
2560 | 2547 |
2561 // Search the instance descriptors for given name. | 2548 // Search the instance descriptors for given name. |
2562 INLINE(int Search(String* name, int number_of_own_descriptors)); | 2549 INLINE(int Search(String* name)); |
2563 | 2550 |
2564 // As the above, but uses DescriptorLookupCache and updates it when | 2551 // As the above, but uses DescriptorLookupCache and updates it when |
2565 // necessary. | 2552 // necessary. |
2566 INLINE(int SearchWithCache(String* name, Map* map)); | 2553 INLINE(int SearchWithCache(String* name)); |
| 2554 |
| 2555 // Tells whether the name is present int the array. |
| 2556 bool Contains(String* name) { return kNotFound != Search(name); } |
2567 | 2557 |
2568 // Allocates a DescriptorArray, but returns the singleton | 2558 // Allocates a DescriptorArray, but returns the singleton |
2569 // empty descriptor array object if number_of_descriptors is 0. | 2559 // empty descriptor array object if number_of_descriptors is 0. |
2570 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_descriptors); | 2560 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_descriptors); |
2571 | 2561 |
2572 // Casting. | 2562 // Casting. |
2573 static inline DescriptorArray* cast(Object* obj); | 2563 static inline DescriptorArray* cast(Object* obj); |
2574 | 2564 |
2575 // Constant for denoting key was not found. | 2565 // Constant for denoting key was not found. |
2576 static const int kNotFound = -1; | 2566 static const int kNotFound = -1; |
(...skipping 22 matching lines...) Expand all Loading... |
2599 #ifdef OBJECT_PRINT | 2589 #ifdef OBJECT_PRINT |
2600 // Print all the descriptors. | 2590 // Print all the descriptors. |
2601 inline void PrintDescriptors() { | 2591 inline void PrintDescriptors() { |
2602 PrintDescriptors(stdout); | 2592 PrintDescriptors(stdout); |
2603 } | 2593 } |
2604 void PrintDescriptors(FILE* out); | 2594 void PrintDescriptors(FILE* out); |
2605 #endif | 2595 #endif |
2606 | 2596 |
2607 #ifdef DEBUG | 2597 #ifdef DEBUG |
2608 // Is the descriptor array sorted and without duplicates? | 2598 // Is the descriptor array sorted and without duplicates? |
2609 bool IsSortedNoDuplicates(int valid_descriptors = -1); | 2599 bool IsSortedNoDuplicates(); |
2610 | 2600 |
2611 // Is the descriptor array consistent with the back pointers in targets? | 2601 // Is the descriptor array consistent with the back pointers in targets? |
2612 bool IsConsistentWithBackPointers(Map* current_map); | 2602 bool IsConsistentWithBackPointers(Map* current_map); |
2613 | 2603 |
2614 // Are two DescriptorArrays equal? | 2604 // Are two DescriptorArrays equal? |
2615 bool IsEqualTo(DescriptorArray* other); | 2605 bool IsEqualTo(DescriptorArray* other); |
2616 #endif | 2606 #endif |
2617 | 2607 |
2618 // The maximum number of descriptors we want in a descriptor array (should | 2608 // The maximum number of descriptors we want in a descriptor array (should |
2619 // fit in a page). | 2609 // fit in a page). |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2652 (descriptor_number * kDescriptorSize) + | 2642 (descriptor_number * kDescriptorSize) + |
2653 kDescriptorDetails; | 2643 kDescriptorDetails; |
2654 } | 2644 } |
2655 | 2645 |
2656 static int ToValueIndex(int descriptor_number) { | 2646 static int ToValueIndex(int descriptor_number) { |
2657 return kFirstIndex + | 2647 return kFirstIndex + |
2658 (descriptor_number * kDescriptorSize) + | 2648 (descriptor_number * kDescriptorSize) + |
2659 kDescriptorValue; | 2649 kDescriptorValue; |
2660 } | 2650 } |
2661 | 2651 |
| 2652 // Swap operation on FixedArray without using write barriers. |
| 2653 static inline void NoIncrementalWriteBarrierSwap( |
| 2654 FixedArray* array, int first, int second); |
| 2655 |
2662 // Swap first and second descriptor. | 2656 // Swap first and second descriptor. |
2663 inline void SwapSortedKeys(int first, int second); | 2657 inline void NoIncrementalWriteBarrierSwapDescriptors( |
| 2658 int first, int second); |
2664 | 2659 |
2665 DISALLOW_IMPLICIT_CONSTRUCTORS(DescriptorArray); | 2660 DISALLOW_IMPLICIT_CONSTRUCTORS(DescriptorArray); |
2666 }; | 2661 }; |
2667 | 2662 |
2668 | 2663 |
2669 enum SearchMode { ALL_ENTRIES, VALID_ENTRIES }; | 2664 template<typename T> |
2670 | 2665 inline int LinearSearch(T* array, String* name, int len); |
2671 template<SearchMode search_mode, typename T> | |
2672 inline int LinearSearch(T* array, String* name, int len, int valid_entries); | |
2673 | 2666 |
2674 | 2667 |
2675 template<SearchMode search_mode, typename T> | 2668 template<typename T> |
2676 inline int Search(T* array, String* name, int valid_entries = 0); | 2669 inline int Search(T* array, String* name); |
2677 | 2670 |
2678 | 2671 |
2679 // HashTable is a subclass of FixedArray that implements a hash table | 2672 // HashTable is a subclass of FixedArray that implements a hash table |
2680 // that uses open addressing and quadratic probing. | 2673 // that uses open addressing and quadratic probing. |
2681 // | 2674 // |
2682 // In order for the quadratic probing to work, elements that have not | 2675 // In order for the quadratic probing to work, elements that have not |
2683 // yet been used and elements that have been deleted are | 2676 // yet been used and elements that have been deleted are |
2684 // distinguished. Probing continues when deleted elements are | 2677 // distinguished. Probing continues when deleted elements are |
2685 // encountered and stops when unused elements are encountered. | 2678 // encountered and stops when unused elements are encountered. |
2686 // | 2679 // |
(...skipping 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4672 | 4665 |
4673 // Bit field 3. | 4666 // Bit field 3. |
4674 inline int bit_field3(); | 4667 inline int bit_field3(); |
4675 inline void set_bit_field3(int value); | 4668 inline void set_bit_field3(int value); |
4676 | 4669 |
4677 class EnumLengthBits: public BitField<int, 0, 11> {}; | 4670 class EnumLengthBits: public BitField<int, 0, 11> {}; |
4678 class NumberOfOwnDescriptorsBits: public BitField<int, 11, 11> {}; | 4671 class NumberOfOwnDescriptorsBits: public BitField<int, 11, 11> {}; |
4679 class IsShared: public BitField<bool, 22, 1> {}; | 4672 class IsShared: public BitField<bool, 22, 1> {}; |
4680 class FunctionWithPrototype: public BitField<bool, 23, 1> {}; | 4673 class FunctionWithPrototype: public BitField<bool, 23, 1> {}; |
4681 class DictionaryMap: public BitField<bool, 24, 1> {}; | 4674 class DictionaryMap: public BitField<bool, 24, 1> {}; |
4682 class OwnsDescriptors: public BitField<bool, 25, 1> {}; | |
4683 | 4675 |
4684 // Tells whether the object in the prototype property will be used | 4676 // Tells whether the object in the prototype property will be used |
4685 // for instances created from this function. If the prototype | 4677 // for instances created from this function. If the prototype |
4686 // property is set to a value that is not a JSObject, the prototype | 4678 // property is set to a value that is not a JSObject, the prototype |
4687 // property will not be used to create instances of the function. | 4679 // property will not be used to create instances of the function. |
4688 // See ECMA-262, 13.2.2. | 4680 // See ECMA-262, 13.2.2. |
4689 inline void set_non_instance_prototype(bool value); | 4681 inline void set_non_instance_prototype(bool value); |
4690 inline bool has_non_instance_prototype(); | 4682 inline bool has_non_instance_prototype(); |
4691 | 4683 |
4692 // Tells whether function has special prototype property. If not, prototype | 4684 // Tells whether function has special prototype property. If not, prototype |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4793 } | 4785 } |
4794 | 4786 |
4795 inline bool has_slow_elements_kind() { | 4787 inline bool has_slow_elements_kind() { |
4796 return elements_kind() == DICTIONARY_ELEMENTS | 4788 return elements_kind() == DICTIONARY_ELEMENTS |
4797 || elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS; | 4789 || elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS; |
4798 } | 4790 } |
4799 | 4791 |
4800 static bool IsValidElementsTransition(ElementsKind from_kind, | 4792 static bool IsValidElementsTransition(ElementsKind from_kind, |
4801 ElementsKind to_kind); | 4793 ElementsKind to_kind); |
4802 | 4794 |
4803 bool StoresOwnDescriptors() { return HasTransitionArray(); } | |
4804 inline bool HasTransitionArray(); | 4795 inline bool HasTransitionArray(); |
4805 inline bool HasElementsTransition(); | 4796 inline bool HasElementsTransition(); |
4806 inline Map* elements_transition_map(); | 4797 inline Map* elements_transition_map(); |
4807 MUST_USE_RESULT inline MaybeObject* set_elements_transition_map( | 4798 MUST_USE_RESULT inline MaybeObject* set_elements_transition_map( |
4808 Map* transitioned_map); | 4799 Map* transitioned_map); |
4809 inline void SetTransition(int transition_index, Map* target); | 4800 inline void SetTransition(int index, Map* target); |
4810 inline Map* GetTransition(int transition_index); | |
4811 MUST_USE_RESULT inline MaybeObject* AddTransition(String* key, Map* target); | 4801 MUST_USE_RESULT inline MaybeObject* AddTransition(String* key, Map* target); |
4812 DECL_ACCESSORS(transitions, TransitionArray) | 4802 DECL_ACCESSORS(transitions, TransitionArray) |
4813 inline void ClearTransitions(Heap* heap, | 4803 inline void ClearTransitions(Heap* heap, |
4814 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 4804 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
4815 | 4805 |
4816 // Tells whether the map is attached to SharedFunctionInfo | 4806 // Tells whether the map is attached to SharedFunctionInfo |
4817 // (for inobject slack tracking). | 4807 // (for inobject slack tracking). |
4818 inline void set_attached_to_shared_function_info(bool value); | 4808 inline void set_attached_to_shared_function_info(bool value); |
4819 | 4809 |
4820 inline bool attached_to_shared_function_info(); | 4810 inline bool attached_to_shared_function_info(); |
(...skipping 19 matching lines...) Expand all Loading... |
4840 // [prototype]: implicit prototype object. | 4830 // [prototype]: implicit prototype object. |
4841 DECL_ACCESSORS(prototype, Object) | 4831 DECL_ACCESSORS(prototype, Object) |
4842 | 4832 |
4843 // [constructor]: points back to the function responsible for this map. | 4833 // [constructor]: points back to the function responsible for this map. |
4844 DECL_ACCESSORS(constructor, Object) | 4834 DECL_ACCESSORS(constructor, Object) |
4845 | 4835 |
4846 inline JSFunction* unchecked_constructor(); | 4836 inline JSFunction* unchecked_constructor(); |
4847 | 4837 |
4848 // [instance descriptors]: describes the object. | 4838 // [instance descriptors]: describes the object. |
4849 inline DescriptorArray* instance_descriptors(); | 4839 inline DescriptorArray* instance_descriptors(); |
4850 inline JSGlobalPropertyCell* descriptors_pointer(); | |
4851 MUST_USE_RESULT inline MaybeObject* SetDescriptors( | 4840 MUST_USE_RESULT inline MaybeObject* SetDescriptors( |
4852 DescriptorArray* descriptors); | 4841 DescriptorArray* descriptors, |
| 4842 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
4853 static void SetDescriptors(Handle<Map> map, | 4843 static void SetDescriptors(Handle<Map> map, |
4854 Handle<DescriptorArray> descriptors); | 4844 Handle<DescriptorArray> descriptors); |
4855 MUST_USE_RESULT inline MaybeObject* InitializeDescriptors( | 4845 MUST_USE_RESULT inline MaybeObject* InitializeDescriptors( |
4856 DescriptorArray* descriptors); | 4846 DescriptorArray* descriptors); |
4857 | 4847 |
4858 // [stub cache]: contains stubs compiled for this map. | 4848 // [stub cache]: contains stubs compiled for this map. |
4859 DECL_ACCESSORS(code_cache, Object) | 4849 DECL_ACCESSORS(code_cache, Object) |
4860 | 4850 |
4861 // [back pointer]: points back to the parent map from which a transition | 4851 // [back pointer]: points back to the parent map from which a transition |
4862 // leads to this map. The field overlaps with prototype transitions and the | 4852 // leads to this map. The field overlaps with prototype transitions and the |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4923 int number_of_own_descriptors = NumberOfOwnDescriptors(); | 4913 int number_of_own_descriptors = NumberOfOwnDescriptors(); |
4924 ASSERT(number_of_own_descriptors > 0); | 4914 ASSERT(number_of_own_descriptors > 0); |
4925 return number_of_own_descriptors - 1; | 4915 return number_of_own_descriptors - 1; |
4926 } | 4916 } |
4927 | 4917 |
4928 int NumberOfOwnDescriptors() { | 4918 int NumberOfOwnDescriptors() { |
4929 return NumberOfOwnDescriptorsBits::decode(bit_field3()); | 4919 return NumberOfOwnDescriptorsBits::decode(bit_field3()); |
4930 } | 4920 } |
4931 | 4921 |
4932 void SetNumberOfOwnDescriptors(int number) { | 4922 void SetNumberOfOwnDescriptors(int number) { |
4933 ASSERT(number <= instance_descriptors()->number_of_descriptors()); | |
4934 set_bit_field3(NumberOfOwnDescriptorsBits::update(bit_field3(), number)); | 4923 set_bit_field3(NumberOfOwnDescriptorsBits::update(bit_field3(), number)); |
4935 } | 4924 } |
4936 | 4925 |
4937 inline JSGlobalPropertyCell* RetrieveDescriptorsPointer(); | |
4938 | |
4939 int EnumLength() { | 4926 int EnumLength() { |
4940 return EnumLengthBits::decode(bit_field3()); | 4927 return EnumLengthBits::decode(bit_field3()); |
4941 } | 4928 } |
4942 | 4929 |
4943 void SetEnumLength(int length) { | 4930 void SetEnumLength(int index) { |
4944 if (length != kInvalidEnumCache) { | 4931 set_bit_field3(EnumLengthBits::update(bit_field3(), index)); |
4945 ASSERT(length >= 0); | |
4946 ASSERT(length == 0 || instance_descriptors()->HasEnumCache()); | |
4947 ASSERT(length <= NumberOfOwnDescriptors()); | |
4948 } | |
4949 set_bit_field3(EnumLengthBits::update(bit_field3(), length)); | |
4950 } | 4932 } |
4951 | 4933 |
4952 | |
4953 inline bool owns_descriptors(); | |
4954 inline void set_owns_descriptors(bool is_shared); | |
4955 | |
4956 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size); | 4934 MUST_USE_RESULT MaybeObject* RawCopy(int instance_size); |
4957 MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors(); | 4935 MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors(); |
4958 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); | 4936 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); |
4959 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors( | 4937 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptors( |
4960 DescriptorArray* descriptors, | 4938 DescriptorArray* descriptors, |
4961 String* name, | 4939 String* name, |
4962 TransitionFlag flag); | 4940 TransitionFlag flag); |
4963 MUST_USE_RESULT MaybeObject* ShareDescriptor(Descriptor* descriptor); | |
4964 MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor, | 4941 MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor, |
4965 TransitionFlag flag); | 4942 TransitionFlag flag); |
4966 MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor, | 4943 MUST_USE_RESULT MaybeObject* CopyInsertDescriptor(Descriptor* descriptor, |
4967 TransitionFlag flag); | 4944 TransitionFlag flag); |
4968 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor(Descriptor* descriptor, | 4945 MUST_USE_RESULT MaybeObject* CopyReplaceDescriptor(Descriptor* descriptor, |
4969 int index, | 4946 int index, |
4970 TransitionFlag flag); | 4947 TransitionFlag flag); |
4971 MUST_USE_RESULT MaybeObject* CopyAsElementsKind(ElementsKind kind, | 4948 MUST_USE_RESULT MaybeObject* CopyAsElementsKind(ElementsKind kind, |
4972 TransitionFlag flag); | 4949 TransitionFlag flag); |
4973 | 4950 |
4974 MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode, | 4951 MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode, |
4975 NormalizedMapSharingMode sharing); | 4952 NormalizedMapSharingMode sharing); |
4976 | 4953 |
4977 inline void AppendDescriptor(Descriptor* desc, | 4954 inline void AppendDescriptor(Descriptor* desc, |
4978 const DescriptorArray::WhitenessWitness&); | 4955 const DescriptorArray::WhitenessWitness&); |
4979 | 4956 |
4980 // Returns a copy of the map, with all transitions dropped from the | 4957 // Returns a copy of the map, with all transitions dropped from the |
4981 // instance descriptors. | 4958 // instance descriptors. |
4982 MUST_USE_RESULT MaybeObject* Copy(); | 4959 MUST_USE_RESULT MaybeObject* Copy(); |
4983 | 4960 |
4984 // Returns the property index for name (only valid for FAST MODE). | 4961 // Returns the property index for name (only valid for FAST MODE). |
4985 int PropertyIndexFor(String* name); | 4962 int PropertyIndexFor(String* name); |
4986 | 4963 |
4987 // Returns the next free property index (only valid for FAST MODE). | 4964 // Returns the next free property index (only valid for FAST MODE). |
4988 int NextFreePropertyIndex(); | 4965 int NextFreePropertyIndex(); |
4989 | 4966 |
4990 // Returns the number of properties described in instance_descriptors | 4967 // Returns the number of properties described in instance_descriptors |
4991 // filtering out properties with the specified attributes. | 4968 // filtering out properties with the specified attributes. |
4992 int NumberOfDescribedProperties(DescriptorFlag which = OWN_DESCRIPTORS, | 4969 int NumberOfDescribedProperties(PropertyAttributes filter = NONE); |
4993 PropertyAttributes filter = NONE); | |
4994 | 4970 |
4995 // Casting. | 4971 // Casting. |
4996 static inline Map* cast(Object* obj); | 4972 static inline Map* cast(Object* obj); |
4997 | 4973 |
4998 // Locate an accessor in the instance descriptor. | 4974 // Locate an accessor in the instance descriptor. |
4999 AccessorDescriptor* FindAccessor(String* name); | 4975 AccessorDescriptor* FindAccessor(String* name); |
5000 | 4976 |
5001 // Code cache operations. | 4977 // Code cache operations. |
5002 | 4978 |
5003 // Clears the code cache. | 4979 // Clears the code cache. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5087 // and the values are the maps the are transitioned to. | 5063 // and the values are the maps the are transitioned to. |
5088 static const int kMaxCachedPrototypeTransitions = 256; | 5064 static const int kMaxCachedPrototypeTransitions = 256; |
5089 | 5065 |
5090 Map* GetPrototypeTransition(Object* prototype); | 5066 Map* GetPrototypeTransition(Object* prototype); |
5091 | 5067 |
5092 MUST_USE_RESULT MaybeObject* PutPrototypeTransition(Object* prototype, | 5068 MUST_USE_RESULT MaybeObject* PutPrototypeTransition(Object* prototype, |
5093 Map* map); | 5069 Map* map); |
5094 | 5070 |
5095 static const int kMaxPreAllocatedPropertyFields = 255; | 5071 static const int kMaxPreAllocatedPropertyFields = 255; |
5096 | 5072 |
5097 // Constant for denoting that the enum cache is not yet initialized. | 5073 // Constant for denoting that the Enum Cache field was not yet used. |
5098 static const int kInvalidEnumCache = EnumLengthBits::kMax; | 5074 static const int kInvalidEnumCache = EnumLengthBits::kMax; |
5099 | 5075 |
5100 // Layout description. | 5076 // Layout description. |
5101 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; | 5077 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; |
5102 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; | 5078 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; |
5103 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; | 5079 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; |
5104 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; | 5080 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; |
5105 // Storage for the transition array is overloaded to directly contain a back | 5081 // Storage for the transition array is overloaded to directly contain a back |
5106 // pointer if unused. When the map has transitions, the back pointer is | 5082 // pointer if unused. When the map has transitions, the back pointer is |
5107 // transferred to the transition array and accessed through an extra | 5083 // transferred to the transition array and accessed through an extra |
(...skipping 3868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8976 } else { | 8952 } else { |
8977 value &= ~(1 << bit_position); | 8953 value &= ~(1 << bit_position); |
8978 } | 8954 } |
8979 return value; | 8955 return value; |
8980 } | 8956 } |
8981 }; | 8957 }; |
8982 | 8958 |
8983 } } // namespace v8::internal | 8959 } } // namespace v8::internal |
8984 | 8960 |
8985 #endif // V8_OBJECTS_H_ | 8961 #endif // V8_OBJECTS_H_ |
OLD | NEW |