OLD | NEW |
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_INL_H_ | 5 #ifndef V8_TRANSITIONS_INL_H_ |
6 #define V8_TRANSITIONS_INL_H_ | 6 #define V8_TRANSITIONS_INL_H_ |
7 | 7 |
8 #include "src/transitions.h" | 8 #include "src/transitions.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 if (!name->IsSymbol()) return false; | 158 if (!name->IsSymbol()) return false; |
159 Heap* heap = name->GetHeap(); | 159 Heap* heap = name->GetHeap(); |
160 return name == heap->nonextensible_symbol() || | 160 return name == heap->nonextensible_symbol() || |
161 name == heap->sealed_symbol() || name == heap->frozen_symbol() || | 161 name == heap->sealed_symbol() || name == heap->frozen_symbol() || |
162 name == heap->elements_transition_symbol() || | 162 name == heap->elements_transition_symbol() || |
163 name == heap->observed_symbol(); | 163 name == heap->observed_symbol(); |
164 } | 164 } |
165 #endif | 165 #endif |
166 | 166 |
167 | 167 |
168 int TransitionArray::CompareKeys(Name* key1, uint32_t hash1, | 168 int TransitionArray::CompareKeys(Name* key1, uint32_t hash1, PropertyKind kind1, |
169 bool is_data_property1, | |
170 PropertyAttributes attributes1, Name* key2, | 169 PropertyAttributes attributes1, Name* key2, |
171 uint32_t hash2, bool is_data_property2, | 170 uint32_t hash2, PropertyKind kind2, |
172 PropertyAttributes attributes2) { | 171 PropertyAttributes attributes2) { |
173 int cmp = CompareNames(key1, hash1, key2, hash2); | 172 int cmp = CompareNames(key1, hash1, key2, hash2); |
174 if (cmp != 0) return cmp; | 173 if (cmp != 0) return cmp; |
175 | 174 |
176 return CompareDetails(is_data_property1, attributes1, is_data_property2, | 175 return CompareDetails(kind1, attributes1, kind2, attributes2); |
177 attributes2); | |
178 } | 176 } |
179 | 177 |
180 | 178 |
181 int TransitionArray::CompareNames(Name* key1, uint32_t hash1, Name* key2, | 179 int TransitionArray::CompareNames(Name* key1, uint32_t hash1, Name* key2, |
182 uint32_t hash2) { | 180 uint32_t hash2) { |
183 if (key1 != key2) { | 181 if (key1 != key2) { |
184 // In case of hash collisions key1 is always "less" than key2. | 182 // In case of hash collisions key1 is always "less" than key2. |
185 return hash1 <= hash2 ? -1 : 1; | 183 return hash1 <= hash2 ? -1 : 1; |
186 } | 184 } |
187 | 185 |
188 return 0; | 186 return 0; |
189 } | 187 } |
190 | 188 |
191 | 189 |
192 int TransitionArray::CompareDetails(bool is_data_property1, | 190 int TransitionArray::CompareDetails(PropertyKind kind1, |
193 PropertyAttributes attributes1, | 191 PropertyAttributes attributes1, |
194 bool is_data_property2, | 192 PropertyKind kind2, |
195 PropertyAttributes attributes2) { | 193 PropertyAttributes attributes2) { |
196 if (is_data_property1 != is_data_property2) { | 194 if (kind1 != kind2) { |
197 return static_cast<int>(is_data_property1) < | 195 return static_cast<int>(kind1) < static_cast<int>(kind2) ? -1 : 1; |
198 static_cast<int>(is_data_property2) | |
199 ? -1 | |
200 : 1; | |
201 } | 196 } |
202 | 197 |
203 if (attributes1 != attributes2) { | 198 if (attributes1 != attributes2) { |
204 return static_cast<int>(attributes1) < static_cast<int>(attributes2) ? -1 | 199 return static_cast<int>(attributes1) < static_cast<int>(attributes2) ? -1 |
205 : 1; | 200 : 1; |
206 } | 201 } |
207 | 202 |
208 return 0; | 203 return 0; |
209 } | 204 } |
210 | 205 |
(...skipping 28 matching lines...) Expand all Loading... |
239 | 234 |
240 | 235 |
241 #undef FIELD_ADDR | 236 #undef FIELD_ADDR |
242 #undef WRITE_FIELD | 237 #undef WRITE_FIELD |
243 #undef CONDITIONAL_WRITE_BARRIER | 238 #undef CONDITIONAL_WRITE_BARRIER |
244 | 239 |
245 | 240 |
246 } } // namespace v8::internal | 241 } } // namespace v8::internal |
247 | 242 |
248 #endif // V8_TRANSITIONS_INL_H_ | 243 #endif // V8_TRANSITIONS_INL_H_ |
OLD | NEW |