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 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 } | 1167 } |
1168 | 1168 |
1169 | 1169 |
1170 bool DescriptorArray::IsSortedNoDuplicates(int valid_entries) { | 1170 bool DescriptorArray::IsSortedNoDuplicates(int valid_entries) { |
1171 if (valid_entries == -1) valid_entries = number_of_descriptors(); | 1171 if (valid_entries == -1) valid_entries = number_of_descriptors(); |
1172 Name* current_key = NULL; | 1172 Name* current_key = NULL; |
1173 uint32_t current = 0; | 1173 uint32_t current = 0; |
1174 for (int i = 0; i < number_of_descriptors(); i++) { | 1174 for (int i = 0; i < number_of_descriptors(); i++) { |
1175 Name* key = GetSortedKey(i); | 1175 Name* key = GetSortedKey(i); |
1176 if (key == current_key) { | 1176 if (key == current_key) { |
1177 OFStream os(stdout); | 1177 Print(); |
1178 PrintDescriptors(os); | |
1179 return false; | 1178 return false; |
1180 } | 1179 } |
1181 current_key = key; | 1180 current_key = key; |
1182 uint32_t hash = GetSortedKey(i)->Hash(); | 1181 uint32_t hash = GetSortedKey(i)->Hash(); |
1183 if (hash < current) { | 1182 if (hash < current) { |
1184 OFStream os(stdout); | 1183 Print(); |
1185 PrintDescriptors(os); | |
1186 return false; | 1184 return false; |
1187 } | 1185 } |
1188 current = hash; | 1186 current = hash; |
1189 } | 1187 } |
1190 return true; | 1188 return true; |
1191 } | 1189 } |
1192 | 1190 |
1193 | 1191 |
1194 bool LayoutDescriptor::IsConsistentWithMap(Map* map) { | 1192 bool LayoutDescriptor::IsConsistentWithMap(Map* map) { |
1195 if (FLAG_unbox_double_fields) { | 1193 if (FLAG_unbox_double_fields) { |
(...skipping 11 matching lines...) Expand all Loading... |
1207 if (tagged_actual != tagged_expected) return false; | 1205 if (tagged_actual != tagged_expected) return false; |
1208 } | 1206 } |
1209 } | 1207 } |
1210 } | 1208 } |
1211 return true; | 1209 return true; |
1212 } | 1210 } |
1213 | 1211 |
1214 | 1212 |
1215 bool TransitionArray::IsSortedNoDuplicates(int valid_entries) { | 1213 bool TransitionArray::IsSortedNoDuplicates(int valid_entries) { |
1216 DCHECK(valid_entries == -1); | 1214 DCHECK(valid_entries == -1); |
1217 Name* current_key = NULL; | 1215 Name* prev_key = NULL; |
1218 uint32_t current = 0; | 1216 bool prev_is_data_property = false; |
| 1217 PropertyAttributes prev_attributes = NONE; |
| 1218 uint32_t prev_hash = 0; |
1219 for (int i = 0; i < number_of_transitions(); i++) { | 1219 for (int i = 0; i < number_of_transitions(); i++) { |
1220 Name* key = GetSortedKey(i); | 1220 Name* key = GetSortedKey(i); |
1221 if (key == current_key) { | 1221 uint32_t hash = key->Hash(); |
1222 OFStream os(stdout); | 1222 bool is_data_property = false; |
1223 PrintTransitions(os); | 1223 PropertyAttributes attributes = NONE; |
| 1224 if (!IsSpecialTransition(key)) { |
| 1225 Map* target = GetTarget(i); |
| 1226 PropertyDetails details = GetTargetDetails(key, target); |
| 1227 is_data_property = details.type() == FIELD || details.type() == CONSTANT; |
| 1228 attributes = details.attributes(); |
| 1229 } else { |
| 1230 // Duplicate entries are not allowed for non-property transitions. |
| 1231 CHECK_NE(prev_key, key); |
| 1232 } |
| 1233 |
| 1234 int cmp = |
| 1235 CompareKeys(prev_key, prev_hash, prev_is_data_property, prev_attributes, |
| 1236 key, hash, is_data_property, attributes); |
| 1237 if (cmp >= 0) { |
| 1238 Print(); |
1224 return false; | 1239 return false; |
1225 } | 1240 } |
1226 current_key = key; | 1241 prev_key = key; |
1227 uint32_t hash = GetSortedKey(i)->Hash(); | 1242 prev_hash = hash; |
1228 if (hash < current) { | 1243 prev_attributes = attributes; |
1229 OFStream os(stdout); | 1244 prev_is_data_property = is_data_property; |
1230 PrintTransitions(os); | |
1231 return false; | |
1232 } | |
1233 current = hash; | |
1234 } | 1245 } |
1235 return true; | 1246 return true; |
1236 } | 1247 } |
1237 | 1248 |
1238 | 1249 |
1239 static bool CheckOneBackPointer(Map* current_map, Object* target) { | 1250 static bool CheckOneBackPointer(Map* current_map, Object* target) { |
1240 return !target->IsMap() || Map::cast(target)->GetBackPointer() == current_map; | 1251 return !target->IsMap() || Map::cast(target)->GetBackPointer() == current_map; |
1241 } | 1252 } |
1242 | 1253 |
1243 | 1254 |
(...skipping 19 matching lines...) Expand all Loading... |
1263 while (map != heap->roots_array_start()[i++]) { | 1274 while (map != heap->roots_array_start()[i++]) { |
1264 CHECK_LT(i, Heap::kStrongRootListLength); | 1275 CHECK_LT(i, Heap::kStrongRootListLength); |
1265 } | 1276 } |
1266 } | 1277 } |
1267 } | 1278 } |
1268 | 1279 |
1269 | 1280 |
1270 #endif // DEBUG | 1281 #endif // DEBUG |
1271 | 1282 |
1272 } } // namespace v8::internal | 1283 } } // namespace v8::internal |
OLD | NEW |