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

Side by Side Diff: src/transitions.h

Issue 1163073002: Replace ad-hoc weakness in prototype transitions with WeakCell. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix crash 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // need a new map for the object (the prototype is stored in the map). In 85 // need a new map for the object (the prototype is stored in the map). In
86 // order not to multiply maps unnecessarily we store these as transitions in 86 // order not to multiply maps unnecessarily we store these as transitions in
87 // the original map. That way we can transition to the same map if the same 87 // the original map. That way we can transition to the same map if the same
88 // prototype is set, rather than creating a new map every time. The 88 // prototype is set, rather than creating a new map every time. The
89 // transitions are in the form of a map where the keys are prototype objects 89 // transitions are in the form of a map where the keys are prototype objects
90 // and the values are the maps they transition to. 90 // and the values are the maps they transition to.
91 // Cache format: 91 // Cache format:
92 // 0: finger - index of the first free cell in the cache 92 // 0: finger - index of the first free cell in the cache
93 // 1 + i: target map 93 // 1 + i: target map
94 static const int kMaxCachedPrototypeTransitions = 256; 94 static const int kMaxCachedPrototypeTransitions = 256;
95 static Handle<Map> PutPrototypeTransition(Handle<Map> map, 95 static void PutPrototypeTransition(Handle<Map> map, Handle<Object> prototype,
96 Handle<Object> prototype, 96 Handle<Map> target_map);
97 Handle<Map> target_map);
98 97
99 static Handle<Map> GetPrototypeTransition(Handle<Map> map, 98 static Handle<Map> GetPrototypeTransition(Handle<Map> map,
100 Handle<Object> prototype); 99 Handle<Object> prototype);
101 100
102 static FixedArray* GetPrototypeTransitions(Map* map); 101 static FixedArray* GetPrototypeTransitions(Map* map);
103 102
104 static int NumberOfPrototypeTransitions(FixedArray* proto_transitions) { 103 static int NumberOfPrototypeTransitions(FixedArray* proto_transitions) {
105 if (proto_transitions->length() == 0) return 0; 104 if (proto_transitions->length() == 0) return 0;
106 Object* raw = proto_transitions->get(kProtoTransitionNumberOfEntriesOffset); 105 Object* raw = proto_transitions->get(kProtoTransitionNumberOfEntriesOffset);
107 return Smi::cast(raw)->value(); 106 return Smi::cast(raw)->value();
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 Object* transitions); 298 Object* transitions);
300 #endif 299 #endif
301 300
302 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); 301 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray);
303 }; 302 };
304 303
305 304
306 } } // namespace v8::internal 305 } } // namespace v8::internal
307 306
308 #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