| 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 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 | 1062 |
| 1063 void BreakPointInfo::BreakPointInfoVerify() { | 1063 void BreakPointInfo::BreakPointInfoVerify() { |
| 1064 CHECK(IsBreakPointInfo()); | 1064 CHECK(IsBreakPointInfo()); |
| 1065 code_position()->SmiVerify(); | 1065 code_position()->SmiVerify(); |
| 1066 source_position()->SmiVerify(); | 1066 source_position()->SmiVerify(); |
| 1067 statement_position()->SmiVerify(); | 1067 statement_position()->SmiVerify(); |
| 1068 VerifyPointer(break_point_objects()); | 1068 VerifyPointer(break_point_objects()); |
| 1069 } | 1069 } |
| 1070 #endif // VERIFY_HEAP | 1070 #endif // VERIFY_HEAP |
| 1071 | 1071 |
| 1072 #ifdef DEBUG | 1072 #if DCHECK_IS_ON |
| 1073 | 1073 |
| 1074 void JSObject::IncrementSpillStatistics(SpillInformation* info) { | 1074 void JSObject::IncrementSpillStatistics(SpillInformation* info) { |
| 1075 info->number_of_objects_++; | 1075 info->number_of_objects_++; |
| 1076 // Named properties | 1076 // Named properties |
| 1077 if (HasFastProperties()) { | 1077 if (HasFastProperties()) { |
| 1078 info->number_of_objects_with_fast_properties_++; | 1078 info->number_of_objects_with_fast_properties_++; |
| 1079 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); | 1079 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); |
| 1080 info->number_of_fast_unused_fields_ += map()->unused_property_fields(); | 1080 info->number_of_fast_unused_fields_ += map()->unused_property_fields(); |
| 1081 } else { | 1081 } else { |
| 1082 NameDictionary* dict = property_dictionary(); | 1082 NameDictionary* dict = property_dictionary(); |
| (...skipping 84 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 #ifdef OBJECT_PRINT |
| 1177 OFStream os(stdout); | 1178 OFStream os(stdout); |
| 1178 PrintDescriptors(os); | 1179 PrintDescriptors(os); |
| 1180 #endif |
| 1179 return false; | 1181 return false; |
| 1180 } | 1182 } |
| 1181 current_key = key; | 1183 current_key = key; |
| 1182 uint32_t hash = GetSortedKey(i)->Hash(); | 1184 uint32_t hash = GetSortedKey(i)->Hash(); |
| 1183 if (hash < current) { | 1185 if (hash < current) { |
| 1186 #ifdef OBJECT_PRINT |
| 1184 OFStream os(stdout); | 1187 OFStream os(stdout); |
| 1185 PrintDescriptors(os); | 1188 PrintDescriptors(os); |
| 1189 #endif |
| 1186 return false; | 1190 return false; |
| 1187 } | 1191 } |
| 1188 current = hash; | 1192 current = hash; |
| 1189 } | 1193 } |
| 1190 return true; | 1194 return true; |
| 1191 } | 1195 } |
| 1192 | 1196 |
| 1193 | 1197 |
| 1194 bool LayoutDescriptor::IsConsistentWithMap(Map* map) { | 1198 bool LayoutDescriptor::IsConsistentWithMap(Map* map) { |
| 1195 if (FLAG_unbox_double_fields) { | 1199 if (FLAG_unbox_double_fields) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1212 } | 1216 } |
| 1213 | 1217 |
| 1214 | 1218 |
| 1215 bool TransitionArray::IsSortedNoDuplicates(int valid_entries) { | 1219 bool TransitionArray::IsSortedNoDuplicates(int valid_entries) { |
| 1216 DCHECK(valid_entries == -1); | 1220 DCHECK(valid_entries == -1); |
| 1217 Name* current_key = NULL; | 1221 Name* current_key = NULL; |
| 1218 uint32_t current = 0; | 1222 uint32_t current = 0; |
| 1219 for (int i = 0; i < number_of_transitions(); i++) { | 1223 for (int i = 0; i < number_of_transitions(); i++) { |
| 1220 Name* key = GetSortedKey(i); | 1224 Name* key = GetSortedKey(i); |
| 1221 if (key == current_key) { | 1225 if (key == current_key) { |
| 1226 #ifdef OBJECT_PRINT |
| 1222 OFStream os(stdout); | 1227 OFStream os(stdout); |
| 1223 PrintTransitions(os); | 1228 PrintTransitions(os); |
| 1229 #endif |
| 1224 return false; | 1230 return false; |
| 1225 } | 1231 } |
| 1226 current_key = key; | 1232 current_key = key; |
| 1227 uint32_t hash = GetSortedKey(i)->Hash(); | 1233 uint32_t hash = GetSortedKey(i)->Hash(); |
| 1228 if (hash < current) { | 1234 if (hash < current) { |
| 1235 #ifdef OBJECT_PRINT |
| 1229 OFStream os(stdout); | 1236 OFStream os(stdout); |
| 1230 PrintTransitions(os); | 1237 PrintTransitions(os); |
| 1238 #endif |
| 1231 return false; | 1239 return false; |
| 1232 } | 1240 } |
| 1233 current = hash; | 1241 current = hash; |
| 1234 } | 1242 } |
| 1235 return true; | 1243 return true; |
| 1236 } | 1244 } |
| 1237 | 1245 |
| 1238 | 1246 |
| 1239 static bool CheckOneBackPointer(Map* current_map, Object* target) { | 1247 static bool CheckOneBackPointer(Map* current_map, Object* target) { |
| 1240 return !target->IsMap() || Map::cast(target)->GetBackPointer() == current_map; | 1248 return !target->IsMap() || Map::cast(target)->GetBackPointer() == current_map; |
| 1241 } | 1249 } |
| 1242 | 1250 |
| 1243 | 1251 |
| 1244 bool TransitionArray::IsConsistentWithBackPointers(Map* current_map) { | 1252 bool TransitionArray::IsConsistentWithBackPointers(Map* current_map) { |
| 1245 for (int i = 0; i < number_of_transitions(); ++i) { | 1253 for (int i = 0; i < number_of_transitions(); ++i) { |
| 1246 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; | 1254 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; |
| 1247 } | 1255 } |
| 1248 return true; | 1256 return true; |
| 1249 } | 1257 } |
| 1250 | 1258 |
| 1259 #endif // DCHECK_IS_ON |
| 1260 |
| 1261 #ifdef DEBUG |
| 1251 | 1262 |
| 1252 void Code::VerifyEmbeddedObjectsInFullCode() { | 1263 void Code::VerifyEmbeddedObjectsInFullCode() { |
| 1253 // Check that no context-specific object has been embedded. | 1264 // Check that no context-specific object has been embedded. |
| 1254 Heap* heap = GetIsolate()->heap(); | 1265 Heap* heap = GetIsolate()->heap(); |
| 1255 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 1266 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
| 1256 for (RelocIterator it(this, mask); !it.done(); it.next()) { | 1267 for (RelocIterator it(this, mask); !it.done(); it.next()) { |
| 1257 Object* obj = it.rinfo()->target_object(); | 1268 Object* obj = it.rinfo()->target_object(); |
| 1258 if (obj->IsCell()) obj = Cell::cast(obj)->value(); | 1269 if (obj->IsCell()) obj = Cell::cast(obj)->value(); |
| 1259 if (obj->IsPropertyCell()) obj = PropertyCell::cast(obj)->value(); | 1270 if (obj->IsPropertyCell()) obj = PropertyCell::cast(obj)->value(); |
| 1260 if (!obj->IsHeapObject()) continue; | 1271 if (!obj->IsHeapObject()) continue; |
| 1261 Map* map = obj->IsMap() ? Map::cast(obj) : HeapObject::cast(obj)->map(); | 1272 Map* map = obj->IsMap() ? Map::cast(obj) : HeapObject::cast(obj)->map(); |
| 1262 int i = 0; | 1273 int i = 0; |
| 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 | |
| 1270 #endif // DEBUG | 1280 #endif // DEBUG |
| 1271 | 1281 |
| 1272 } } // namespace v8::internal | 1282 } } // namespace v8::internal |
| OLD | NEW |