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