OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 if (GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS) { | 279 if (GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS) { |
280 ASSERT(this->elements()->IsFixedArray()); | 280 ASSERT(this->elements()->IsFixedArray()); |
281 ASSERT(this->elements()->length() >= 2); | 281 ASSERT(this->elements()->length() >= 2); |
282 } | 282 } |
283 | 283 |
284 if (HasFastProperties()) { | 284 if (HasFastProperties()) { |
285 CHECK_EQ(map()->unused_property_fields(), | 285 CHECK_EQ(map()->unused_property_fields(), |
286 (map()->inobject_properties() + properties()->length() - | 286 (map()->inobject_properties() + properties()->length() - |
287 map()->NextFreePropertyIndex())); | 287 map()->NextFreePropertyIndex())); |
288 } | 288 } |
289 ASSERT_EQ((map()->has_fast_smi_or_object_elements() || | 289 ASSERT_EQ((map()->has_fast_elements() || |
| 290 map()->has_fast_smi_only_elements() || |
290 (elements() == GetHeap()->empty_fixed_array())), | 291 (elements() == GetHeap()->empty_fixed_array())), |
291 (elements()->map() == GetHeap()->fixed_array_map() || | 292 (elements()->map() == GetHeap()->fixed_array_map() || |
292 elements()->map() == GetHeap()->fixed_cow_array_map())); | 293 elements()->map() == GetHeap()->fixed_cow_array_map())); |
293 ASSERT(map()->has_fast_object_elements() == HasFastObjectElements()); | 294 ASSERT(map()->has_fast_elements() == HasFastElements()); |
294 } | 295 } |
295 | 296 |
296 | 297 |
297 void Map::MapVerify() { | 298 void Map::MapVerify() { |
298 ASSERT(!HEAP->InNewSpace(this)); | 299 ASSERT(!HEAP->InNewSpace(this)); |
299 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); | 300 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); |
300 ASSERT(instance_size() == kVariableSizeSentinel || | 301 ASSERT(instance_size() == kVariableSizeSentinel || |
301 (kPointerSize <= instance_size() && | 302 (kPointerSize <= instance_size() && |
302 instance_size() < HEAP->Capacity())); | 303 instance_size() < HEAP->Capacity())); |
303 VerifyHeapPointer(prototype()); | 304 VerifyHeapPointer(prototype()); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 VerifyObjectField(kDebugInfoOffset); | 510 VerifyObjectField(kDebugInfoOffset); |
510 } | 511 } |
511 | 512 |
512 | 513 |
513 void JSGlobalProxy::JSGlobalProxyVerify() { | 514 void JSGlobalProxy::JSGlobalProxyVerify() { |
514 CHECK(IsJSGlobalProxy()); | 515 CHECK(IsJSGlobalProxy()); |
515 JSObjectVerify(); | 516 JSObjectVerify(); |
516 VerifyObjectField(JSGlobalProxy::kContextOffset); | 517 VerifyObjectField(JSGlobalProxy::kContextOffset); |
517 // Make sure that this object has no properties, elements. | 518 // Make sure that this object has no properties, elements. |
518 CHECK_EQ(0, properties()->length()); | 519 CHECK_EQ(0, properties()->length()); |
519 CHECK(HasFastObjectElements()); | 520 CHECK(HasFastElements()); |
520 CHECK_EQ(0, FixedArray::cast(elements())->length()); | 521 CHECK_EQ(0, FixedArray::cast(elements())->length()); |
521 } | 522 } |
522 | 523 |
523 | 524 |
524 void JSGlobalObject::JSGlobalObjectVerify() { | 525 void JSGlobalObject::JSGlobalObjectVerify() { |
525 CHECK(IsJSGlobalObject()); | 526 CHECK(IsJSGlobalObject()); |
526 JSObjectVerify(); | 527 JSObjectVerify(); |
527 for (int i = GlobalObject::kBuiltinsOffset; | 528 for (int i = GlobalObject::kBuiltinsOffset; |
528 i < JSGlobalObject::kSize; | 529 i < JSGlobalObject::kSize; |
529 i += kPointerSize) { | 530 i += kPointerSize) { |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); | 805 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); |
805 info->number_of_fast_unused_fields_ += map()->unused_property_fields(); | 806 info->number_of_fast_unused_fields_ += map()->unused_property_fields(); |
806 } else { | 807 } else { |
807 StringDictionary* dict = property_dictionary(); | 808 StringDictionary* dict = property_dictionary(); |
808 info->number_of_slow_used_properties_ += dict->NumberOfElements(); | 809 info->number_of_slow_used_properties_ += dict->NumberOfElements(); |
809 info->number_of_slow_unused_properties_ += | 810 info->number_of_slow_unused_properties_ += |
810 dict->Capacity() - dict->NumberOfElements(); | 811 dict->Capacity() - dict->NumberOfElements(); |
811 } | 812 } |
812 // Indexed properties | 813 // Indexed properties |
813 switch (GetElementsKind()) { | 814 switch (GetElementsKind()) { |
814 case FAST_HOLEY_SMI_ELEMENTS: | |
815 case FAST_SMI_ELEMENTS: | |
816 case FAST_HOLEY_DOUBLE_ELEMENTS: | |
817 case FAST_DOUBLE_ELEMENTS: | |
818 case FAST_HOLEY_ELEMENTS: | |
819 case FAST_ELEMENTS: { | 815 case FAST_ELEMENTS: { |
820 info->number_of_objects_with_fast_elements_++; | 816 info->number_of_objects_with_fast_elements_++; |
821 int holes = 0; | 817 int holes = 0; |
822 FixedArray* e = FixedArray::cast(elements()); | 818 FixedArray* e = FixedArray::cast(elements()); |
823 int len = e->length(); | 819 int len = e->length(); |
824 Heap* heap = HEAP; | 820 Heap* heap = HEAP; |
825 for (int i = 0; i < len; i++) { | 821 for (int i = 0; i < len; i++) { |
826 if (e->get(i) == heap->the_hole_value()) holes++; | 822 if (e->get(i) == heap->the_hole_value()) holes++; |
827 } | 823 } |
828 info->number_of_fast_used_elements_ += len - holes; | 824 info->number_of_fast_used_elements_ += len - holes; |
829 info->number_of_fast_unused_elements_ += holes; | 825 info->number_of_fast_unused_elements_ += holes; |
830 break; | 826 break; |
831 } | 827 } |
832 case EXTERNAL_BYTE_ELEMENTS: | |
833 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | |
834 case EXTERNAL_SHORT_ELEMENTS: | |
835 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | |
836 case EXTERNAL_INT_ELEMENTS: | |
837 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | |
838 case EXTERNAL_FLOAT_ELEMENTS: | |
839 case EXTERNAL_DOUBLE_ELEMENTS: | |
840 case EXTERNAL_PIXEL_ELEMENTS: { | 828 case EXTERNAL_PIXEL_ELEMENTS: { |
841 info->number_of_objects_with_fast_elements_++; | 829 info->number_of_objects_with_fast_elements_++; |
842 ExternalPixelArray* e = ExternalPixelArray::cast(elements()); | 830 ExternalPixelArray* e = ExternalPixelArray::cast(elements()); |
843 info->number_of_fast_used_elements_ += e->length(); | 831 info->number_of_fast_used_elements_ += e->length(); |
844 break; | 832 break; |
845 } | 833 } |
846 case DICTIONARY_ELEMENTS: { | 834 case DICTIONARY_ELEMENTS: { |
847 SeededNumberDictionary* dict = element_dictionary(); | 835 SeededNumberDictionary* dict = element_dictionary(); |
848 info->number_of_slow_used_elements_ += dict->NumberOfElements(); | 836 info->number_of_slow_used_elements_ += dict->NumberOfElements(); |
849 info->number_of_slow_unused_elements_ += | 837 info->number_of_slow_unused_elements_ += |
850 dict->Capacity() - dict->NumberOfElements(); | 838 dict->Capacity() - dict->NumberOfElements(); |
851 break; | 839 break; |
852 } | 840 } |
853 case NON_STRICT_ARGUMENTS_ELEMENTS: | 841 default: |
| 842 UNREACHABLE(); |
854 break; | 843 break; |
855 } | 844 } |
856 } | 845 } |
857 | 846 |
858 | 847 |
859 void JSObject::SpillInformation::Clear() { | 848 void JSObject::SpillInformation::Clear() { |
860 number_of_objects_ = 0; | 849 number_of_objects_ = 0; |
861 number_of_objects_with_fast_properties_ = 0; | 850 number_of_objects_with_fast_properties_ = 0; |
862 number_of_objects_with_fast_elements_ = 0; | 851 number_of_objects_with_fast_elements_ = 0; |
863 number_of_fast_used_fields_ = 0; | 852 number_of_fast_used_fields_ = 0; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 FixedArray* proto_transitions = prototype_transitions(); | 1017 FixedArray* proto_transitions = prototype_transitions(); |
1029 MemsetPointer(proto_transitions->data_start(), | 1018 MemsetPointer(proto_transitions->data_start(), |
1030 GetHeap()->the_hole_value(), | 1019 GetHeap()->the_hole_value(), |
1031 proto_transitions->length()); | 1020 proto_transitions->length()); |
1032 } | 1021 } |
1033 | 1022 |
1034 | 1023 |
1035 #endif // DEBUG | 1024 #endif // DEBUG |
1036 | 1025 |
1037 } } // namespace v8::internal | 1026 } } // namespace v8::internal |
OLD | NEW |