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

Side by Side Diff: src/transitions.h

Issue 1194673002: Revert of Replace ad-hoc weakness in transition array with WeakCell. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « src/heap/objects-visiting-inl.h ('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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 WeakCell::cast(raw_transition)->cleared() || 64 WeakCell::cast(raw_transition)->cleared() ||
65 WeakCell::cast(raw_transition)->value()->IsMap()); 65 WeakCell::cast(raw_transition)->value()->IsMap());
66 return raw_transition->IsWeakCell() && 66 return raw_transition->IsWeakCell() &&
67 !WeakCell::cast(raw_transition)->cleared(); 67 !WeakCell::cast(raw_transition)->cleared();
68 } 68 }
69 static inline Map* GetSimpleTransition(Object* raw_transition) { 69 static inline Map* GetSimpleTransition(Object* raw_transition) {
70 DCHECK(IsSimpleTransition(raw_transition)); 70 DCHECK(IsSimpleTransition(raw_transition));
71 DCHECK(raw_transition->IsWeakCell()); 71 DCHECK(raw_transition->IsWeakCell());
72 return Map::cast(WeakCell::cast(raw_transition)->value()); 72 return Map::cast(WeakCell::cast(raw_transition)->value());
73 } 73 }
74 static inline WeakCell* GetSimpleTransitionCell(Object* raw_transition) {
75 DCHECK(IsSimpleTransition(raw_transition));
76 DCHECK(raw_transition->IsWeakCell());
77 return WeakCell::cast(raw_transition);
78 }
79 static inline bool IsFullTransitionArray(Object* raw_transitions) { 74 static inline bool IsFullTransitionArray(Object* raw_transitions) {
80 return raw_transitions->IsTransitionArray(); 75 return raw_transitions->IsTransitionArray();
81 } 76 }
82 77
83 // The size of transition arrays are limited so they do not end up in large 78 // The size of transition arrays are limited so they do not end up in large
84 // object space. Otherwise ClearNonLiveReferences would leak memory while 79 // object space. Otherwise ClearNonLiveReferences would leak memory while
85 // applying in-place right trimming. 80 // applying in-place right trimming.
86 static bool CanHaveMoreTransitions(Handle<Map> map); 81 static bool CanHaveMoreTransitions(Handle<Map> map);
87 82
88 // ===== PROTOTYPE TRANSITIONS ===== 83 // ===== PROTOTYPE TRANSITIONS =====
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 TraverseTransitionTreeInternal(map, callback, data); 128 TraverseTransitionTreeInternal(map, callback, data);
134 } 129 }
135 130
136 // ===== LOW-LEVEL ACCESSORS ===== 131 // ===== LOW-LEVEL ACCESSORS =====
137 132
138 // Accessors for fetching instance transition at transition number. 133 // Accessors for fetching instance transition at transition number.
139 static inline Name* GetKey(Object* raw_transitions, int transition_number); 134 static inline Name* GetKey(Object* raw_transitions, int transition_number);
140 inline Name* GetKey(int transition_number); 135 inline Name* GetKey(int transition_number);
141 inline void SetKey(int transition_number, Name* value); 136 inline void SetKey(int transition_number, Name* value);
142 inline Object** GetKeySlot(int transition_number); 137 inline Object** GetKeySlot(int transition_number);
143 inline Object** GetTargetSlot(int transition_number);
144 int GetSortedKeyIndex(int transition_number) { return transition_number; } 138 int GetSortedKeyIndex(int transition_number) { return transition_number; }
145 139
146 Name* GetSortedKey(int transition_number) { 140 Name* GetSortedKey(int transition_number) {
147 return GetKey(transition_number); 141 return GetKey(transition_number);
148 } 142 }
149 143
150 static inline Map* GetTarget(Object* raw_transitions, int transition_number); 144 static inline Map* GetTarget(Object* raw_transitions, int transition_number);
151 inline Map* GetTarget(int transition_number); 145 inline Map* GetTarget(int transition_number);
152 146 inline void SetTarget(int transition_number, Map* target);
153 inline WeakCell* GetTargetCell(int transition_number);
154 inline void SetTargetCell(int transition_number, WeakCell* target);
155 147
156 static inline PropertyDetails GetTargetDetails(Name* name, Map* target); 148 static inline PropertyDetails GetTargetDetails(Name* name, Map* target);
157 149
158 // Returns the number of transitions in the array. 150 // Returns the number of transitions in the array.
159 static int NumberOfTransitions(Object* raw_transitions); 151 static int NumberOfTransitions(Object* raw_transitions);
160 // Required for templatized Search interface. 152 // Required for templatized Search interface.
161 inline int number_of_entries() { return number_of_transitions(); } 153 inline int number_of_entries() { return number_of_transitions(); }
162 154
163 inline void SetNumberOfTransitions(int number_of_transitions); 155 inline void SetNumberOfTransitions(int number_of_transitions);
164 156
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 static inline int CompareNames(Name* key1, uint32_t hash1, Name* key2, 276 static inline int CompareNames(Name* key1, uint32_t hash1, Name* key2,
285 uint32_t hash2); 277 uint32_t hash2);
286 278
287 // Compares two details, returns -1 if details1 is "less" than details2, 279 // Compares two details, returns -1 if details1 is "less" than details2,
288 // 0 if details1 equal to details2 and 1 otherwise. 280 // 0 if details1 equal to details2 and 1 otherwise.
289 static inline int CompareDetails(PropertyKind kind1, 281 static inline int CompareDetails(PropertyKind kind1,
290 PropertyAttributes attributes1, 282 PropertyAttributes attributes1,
291 PropertyKind kind2, 283 PropertyKind kind2,
292 PropertyAttributes attributes2); 284 PropertyAttributes attributes2);
293 285
294 inline void Set(int transition_number, Name* key, WeakCell* target_cell); 286 inline void NoIncrementalWriteBarrierSet(int transition_number,
287 Name* key,
288 Map* target);
295 289
296 // Copy a single transition from the origin array. 290 // Copy a single transition from the origin array.
297 inline void CopyFrom(TransitionArray* origin, int origin_transition, 291 inline void NoIncrementalWriteBarrierCopyFrom(TransitionArray* origin,
298 int target_transition); 292 int origin_transition,
293 int target_transition);
299 294
300 #ifdef DEBUG 295 #ifdef DEBUG
301 static void CheckNewTransitionsAreConsistent(Handle<Map> map, 296 static void CheckNewTransitionsAreConsistent(Handle<Map> map,
302 TransitionArray* old_transitions, 297 TransitionArray* old_transitions,
303 Object* transitions); 298 Object* transitions);
304 #endif 299 #endif
305 300
306 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); 301 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray);
307 }; 302 };
308 303
309 304
310 } } // namespace v8::internal 305 } } // namespace v8::internal
311 306
312 #endif // V8_TRANSITIONS_H_ 307 #endif // V8_TRANSITIONS_H_
OLDNEW
« no previous file with comments | « src/heap/objects-visiting-inl.h ('k') | src/transitions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698