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