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

Side by Side Diff: src/transitions.h

Issue 1169733002: Revert of Replace ad-hoc weakness in prototype transitions 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 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 void PutPrototypeTransition(Handle<Map> map, Handle<Object> prototype, 95 static Handle<Map> PutPrototypeTransition(Handle<Map> map,
96 Handle<Map> target_map); 96 Handle<Object> prototype,
97 Handle<Map> target_map);
97 98
98 static Handle<Map> GetPrototypeTransition(Handle<Map> map, 99 static Handle<Map> GetPrototypeTransition(Handle<Map> map,
99 Handle<Object> prototype); 100 Handle<Object> prototype);
100 101
101 static FixedArray* GetPrototypeTransitions(Map* map); 102 static FixedArray* GetPrototypeTransitions(Map* map);
102 103
103 static int NumberOfPrototypeTransitions(FixedArray* proto_transitions) { 104 static int NumberOfPrototypeTransitions(FixedArray* proto_transitions) {
104 if (proto_transitions->length() == 0) return 0; 105 if (proto_transitions->length() == 0) return 0;
105 Object* raw = proto_transitions->get(kProtoTransitionNumberOfEntriesOffset); 106 Object* raw = proto_transitions->get(kProtoTransitionNumberOfEntriesOffset);
106 return Smi::cast(raw)->value(); 107 return Smi::cast(raw)->value();
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 Object* transitions); 299 Object* transitions);
299 #endif 300 #endif
300 301
301 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); 302 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray);
302 }; 303 };
303 304
304 305
305 } } // namespace v8::internal 306 } } // namespace v8::internal
306 307
307 #endif // V8_TRANSITIONS_H_ 308 #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