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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/disasm.h" | 7 #include "src/disasm.h" |
8 #include "src/disassembler.h" | 8 #include "src/disassembler.h" |
9 #include "src/heap/objects-visiting.h" | 9 #include "src/heap/objects-visiting.h" |
10 #include "src/jsregexp.h" | 10 #include "src/jsregexp.h" |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 } | 1157 } |
1158 | 1158 |
1159 | 1159 |
1160 bool DescriptorArray::IsSortedNoDuplicates(int valid_entries) { | 1160 bool DescriptorArray::IsSortedNoDuplicates(int valid_entries) { |
1161 if (valid_entries == -1) valid_entries = number_of_descriptors(); | 1161 if (valid_entries == -1) valid_entries = number_of_descriptors(); |
1162 Name* current_key = NULL; | 1162 Name* current_key = NULL; |
1163 uint32_t current = 0; | 1163 uint32_t current = 0; |
1164 for (int i = 0; i < number_of_descriptors(); i++) { | 1164 for (int i = 0; i < number_of_descriptors(); i++) { |
1165 Name* key = GetSortedKey(i); | 1165 Name* key = GetSortedKey(i); |
1166 if (key == current_key) { | 1166 if (key == current_key) { |
1167 OFStream os(stdout); | 1167 Print(); |
1168 PrintDescriptors(os); | |
1169 return false; | 1168 return false; |
1170 } | 1169 } |
1171 current_key = key; | 1170 current_key = key; |
1172 uint32_t hash = GetSortedKey(i)->Hash(); | 1171 uint32_t hash = GetSortedKey(i)->Hash(); |
1173 if (hash < current) { | 1172 if (hash < current) { |
1174 OFStream os(stdout); | 1173 Print(); |
1175 PrintDescriptors(os); | |
1176 return false; | 1174 return false; |
1177 } | 1175 } |
1178 current = hash; | 1176 current = hash; |
1179 } | 1177 } |
1180 return true; | 1178 return true; |
1181 } | 1179 } |
1182 | 1180 |
1183 | 1181 |
1184 bool TransitionArray::IsSortedNoDuplicates(int valid_entries) { | 1182 bool TransitionArray::IsSortedNoDuplicates(int valid_entries) { |
1185 DCHECK(valid_entries == -1); | 1183 DCHECK(valid_entries == -1); |
1186 Name* current_key = NULL; | 1184 Name* prev_key = NULL; |
1187 uint32_t current = 0; | 1185 bool prev_is_data_property = false; |
| 1186 PropertyAttributes prev_attributes = NONE; |
| 1187 uint32_t prev_hash = 0; |
1188 for (int i = 0; i < number_of_transitions(); i++) { | 1188 for (int i = 0; i < number_of_transitions(); i++) { |
1189 Name* key = GetSortedKey(i); | 1189 Name* key = GetSortedKey(i); |
1190 if (key == current_key) { | 1190 uint32_t hash = key->Hash(); |
1191 OFStream os(stdout); | 1191 bool is_data_property = false; |
1192 PrintTransitions(os); | 1192 PropertyAttributes attributes = NONE; |
| 1193 if (!IsSpecialTransition(key)) { |
| 1194 Map* target = GetTarget(i); |
| 1195 PropertyDetails details = GetTargetDetails(key, target); |
| 1196 is_data_property = details.type() == FIELD || details.type() == CONSTANT; |
| 1197 attributes = details.attributes(); |
| 1198 } else { |
| 1199 // Duplicate entries are not allowed for non-property transitions. |
| 1200 CHECK_NE(prev_key, key); |
| 1201 } |
| 1202 |
| 1203 int cmp = |
| 1204 CompareKeys(prev_key, prev_hash, prev_is_data_property, prev_attributes, |
| 1205 key, hash, is_data_property, attributes); |
| 1206 if (cmp >= 0) { |
| 1207 Print(); |
1193 return false; | 1208 return false; |
1194 } | 1209 } |
1195 current_key = key; | 1210 prev_key = key; |
1196 uint32_t hash = GetSortedKey(i)->Hash(); | 1211 prev_hash = hash; |
1197 if (hash < current) { | 1212 prev_attributes = attributes; |
1198 OFStream os(stdout); | 1213 prev_is_data_property = is_data_property; |
1199 PrintTransitions(os); | |
1200 return false; | |
1201 } | |
1202 current = hash; | |
1203 } | 1214 } |
1204 return true; | 1215 return true; |
1205 } | 1216 } |
1206 | 1217 |
1207 | 1218 |
1208 static bool CheckOneBackPointer(Map* current_map, Object* target) { | 1219 static bool CheckOneBackPointer(Map* current_map, Object* target) { |
1209 return !target->IsMap() || Map::cast(target)->GetBackPointer() == current_map; | 1220 return !target->IsMap() || Map::cast(target)->GetBackPointer() == current_map; |
1210 } | 1221 } |
1211 | 1222 |
1212 | 1223 |
(...skipping 19 matching lines...) Expand all Loading... |
1232 while (map != heap->roots_array_start()[i++]) { | 1243 while (map != heap->roots_array_start()[i++]) { |
1233 CHECK_LT(i, Heap::kStrongRootListLength); | 1244 CHECK_LT(i, Heap::kStrongRootListLength); |
1234 } | 1245 } |
1235 } | 1246 } |
1236 } | 1247 } |
1237 | 1248 |
1238 | 1249 |
1239 #endif // DEBUG | 1250 #endif // DEBUG |
1240 | 1251 |
1241 } } // namespace v8::internal | 1252 } } // namespace v8::internal |
OLD | NEW |