Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: src/objects-debug.cc

Issue 769263002: Add support for enabling DCHECKs in release mode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.cc ('k') | src/optimizing-compiler-thread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
1198 #ifdef ENABLE_SLOW_DCHECKS
1194 bool LayoutDescriptor::IsConsistentWithMap(Map* map) { 1199 bool LayoutDescriptor::IsConsistentWithMap(Map* map) {
1195 if (FLAG_unbox_double_fields) { 1200 if (FLAG_unbox_double_fields) {
1196 DescriptorArray* descriptors = map->instance_descriptors(); 1201 DescriptorArray* descriptors = map->instance_descriptors();
1197 int nof_descriptors = map->NumberOfOwnDescriptors(); 1202 int nof_descriptors = map->NumberOfOwnDescriptors();
1198 for (int i = 0; i < nof_descriptors; i++) { 1203 for (int i = 0; i < nof_descriptors; i++) {
1199 PropertyDetails details = descriptors->GetDetails(i); 1204 PropertyDetails details = descriptors->GetDetails(i);
1200 if (details.type() != FIELD) continue; 1205 if (details.type() != FIELD) continue;
1201 FieldIndex field_index = FieldIndex::ForDescriptor(map, i); 1206 FieldIndex field_index = FieldIndex::ForDescriptor(map, i);
1202 bool tagged_expected = 1207 bool tagged_expected =
1203 !field_index.is_inobject() || !details.representation().IsDouble(); 1208 !field_index.is_inobject() || !details.representation().IsDouble();
1204 for (int bit = 0; bit < details.field_width_in_words(); bit++) { 1209 for (int bit = 0; bit < details.field_width_in_words(); bit++) {
1205 bool tagged_actual = IsTagged(details.field_index() + bit); 1210 bool tagged_actual = IsTagged(details.field_index() + bit);
1206 DCHECK_EQ(tagged_expected, tagged_actual); 1211 DCHECK_EQ(tagged_expected, tagged_actual);
1207 if (tagged_actual != tagged_expected) return false; 1212 if (tagged_actual != tagged_expected) return false;
1208 } 1213 }
1209 } 1214 }
1210 } 1215 }
1211 return true; 1216 return true;
1212 } 1217 }
1218 #endif
1213 1219
1214 1220
1215 bool TransitionArray::IsSortedNoDuplicates(int valid_entries) { 1221 bool TransitionArray::IsSortedNoDuplicates(int valid_entries) {
1216 DCHECK(valid_entries == -1); 1222 DCHECK(valid_entries == -1);
1217 Name* current_key = NULL; 1223 Name* current_key = NULL;
1218 uint32_t current = 0; 1224 uint32_t current = 0;
1219 for (int i = 0; i < number_of_transitions(); i++) { 1225 for (int i = 0; i < number_of_transitions(); i++) {
1220 Name* key = GetSortedKey(i); 1226 Name* key = GetSortedKey(i);
1221 if (key == current_key) { 1227 if (key == current_key) {
1228 #ifdef OBJECT_PRINT
1222 OFStream os(stdout); 1229 OFStream os(stdout);
1223 PrintTransitions(os); 1230 PrintTransitions(os);
1231 #endif
1224 return false; 1232 return false;
1225 } 1233 }
1226 current_key = key; 1234 current_key = key;
1227 uint32_t hash = GetSortedKey(i)->Hash(); 1235 uint32_t hash = GetSortedKey(i)->Hash();
1228 if (hash < current) { 1236 if (hash < current) {
1237 #ifdef OBJECT_PRINT
1229 OFStream os(stdout); 1238 OFStream os(stdout);
1230 PrintTransitions(os); 1239 PrintTransitions(os);
1240 #endif
1231 return false; 1241 return false;
1232 } 1242 }
1233 current = hash; 1243 current = hash;
1234 } 1244 }
1235 return true; 1245 return true;
1236 } 1246 }
1237 1247
1238 1248
1239 static bool CheckOneBackPointer(Map* current_map, Object* target) { 1249 static bool CheckOneBackPointer(Map* current_map, Object* target) {
1240 return !target->IsMap() || Map::cast(target)->GetBackPointer() == current_map; 1250 return !target->IsMap() || Map::cast(target)->GetBackPointer() == current_map;
1241 } 1251 }
1242 1252
1243 1253
1244 bool TransitionArray::IsConsistentWithBackPointers(Map* current_map) { 1254 bool TransitionArray::IsConsistentWithBackPointers(Map* current_map) {
1245 for (int i = 0; i < number_of_transitions(); ++i) { 1255 for (int i = 0; i < number_of_transitions(); ++i) {
1246 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; 1256 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false;
1247 } 1257 }
1248 return true; 1258 return true;
1249 } 1259 }
1250 1260
1261 #endif // DCHECK_IS_ON
1262
1263 #ifdef DEBUG
1251 1264
1252 void Code::VerifyEmbeddedObjectsInFullCode() { 1265 void Code::VerifyEmbeddedObjectsInFullCode() {
1253 // Check that no context-specific object has been embedded. 1266 // Check that no context-specific object has been embedded.
1254 Heap* heap = GetIsolate()->heap(); 1267 Heap* heap = GetIsolate()->heap();
1255 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); 1268 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
1256 for (RelocIterator it(this, mask); !it.done(); it.next()) { 1269 for (RelocIterator it(this, mask); !it.done(); it.next()) {
1257 Object* obj = it.rinfo()->target_object(); 1270 Object* obj = it.rinfo()->target_object();
1258 if (obj->IsCell()) obj = Cell::cast(obj)->value(); 1271 if (obj->IsCell()) obj = Cell::cast(obj)->value();
1259 if (obj->IsPropertyCell()) obj = PropertyCell::cast(obj)->value(); 1272 if (obj->IsPropertyCell()) obj = PropertyCell::cast(obj)->value();
1260 if (!obj->IsHeapObject()) continue; 1273 if (!obj->IsHeapObject()) continue;
1261 Map* map = obj->IsMap() ? Map::cast(obj) : HeapObject::cast(obj)->map(); 1274 Map* map = obj->IsMap() ? Map::cast(obj) : HeapObject::cast(obj)->map();
1262 int i = 0; 1275 int i = 0;
1263 while (map != heap->roots_array_start()[i++]) { 1276 while (map != heap->roots_array_start()[i++]) {
1264 CHECK_LT(i, Heap::kStrongRootListLength); 1277 CHECK_LT(i, Heap::kStrongRootListLength);
1265 } 1278 }
1266 } 1279 }
1267 } 1280 }
1268 1281
1269
1270 #endif // DEBUG 1282 #endif // DEBUG
1271 1283
1272 } } // namespace v8::internal 1284 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/optimizing-compiler-thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698