Chromium Code Reviews| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 | 256 |
| 257 if (HasFastProperties()) { | 257 if (HasFastProperties()) { |
| 258 CHECK_EQ(map()->unused_property_fields(), | 258 CHECK_EQ(map()->unused_property_fields(), |
| 259 (map()->inobject_properties() + properties()->length() - | 259 (map()->inobject_properties() + properties()->length() - |
| 260 map()->NextFreePropertyIndex())); | 260 map()->NextFreePropertyIndex())); |
| 261 DescriptorArray* descriptors = map()->instance_descriptors(); | 261 DescriptorArray* descriptors = map()->instance_descriptors(); |
| 262 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { | 262 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { |
| 263 if (descriptors->GetDetails(i).type() == FIELD) { | 263 if (descriptors->GetDetails(i).type() == FIELD) { |
| 264 Representation r = descriptors->GetDetails(i).representation(); | 264 Representation r = descriptors->GetDetails(i).representation(); |
| 265 FieldIndex index = FieldIndex::ForDescriptor(map(), i); | 265 FieldIndex index = FieldIndex::ForDescriptor(map(), i); |
| 266 if (map()->IsUnboxedDoubleField(index)) continue; | |
|
Toon Verwaest
2014/07/29 15:02:08
Assert that r.IsDouble()
Igor Sheludko
2014/10/30 14:23:43
Done.
| |
| 266 Object* value = RawFastPropertyAt(index); | 267 Object* value = RawFastPropertyAt(index); |
| 267 if (r.IsDouble()) ASSERT(value->IsMutableHeapNumber()); | 268 if (r.IsDouble()) ASSERT(value->IsMutableHeapNumber()); |
| 268 if (value->IsUninitialized()) continue; | 269 if (value->IsUninitialized()) continue; |
| 269 if (r.IsSmi()) ASSERT(value->IsSmi()); | 270 if (r.IsSmi()) ASSERT(value->IsSmi()); |
| 270 if (r.IsHeapObject()) ASSERT(value->IsHeapObject()); | 271 if (r.IsHeapObject()) ASSERT(value->IsHeapObject()); |
| 271 HeapType* field_type = descriptors->GetFieldType(i); | 272 HeapType* field_type = descriptors->GetFieldType(i); |
| 272 if (r.IsNone()) { | 273 if (r.IsNone()) { |
| 273 CHECK(field_type->Is(HeapType::None())); | 274 CHECK(field_type->Is(HeapType::None())); |
| 274 } else if (!HeapType::Any()->Is(field_type)) { | 275 } else if (!HeapType::Any()->Is(field_type)) { |
| 275 CHECK(!field_type->NowStable() || field_type->NowContains(value)); | 276 CHECK(!field_type->NowStable() || field_type->NowContains(value)); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 297 CHECK(instance_size() == kVariableSizeSentinel || | 298 CHECK(instance_size() == kVariableSizeSentinel || |
| 298 (kPointerSize <= instance_size() && | 299 (kPointerSize <= instance_size() && |
| 299 instance_size() < heap->Capacity())); | 300 instance_size() < heap->Capacity())); |
| 300 VerifyHeapPointer(prototype()); | 301 VerifyHeapPointer(prototype()); |
| 301 VerifyHeapPointer(instance_descriptors()); | 302 VerifyHeapPointer(instance_descriptors()); |
| 302 SLOW_ASSERT(instance_descriptors()->IsSortedNoDuplicates()); | 303 SLOW_ASSERT(instance_descriptors()->IsSortedNoDuplicates()); |
| 303 if (HasTransitionArray()) { | 304 if (HasTransitionArray()) { |
| 304 SLOW_ASSERT(transitions()->IsSortedNoDuplicates()); | 305 SLOW_ASSERT(transitions()->IsSortedNoDuplicates()); |
| 305 SLOW_ASSERT(transitions()->IsConsistentWithBackPointers(this)); | 306 SLOW_ASSERT(transitions()->IsConsistentWithBackPointers(this)); |
| 306 } | 307 } |
| 308 ASSERT(!FLAG_unbox_double_fields || | |
|
Toon Verwaest
2014/07/29 15:02:08
SLOW_ASSERT?
Igor Sheludko
2014/10/30 14:23:43
Done.
| |
| 309 layout_descriptor()->IsConsistentWithMap(this)); | |
| 307 } | 310 } |
| 308 | 311 |
| 309 | 312 |
| 310 void Map::SharedMapVerify() { | 313 void Map::SharedMapVerify() { |
| 311 MapVerify(); | 314 MapVerify(); |
| 312 CHECK(is_shared()); | 315 CHECK(is_shared()); |
| 313 CHECK(instance_descriptors()->IsEmpty()); | 316 CHECK(instance_descriptors()->IsEmpty()); |
| 314 CHECK_EQ(0, pre_allocated_property_fields()); | 317 CHECK_EQ(0, pre_allocated_property_fields()); |
| 315 CHECK_EQ(0, unused_property_fields()); | 318 CHECK_EQ(0, unused_property_fields()); |
| 316 CHECK_EQ(StaticVisitorBase::GetVisitorId(instance_type(), instance_size()), | 319 CHECK_EQ(StaticVisitorBase::GetVisitorId(this), visitor_id()); |
| 317 visitor_id()); | |
| 318 } | 320 } |
| 319 | 321 |
| 320 | 322 |
| 321 void Map::VerifyOmittedMapChecks() { | 323 void Map::VerifyOmittedMapChecks() { |
| 322 if (!FLAG_omit_map_checks_for_leaf_maps) return; | 324 if (!FLAG_omit_map_checks_for_leaf_maps) return; |
| 323 if (!is_stable() || | 325 if (!is_stable() || |
| 324 is_deprecated() || | 326 is_deprecated() || |
| 325 HasTransitionArray() || | 327 HasTransitionArray() || |
| 326 is_dictionary_map()) { | 328 is_dictionary_map()) { |
| 327 CHECK_EQ(0, dependent_code()->number_of_entries( | 329 CHECK_EQ(0, dependent_code()->number_of_entries( |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1150 OFStream os(stdout); | 1152 OFStream os(stdout); |
| 1151 PrintDescriptors(os); | 1153 PrintDescriptors(os); |
| 1152 return false; | 1154 return false; |
| 1153 } | 1155 } |
| 1154 current = hash; | 1156 current = hash; |
| 1155 } | 1157 } |
| 1156 return true; | 1158 return true; |
| 1157 } | 1159 } |
| 1158 | 1160 |
| 1159 | 1161 |
| 1162 bool LayoutDescriptor::IsConsistentWithMap(Map* map) { | |
| 1163 DescriptorArray* descriptors = map->instance_descriptors(); | |
| 1164 int nof_descriptors = map->NumberOfOwnDescriptors(); | |
| 1165 for (int i = 0; i < nof_descriptors; i++) { | |
| 1166 PropertyDetails details = descriptors->GetDetails(i); | |
| 1167 if (details.type() == FIELD) { | |
| 1168 FieldIndex field_index = FieldIndex::ForDescriptor(map, i); | |
| 1169 if (!field_index.is_inobject()) continue; | |
| 1170 bool tagged_expected = | |
| 1171 !FLAG_unbox_double_fields || !details.representation().IsDouble(); | |
| 1172 for (int bit = 0; bit < details.field_width_in_words(); bit++) { | |
| 1173 bool tagged_actual = IsTagged(details.field_index() + bit); | |
| 1174 ASSERT_EQ(tagged_expected, tagged_actual); | |
| 1175 if (tagged_actual != tagged_expected) return false; | |
| 1176 } | |
| 1177 } | |
| 1178 } | |
| 1179 return true; | |
| 1180 } | |
| 1181 | |
| 1182 | |
| 1160 bool TransitionArray::IsSortedNoDuplicates(int valid_entries) { | 1183 bool TransitionArray::IsSortedNoDuplicates(int valid_entries) { |
| 1161 ASSERT(valid_entries == -1); | 1184 ASSERT(valid_entries == -1); |
| 1162 Name* current_key = NULL; | 1185 Name* current_key = NULL; |
| 1163 uint32_t current = 0; | 1186 uint32_t current = 0; |
| 1164 for (int i = 0; i < number_of_transitions(); i++) { | 1187 for (int i = 0; i < number_of_transitions(); i++) { |
| 1165 Name* key = GetSortedKey(i); | 1188 Name* key = GetSortedKey(i); |
| 1166 if (key == current_key) { | 1189 if (key == current_key) { |
| 1167 OFStream os(stdout); | 1190 OFStream os(stdout); |
| 1168 PrintTransitions(os); | 1191 PrintTransitions(os); |
| 1169 return false; | 1192 return false; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1190 for (int i = 0; i < number_of_transitions(); ++i) { | 1213 for (int i = 0; i < number_of_transitions(); ++i) { |
| 1191 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; | 1214 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; |
| 1192 } | 1215 } |
| 1193 return true; | 1216 return true; |
| 1194 } | 1217 } |
| 1195 | 1218 |
| 1196 | 1219 |
| 1197 #endif // DEBUG | 1220 #endif // DEBUG |
| 1198 | 1221 |
| 1199 } } // namespace v8::internal | 1222 } } // namespace v8::internal |
| OLD | NEW |