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

Side by Side Diff: src/transitions.h

Issue 722873004: Revert "TransitionArray now uses <is_data_property, name, attributes> tuple as a key, which allows … (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « src/objects-printer.cc ('k') | src/transitions.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_TRANSITIONS_H_ 5 #ifndef V8_TRANSITIONS_H_
6 #define V8_TRANSITIONS_H_ 6 #define V8_TRANSITIONS_H_
7 7
8 #include "src/checks.h" 8 #include "src/checks.h"
9 #include "src/elements-kind.h" 9 #include "src/elements-kind.h"
10 #include "src/heap/heap.h" 10 #include "src/heap/heap.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 Handle<Map> containing_map); 91 Handle<Map> containing_map);
92 92
93 // Return a transition array, using the array from the owning map if it 93 // Return a transition array, using the array from the owning map if it
94 // already has one (copying into a larger array if necessary), otherwise 94 // already has one (copying into a larger array if necessary), otherwise
95 // creating a new one according to flag. 95 // creating a new one according to flag.
96 // TODO(verwaest): This should not cause an existing transition to be 96 // TODO(verwaest): This should not cause an existing transition to be
97 // overwritten. 97 // overwritten.
98 static Handle<TransitionArray> Insert(Handle<Map> map, Handle<Name> name, 98 static Handle<TransitionArray> Insert(Handle<Map> map, Handle<Name> name,
99 Handle<Map> target, 99 Handle<Map> target,
100 SimpleTransitionFlag flag); 100 SimpleTransitionFlag flag);
101 // Search a transition for a given type, property name and attributes.
102 int Search(PropertyType type, Name* name, PropertyAttributes attributes,
103 int* out_insertion_index = NULL);
104 101
105 // Search a non-property transition (like elements kind, observe or frozen 102 // Search a transition for a given property name.
106 // transitions). 103 inline int Search(Name* name, int* out_insertion_index = NULL);
107 inline int SearchSpecial(Symbol* symbol, int* out_insertion_index = NULL) {
108 return SearchName(symbol, out_insertion_index);
109 }
110
111 static inline PropertyDetails GetTargetDetails(Name* name, Map* target);
112 104
113 // Allocates a TransitionArray. 105 // Allocates a TransitionArray.
114 static Handle<TransitionArray> Allocate(Isolate* isolate, 106 static Handle<TransitionArray> Allocate(Isolate* isolate,
115 int number_of_transitions, 107 int number_of_transitions,
116 int slack = 0); 108 int slack = 0);
117 109
118 bool IsSimpleTransition() { 110 bool IsSimpleTransition() {
119 return length() == kSimpleTransitionSize && 111 return length() == kSimpleTransitionSize &&
120 get(kSimpleTransitionTarget)->IsHeapObject() && 112 get(kSimpleTransitionTarget)->IsHeapObject() &&
121 // The IntrusivePrototypeTransitionIterator may have set the map of the 113 // The IntrusivePrototypeTransitionIterator may have set the map of the
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 void Print(); 160 void Print();
169 161
170 // Print all the transitions. 162 // Print all the transitions.
171 void PrintTransitions(std::ostream& os, bool print_header = true); // NOLINT 163 void PrintTransitions(std::ostream& os, bool print_header = true); // NOLINT
172 #endif 164 #endif
173 165
174 #ifdef DEBUG 166 #ifdef DEBUG
175 bool IsSortedNoDuplicates(int valid_entries = -1); 167 bool IsSortedNoDuplicates(int valid_entries = -1);
176 bool IsConsistentWithBackPointers(Map* current_map); 168 bool IsConsistentWithBackPointers(Map* current_map);
177 bool IsEqualTo(TransitionArray* other); 169 bool IsEqualTo(TransitionArray* other);
178
179 // Returns true for a non-property transitions like elements kind, observed
180 // or frozen transitions.
181 static inline bool IsSpecialTransition(Name* name);
182 #endif 170 #endif
183 171
184 // The maximum number of transitions we want in a transition array (should 172 // The maximum number of transitions we want in a transition array (should
185 // fit in a page). 173 // fit in a page).
186 static const int kMaxNumberOfTransitions = 1024 + 512; 174 static const int kMaxNumberOfTransitions = 1024 + 512;
187 175
188 // Returns the fixed array length required to hold number_of_transitions 176 // Returns the fixed array length required to hold number_of_transitions
189 // transitions. 177 // transitions.
190 static int LengthFor(int number_of_transitions) { 178 static int LengthFor(int number_of_transitions) {
191 return ToKeyIndex(number_of_transitions); 179 return ToKeyIndex(number_of_transitions);
(...skipping 15 matching lines...) Expand all
207 195
208 static Handle<TransitionArray> AllocateSimple( 196 static Handle<TransitionArray> AllocateSimple(
209 Isolate* isolate, Handle<Map> target); 197 Isolate* isolate, Handle<Map> target);
210 198
211 // Allocate a new transition array with a single entry. 199 // Allocate a new transition array with a single entry.
212 static Handle<TransitionArray> NewWith(Handle<Map> map, 200 static Handle<TransitionArray> NewWith(Handle<Map> map,
213 Handle<Name> name, 201 Handle<Name> name,
214 Handle<Map> target, 202 Handle<Map> target,
215 SimpleTransitionFlag flag); 203 SimpleTransitionFlag flag);
216 204
217 // Search a first transition for a given property name.
218 inline int SearchName(Name* name, int* out_insertion_index = NULL);
219 int SearchDetails(int transition, PropertyType type,
220 PropertyAttributes attributes, int* out_insertion_index);
221
222 // Compares two tuples <key, is_data_property, attributes>, returns -1 if
223 // tuple1 is "less" than tuple2, 0 if tuple1 equal to tuple2 and 1 otherwise.
224 static inline int CompareKeys(Name* key1, uint32_t hash1,
225 bool is_data_property1,
226 PropertyAttributes attributes1, Name* key2,
227 uint32_t hash2, bool is_data_property2,
228 PropertyAttributes attributes2);
229
230 // Compares keys, returns -1 if key1 is "less" than key2,
231 // 0 if key1 equal to key2 and 1 otherwise.
232 static inline int CompareNames(Name* key1, uint32_t hash1, Name* key2,
233 uint32_t hash2);
234
235 // Compares two details, returns -1 if details1 is "less" than details2,
236 // 0 if details1 equal to details2 and 1 otherwise.
237 static inline int CompareDetails(bool is_data_property1,
238 PropertyAttributes attributes1,
239 bool is_data_property2,
240 PropertyAttributes attributes2);
241
242 inline void NoIncrementalWriteBarrierSet(int transition_number, 205 inline void NoIncrementalWriteBarrierSet(int transition_number,
243 Name* key, 206 Name* key,
244 Map* target); 207 Map* target);
245 208
246 // Copy a single transition from the origin array. 209 // Copy a single transition from the origin array.
247 inline void NoIncrementalWriteBarrierCopyFrom(TransitionArray* origin, 210 inline void NoIncrementalWriteBarrierCopyFrom(TransitionArray* origin,
248 int origin_transition, 211 int origin_transition,
249 int target_transition); 212 int target_transition);
250 213
251 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); 214 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray);
252 }; 215 };
253 216
254 217
255 } } // namespace v8::internal 218 } } // namespace v8::internal
256 219
257 #endif // V8_TRANSITIONS_H_ 220 #endif // V8_TRANSITIONS_H_
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | src/transitions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698