| 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/jsregexp.h" | 9 #include "src/jsregexp.h" |
| 10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 if (HasFastProperties()) { | 258 if (HasFastProperties()) { |
| 259 CHECK_EQ(map()->unused_property_fields(), | 259 CHECK_EQ(map()->unused_property_fields(), |
| 260 (map()->inobject_properties() + properties()->length() - | 260 (map()->inobject_properties() + properties()->length() - |
| 261 map()->NextFreePropertyIndex())); | 261 map()->NextFreePropertyIndex())); |
| 262 DescriptorArray* descriptors = map()->instance_descriptors(); | 262 DescriptorArray* descriptors = map()->instance_descriptors(); |
| 263 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { | 263 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { |
| 264 if (descriptors->GetDetails(i).type() == FIELD) { | 264 if (descriptors->GetDetails(i).type() == FIELD) { |
| 265 Representation r = descriptors->GetDetails(i).representation(); | 265 Representation r = descriptors->GetDetails(i).representation(); |
| 266 FieldIndex index = FieldIndex::ForDescriptor(map(), i); | 266 FieldIndex index = FieldIndex::ForDescriptor(map(), i); |
| 267 Object* value = RawFastPropertyAt(index); | 267 Object* value = RawFastPropertyAt(index); |
| 268 if (r.IsDouble()) ASSERT(value->IsMutableHeapNumber()); | 268 if (r.IsDouble()) DCHECK(value->IsMutableHeapNumber()); |
| 269 if (value->IsUninitialized()) continue; | 269 if (value->IsUninitialized()) continue; |
| 270 if (r.IsSmi()) ASSERT(value->IsSmi()); | 270 if (r.IsSmi()) DCHECK(value->IsSmi()); |
| 271 if (r.IsHeapObject()) ASSERT(value->IsHeapObject()); | 271 if (r.IsHeapObject()) DCHECK(value->IsHeapObject()); |
| 272 HeapType* field_type = descriptors->GetFieldType(i); | 272 HeapType* field_type = descriptors->GetFieldType(i); |
| 273 if (r.IsNone()) { | 273 if (r.IsNone()) { |
| 274 CHECK(field_type->Is(HeapType::None())); | 274 CHECK(field_type->Is(HeapType::None())); |
| 275 } else if (!HeapType::Any()->Is(field_type)) { | 275 } else if (!HeapType::Any()->Is(field_type)) { |
| 276 CHECK(!field_type->NowStable() || field_type->NowContains(value)); | 276 CHECK(!field_type->NowStable() || field_type->NowContains(value)); |
| 277 } | 277 } |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 | 281 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 293 | 293 |
| 294 void Map::MapVerify() { | 294 void Map::MapVerify() { |
| 295 Heap* heap = GetHeap(); | 295 Heap* heap = GetHeap(); |
| 296 CHECK(!heap->InNewSpace(this)); | 296 CHECK(!heap->InNewSpace(this)); |
| 297 CHECK(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); | 297 CHECK(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); |
| 298 CHECK(instance_size() == kVariableSizeSentinel || | 298 CHECK(instance_size() == kVariableSizeSentinel || |
| 299 (kPointerSize <= instance_size() && | 299 (kPointerSize <= instance_size() && |
| 300 instance_size() < heap->Capacity())); | 300 instance_size() < heap->Capacity())); |
| 301 VerifyHeapPointer(prototype()); | 301 VerifyHeapPointer(prototype()); |
| 302 VerifyHeapPointer(instance_descriptors()); | 302 VerifyHeapPointer(instance_descriptors()); |
| 303 SLOW_ASSERT(instance_descriptors()->IsSortedNoDuplicates()); | 303 SLOW_DCHECK(instance_descriptors()->IsSortedNoDuplicates()); |
| 304 if (HasTransitionArray()) { | 304 if (HasTransitionArray()) { |
| 305 SLOW_ASSERT(transitions()->IsSortedNoDuplicates()); | 305 SLOW_DCHECK(transitions()->IsSortedNoDuplicates()); |
| 306 SLOW_ASSERT(transitions()->IsConsistentWithBackPointers(this)); | 306 SLOW_DCHECK(transitions()->IsConsistentWithBackPointers(this)); |
| 307 } | 307 } |
| 308 } | 308 } |
| 309 | 309 |
| 310 | 310 |
| 311 void Map::SharedMapVerify() { | 311 void Map::SharedMapVerify() { |
| 312 MapVerify(); | 312 MapVerify(); |
| 313 CHECK(is_shared()); | 313 CHECK(is_shared()); |
| 314 CHECK(instance_descriptors()->IsEmpty()); | 314 CHECK(instance_descriptors()->IsEmpty()); |
| 315 CHECK_EQ(0, pre_allocated_property_fields()); | 315 CHECK_EQ(0, pre_allocated_property_fields()); |
| 316 CHECK_EQ(0, unused_property_fields()); | 316 CHECK_EQ(0, unused_property_fields()); |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 PrintDescriptors(os); | 1154 PrintDescriptors(os); |
| 1155 return false; | 1155 return false; |
| 1156 } | 1156 } |
| 1157 current = hash; | 1157 current = hash; |
| 1158 } | 1158 } |
| 1159 return true; | 1159 return true; |
| 1160 } | 1160 } |
| 1161 | 1161 |
| 1162 | 1162 |
| 1163 bool TransitionArray::IsSortedNoDuplicates(int valid_entries) { | 1163 bool TransitionArray::IsSortedNoDuplicates(int valid_entries) { |
| 1164 ASSERT(valid_entries == -1); | 1164 DCHECK(valid_entries == -1); |
| 1165 Name* current_key = NULL; | 1165 Name* current_key = NULL; |
| 1166 uint32_t current = 0; | 1166 uint32_t current = 0; |
| 1167 for (int i = 0; i < number_of_transitions(); i++) { | 1167 for (int i = 0; i < number_of_transitions(); i++) { |
| 1168 Name* key = GetSortedKey(i); | 1168 Name* key = GetSortedKey(i); |
| 1169 if (key == current_key) { | 1169 if (key == current_key) { |
| 1170 OFStream os(stdout); | 1170 OFStream os(stdout); |
| 1171 PrintTransitions(os); | 1171 PrintTransitions(os); |
| 1172 return false; | 1172 return false; |
| 1173 } | 1173 } |
| 1174 current_key = key; | 1174 current_key = key; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1193 for (int i = 0; i < number_of_transitions(); ++i) { | 1193 for (int i = 0; i < number_of_transitions(); ++i) { |
| 1194 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; | 1194 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; |
| 1195 } | 1195 } |
| 1196 return true; | 1196 return true; |
| 1197 } | 1197 } |
| 1198 | 1198 |
| 1199 | 1199 |
| 1200 #endif // DEBUG | 1200 #endif // DEBUG |
| 1201 | 1201 |
| 1202 } } // namespace v8::internal | 1202 } } // namespace v8::internal |
| OLD | NEW |