Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: src/objects.h

Issue 10808011: Let DescriptorArray::Append insert at proper position, avoiding need for resorting. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 }; 163 };
164 164
165 165
166 // Indicates whether a get method should implicitly create the object looked up. 166 // Indicates whether a get method should implicitly create the object looked up.
167 enum CreationFlag { 167 enum CreationFlag {
168 ALLOW_CREATION, 168 ALLOW_CREATION,
169 OMIT_CREATION 169 OMIT_CREATION
170 }; 170 };
171 171
172 172
173 // Indicates whether the search function should expect a sorted or an unsorted
174 // array as input.
175 enum SearchMode {
176 EXPECT_SORTED,
177 EXPECT_UNSORTED
178 };
179
180
181 // Indicates whether transitions can be added to a source map or not. 173 // Indicates whether transitions can be added to a source map or not.
182 enum TransitionFlag { 174 enum TransitionFlag {
183 INSERT_TRANSITION, 175 INSERT_TRANSITION,
184 OMIT_TRANSITION 176 OMIT_TRANSITION
185 }; 177 };
186 178
187 179
188 // Instance size sentinel for objects of variable size. 180 // Instance size sentinel for objects of variable size.
189 const int kVariableSizeSentinel = 0; 181 const int kVariableSizeSentinel = 0;
190 182
(...skipping 2386 matching lines...) Expand 10 before | Expand all | Expand 10 after
2577 enum SharedMode { 2569 enum SharedMode {
2578 MAY_BE_SHARED, 2570 MAY_BE_SHARED,
2579 CANNOT_BE_SHARED 2571 CANNOT_BE_SHARED
2580 }; 2572 };
2581 2573
2582 // Return a copy of the array with all transitions and null descriptors 2574 // Return a copy of the array with all transitions and null descriptors
2583 // removed. Return a Failure object in case of an allocation failure. 2575 // removed. Return a Failure object in case of an allocation failure.
2584 MUST_USE_RESULT MaybeObject* Copy(SharedMode shared_mode); 2576 MUST_USE_RESULT MaybeObject* Copy(SharedMode shared_mode);
2585 2577
2586 // Sort the instance descriptors by the hash codes of their keys. 2578 // Sort the instance descriptors by the hash codes of their keys.
2587 // Does not check for duplicates.
2588 void SortUnchecked(const WhitenessWitness&);
2589
2590 // Sort the instance descriptors by the hash codes of their keys.
2591 // Checks the result for duplicates.
2592 void Sort(const WhitenessWitness&); 2579 void Sort(const WhitenessWitness&);
2593 2580
2594 // Search the instance descriptors for given name. 2581 // Search the instance descriptors for given name.
2595 INLINE(int Search(String* name)); 2582 INLINE(int Search(String* name));
2596 2583
2597 // As the above, but uses DescriptorLookupCache and updates it when 2584 // As the above, but uses DescriptorLookupCache and updates it when
2598 // necessary. 2585 // necessary.
2599 INLINE(int SearchWithCache(String* name)); 2586 INLINE(int SearchWithCache(String* name));
2600 2587
2601 // Tells whether the name is present int the array. 2588 // Tells whether the name is present int the array.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2707 2694
2708 // Swap first and second descriptor. 2695 // Swap first and second descriptor.
2709 inline void NoIncrementalWriteBarrierSwapDescriptors( 2696 inline void NoIncrementalWriteBarrierSwapDescriptors(
2710 int first, int second); 2697 int first, int second);
2711 2698
2712 DISALLOW_IMPLICIT_CONSTRUCTORS(DescriptorArray); 2699 DISALLOW_IMPLICIT_CONSTRUCTORS(DescriptorArray);
2713 }; 2700 };
2714 2701
2715 2702
2716 template<typename T> 2703 template<typename T>
2717 inline int LinearSearch(T* array, SearchMode mode, String* name, int len); 2704 inline int LinearSearch(T* array, String* name, int len);
2718 2705
2719 2706
2720 template<typename T> 2707 template<typename T>
2721 inline int Search(T* array, String* name); 2708 inline int Search(T* array, String* name);
2722 2709
2723 2710
2724 // HashTable is a subclass of FixedArray that implements a hash table 2711 // HashTable is a subclass of FixedArray that implements a hash table
2725 // that uses open addressing and quadratic probing. 2712 // that uses open addressing and quadratic probing.
2726 // 2713 //
2727 // In order for the quadratic probing to work, elements that have not 2714 // In order for the quadratic probing to work, elements that have not
(...skipping 2120 matching lines...) Expand 10 before | Expand all | Expand 10 after
4848 // [prototype]: implicit prototype object. 4835 // [prototype]: implicit prototype object.
4849 DECL_ACCESSORS(prototype, Object) 4836 DECL_ACCESSORS(prototype, Object)
4850 4837
4851 // [constructor]: points back to the function responsible for this map. 4838 // [constructor]: points back to the function responsible for this map.
4852 DECL_ACCESSORS(constructor, Object) 4839 DECL_ACCESSORS(constructor, Object)
4853 4840
4854 inline JSFunction* unchecked_constructor(); 4841 inline JSFunction* unchecked_constructor();
4855 4842
4856 // [instance descriptors]: describes the object. 4843 // [instance descriptors]: describes the object.
4857 DECL_ACCESSORS(instance_descriptors, DescriptorArray) 4844 DECL_ACCESSORS(instance_descriptors, DescriptorArray)
4845 inline void InitializeDescriptors(DescriptorArray* descriptors);
4858 4846
4859 // Should only be called to clear a descriptor array that was only used to 4847 // Should only be called to clear a descriptor array that was only used to
4860 // store transitions and does not contain any live transitions anymore. 4848 // store transitions and does not contain any live transitions anymore.
4861 inline void ClearDescriptorArray(Heap* heap, WriteBarrierMode mode); 4849 inline void ClearDescriptorArray(Heap* heap, WriteBarrierMode mode);
4862 4850
4863 // [stub cache]: contains stubs compiled for this map. 4851 // [stub cache]: contains stubs compiled for this map.
4864 DECL_ACCESSORS(code_cache, Object) 4852 DECL_ACCESSORS(code_cache, Object)
4865 4853
4866 // [back pointer]: points back to the parent map from which a transition 4854 // [back pointer]: points back to the parent map from which a transition
4867 // leads to this map. The field overlaps with prototype transitions and the 4855 // leads to this map. The field overlaps with prototype transitions and the
(...skipping 4028 matching lines...) Expand 10 before | Expand all | Expand 10 after
8896 } else { 8884 } else {
8897 value &= ~(1 << bit_position); 8885 value &= ~(1 << bit_position);
8898 } 8886 }
8899 return value; 8887 return value;
8900 } 8888 }
8901 }; 8889 };
8902 8890
8903 } } // namespace v8::internal 8891 } } // namespace v8::internal
8904 8892
8905 #endif // V8_OBJECTS_H_ 8893 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698