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

Side by Side Diff: src/transitions.h

Issue 11035053: Rollback trunk to bleeding_edge revision 12525 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 2 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/spaces.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 // 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 inline FixedArray* GetPrototypeTransitions(); 84 inline FixedArray* GetPrototypeTransitions();
85 inline void SetPrototypeTransitions( 85 inline void SetPrototypeTransitions(
86 FixedArray* prototype_transitions, 86 FixedArray* prototype_transitions,
87 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 87 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
88 inline Object** GetPrototypeTransitionsSlot(); 88 inline Object** GetPrototypeTransitionsSlot();
89 inline bool HasPrototypeTransitions(); 89 inline bool HasPrototypeTransitions();
90 inline HeapObject* UncheckedPrototypeTransitions(); 90 inline HeapObject* UncheckedPrototypeTransitions();
91 91
92 // Returns the number of transitions in the array. 92 // Returns the number of transitions in the array.
93 int number_of_transitions() { 93 int number_of_transitions() {
94 if (IsSimpleTransition()) return 1; 94 ASSERT(length() >= kFirstIndex);
95 int len = length(); 95 int len = length();
96 return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kTransitionSize; 96 return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kTransitionSize;
97 } 97 }
98 98
99 inline int number_of_entries() { return number_of_transitions(); } 99 inline int number_of_entries() { return number_of_transitions(); }
100 100
101 // Allocate a new transition array with a single entry. 101 // Allocate a new transition array with a single entry.
102 static MUST_USE_RESULT MaybeObject* NewWith( 102 static MUST_USE_RESULT MaybeObject* NewWith(
103 SimpleTransitionFlag flag, 103 String* name,
104 String* key,
105 Map* target, 104 Map* target,
106 JSGlobalPropertyCell* descriptor_pointer, 105 JSGlobalPropertyCell* descriptor_pointer,
107 Object* back_pointer); 106 Object* back_pointer);
108 107
109 static MUST_USE_RESULT MaybeObject* AllocateDescriptorsHolder(
110 JSGlobalPropertyCell* descriptor_pointer);
111
112 MUST_USE_RESULT MaybeObject* ExtendToFullTransitionArray();
113
114 // Copy the transition array, inserting a new transition. 108 // Copy the transition array, inserting a new transition.
115 // TODO(verwaest): This should not cause an existing transition to be 109 // TODO(verwaest): This should not cause an existing transition to be
116 // overwritten. 110 // overwritten.
117 MUST_USE_RESULT MaybeObject* CopyInsert(String* name, Map* target); 111 MUST_USE_RESULT MaybeObject* CopyInsert(String* name, Map* target);
118 112
119 // Copy a single transition from the origin array. 113 // Copy a single transition from the origin array.
120 inline void NoIncrementalWriteBarrierCopyFrom(TransitionArray* origin, 114 inline void NoIncrementalWriteBarrierCopyFrom(TransitionArray* origin,
121 int origin_transition, 115 int origin_transition,
122 int target_transition); 116 int target_transition);
123 117
124 // Search a transition for a given property name. 118 // Search a transition for a given property name.
125 inline int Search(String* name); 119 inline int Search(String* name);
126 120
127 // Allocates a TransitionArray. 121 // Allocates a TransitionArray.
128 MUST_USE_RESULT static MaybeObject* Allocate( 122 MUST_USE_RESULT static MaybeObject* Allocate(
129 int number_of_transitions, 123 int number_of_transitions,
130 JSGlobalPropertyCell* descriptors_cell); 124 JSGlobalPropertyCell* descriptors_cell);
131 125
132 bool IsDescriptorsHolder() { return length() == kDescriptorsHolderSize; }
133 bool IsSimpleTransition() { return length() == kSimpleTransitionSize; }
134 bool IsFullTransitionArray() { return length() >= kFirstIndex; }
135
136 // Casting. 126 // Casting.
137 static inline TransitionArray* cast(Object* obj); 127 static inline TransitionArray* cast(Object* obj);
138 128
139 // Constant for denoting key was not found. 129 // Constant for denoting key was not found.
140 static const int kNotFound = -1; 130 static const int kNotFound = -1;
141 131
142 static const int kDescriptorsPointerIndex = 0; 132 static const int kDescriptorsPointerIndex = 0;
143 static const int kBackPointerStorageIndex = 1; 133 static const int kBackPointerStorageIndex = 1;
144 static const int kDescriptorsHolderSize = 2;
145
146 // Layout for full transition arrays.
147 static const int kElementsTransitionIndex = 2; 134 static const int kElementsTransitionIndex = 2;
148 static const int kPrototypeTransitionsIndex = 3; 135 static const int kPrototypeTransitionsIndex = 3;
149 static const int kFirstIndex = 4; 136 static const int kFirstIndex = 4;
150 137
151 // Layout for simple transition arrays. 138 // Layout transition array header.
152 static const int kSimpleTransitionTarget = 2;
153 static const int kSimpleTransitionSize = 3;
154 static const int kSimpleTransitionIndex = 0;
155 STATIC_ASSERT(kSimpleTransitionIndex != kNotFound);
156
157 static const int kDescriptorsPointerOffset = FixedArray::kHeaderSize; 139 static const int kDescriptorsPointerOffset = FixedArray::kHeaderSize;
158 static const int kBackPointerStorageOffset = kDescriptorsPointerOffset + 140 static const int kBackPointerStorageOffset = kDescriptorsPointerOffset +
159 kPointerSize; 141 kPointerSize;
160
161 // Layout for the full transition array header.
162 static const int kElementsTransitionOffset = kBackPointerStorageOffset + 142 static const int kElementsTransitionOffset = kBackPointerStorageOffset +
163 kPointerSize; 143 kPointerSize;
164 static const int kPrototypeTransitionsOffset = kElementsTransitionOffset + 144 static const int kPrototypeTransitionsOffset = kElementsTransitionOffset +
165 kPointerSize; 145 kPointerSize;
166 146
167 // Layout of map transition entries in full transition arrays. 147 // Layout of map transition.
168 static const int kTransitionKey = 0; 148 static const int kTransitionKey = 0;
169 static const int kTransitionTarget = 1; 149 static const int kTransitionTarget = 1;
170 static const int kTransitionSize = 2; 150 static const int kTransitionSize = 2;
171 151
172 #ifdef OBJECT_PRINT 152 #ifdef OBJECT_PRINT
173 // Print all the transitions. 153 // Print all the transitions.
174 inline void PrintTransitions() { 154 inline void PrintTransitions() {
175 PrintTransitions(stdout); 155 PrintTransitions(stdout);
176 } 156 }
177 void PrintTransitions(FILE* out); 157 void PrintTransitions(FILE* out);
(...skipping 27 matching lines...) Expand all
205 String* key, 185 String* key,
206 Map* target); 186 Map* target);
207 187
208 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray); 188 DISALLOW_IMPLICIT_CONSTRUCTORS(TransitionArray);
209 }; 189 };
210 190
211 191
212 } } // namespace v8::internal 192 } } // namespace v8::internal
213 193
214 #endif // V8_TRANSITIONS_H_ 194 #endif // V8_TRANSITIONS_H_
OLDNEW
« no previous file with comments | « src/spaces.cc ('k') | src/transitions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698