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_elements() || | 289 ASSERT_EQ((map()->has_fast_smi_or_object_elements() || |
290 map()->has_fast_smi_only_elements() || | |
291 (elements() == GetHeap()->empty_fixed_array())), | 290 (elements() == GetHeap()->empty_fixed_array())), |
292 (elements()->map() == GetHeap()->fixed_array_map() || | 291 (elements()->map() == GetHeap()->fixed_array_map() || |
293 elements()->map() == GetHeap()->fixed_cow_array_map())); | 292 elements()->map() == GetHeap()->fixed_cow_array_map())); |
294 ASSERT(map()->has_fast_elements() == HasFastElements()); | 293 ASSERT(map()->has_fast_object_elements() == HasFastObjectElements()); |
295 } | 294 } |
296 | 295 |
297 | 296 |
298 void Map::MapVerify() { | 297 void Map::MapVerify() { |
299 ASSERT(!HEAP->InNewSpace(this)); | 298 ASSERT(!HEAP->InNewSpace(this)); |
300 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); | 299 ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); |
301 ASSERT(instance_size() == kVariableSizeSentinel || | 300 ASSERT(instance_size() == kVariableSizeSentinel || |
302 (kPointerSize <= instance_size() && | 301 (kPointerSize <= instance_size() && |
303 instance_size() < HEAP->Capacity())); | 302 instance_size() < HEAP->Capacity())); |
304 VerifyHeapPointer(prototype()); | 303 VerifyHeapPointer(prototype()); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 VerifyObjectField(kDebugInfoOffset); | 502 VerifyObjectField(kDebugInfoOffset); |
504 } | 503 } |
505 | 504 |
506 | 505 |
507 void JSGlobalProxy::JSGlobalProxyVerify() { | 506 void JSGlobalProxy::JSGlobalProxyVerify() { |
508 CHECK(IsJSGlobalProxy()); | 507 CHECK(IsJSGlobalProxy()); |
509 JSObjectVerify(); | 508 JSObjectVerify(); |
510 VerifyObjectField(JSGlobalProxy::kContextOffset); | 509 VerifyObjectField(JSGlobalProxy::kContextOffset); |
511 // Make sure that this object has no properties, elements. | 510 // Make sure that this object has no properties, elements. |
512 CHECK_EQ(0, properties()->length()); | 511 CHECK_EQ(0, properties()->length()); |
513 CHECK(HasFastElements()); | 512 CHECK(HasFastObjectElements()); |
514 CHECK_EQ(0, FixedArray::cast(elements())->length()); | 513 CHECK_EQ(0, FixedArray::cast(elements())->length()); |
515 } | 514 } |
516 | 515 |
517 | 516 |
518 void JSGlobalObject::JSGlobalObjectVerify() { | 517 void JSGlobalObject::JSGlobalObjectVerify() { |
519 CHECK(IsJSGlobalObject()); | 518 CHECK(IsJSGlobalObject()); |
520 JSObjectVerify(); | 519 JSObjectVerify(); |
521 for (int i = GlobalObject::kBuiltinsOffset; | 520 for (int i = GlobalObject::kBuiltinsOffset; |
522 i < JSGlobalObject::kSize; | 521 i < JSGlobalObject::kSize; |
523 i += kPointerSize) { | 522 i += kPointerSize) { |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); | 797 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); |
799 info->number_of_fast_unused_fields_ += map()->unused_property_fields(); | 798 info->number_of_fast_unused_fields_ += map()->unused_property_fields(); |
800 } else { | 799 } else { |
801 StringDictionary* dict = property_dictionary(); | 800 StringDictionary* dict = property_dictionary(); |
802 info->number_of_slow_used_properties_ += dict->NumberOfElements(); | 801 info->number_of_slow_used_properties_ += dict->NumberOfElements(); |
803 info->number_of_slow_unused_properties_ += | 802 info->number_of_slow_unused_properties_ += |
804 dict->Capacity() - dict->NumberOfElements(); | 803 dict->Capacity() - dict->NumberOfElements(); |
805 } | 804 } |
806 // Indexed properties | 805 // Indexed properties |
807 switch (GetElementsKind()) { | 806 switch (GetElementsKind()) { |
| 807 case FAST_HOLEY_SMI_ELEMENTS: |
| 808 case FAST_SMI_ELEMENTS: |
| 809 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 810 case FAST_DOUBLE_ELEMENTS: |
| 811 case FAST_HOLEY_ELEMENTS: |
808 case FAST_ELEMENTS: { | 812 case FAST_ELEMENTS: { |
809 info->number_of_objects_with_fast_elements_++; | 813 info->number_of_objects_with_fast_elements_++; |
810 int holes = 0; | 814 int holes = 0; |
811 FixedArray* e = FixedArray::cast(elements()); | 815 FixedArray* e = FixedArray::cast(elements()); |
812 int len = e->length(); | 816 int len = e->length(); |
813 Heap* heap = HEAP; | 817 Heap* heap = HEAP; |
814 for (int i = 0; i < len; i++) { | 818 for (int i = 0; i < len; i++) { |
815 if (e->get(i) == heap->the_hole_value()) holes++; | 819 if (e->get(i) == heap->the_hole_value()) holes++; |
816 } | 820 } |
817 info->number_of_fast_used_elements_ += len - holes; | 821 info->number_of_fast_used_elements_ += len - holes; |
818 info->number_of_fast_unused_elements_ += holes; | 822 info->number_of_fast_unused_elements_ += holes; |
819 break; | 823 break; |
820 } | 824 } |
| 825 case EXTERNAL_BYTE_ELEMENTS: |
| 826 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 827 case EXTERNAL_SHORT_ELEMENTS: |
| 828 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 829 case EXTERNAL_INT_ELEMENTS: |
| 830 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 831 case EXTERNAL_FLOAT_ELEMENTS: |
| 832 case EXTERNAL_DOUBLE_ELEMENTS: |
821 case EXTERNAL_PIXEL_ELEMENTS: { | 833 case EXTERNAL_PIXEL_ELEMENTS: { |
822 info->number_of_objects_with_fast_elements_++; | 834 info->number_of_objects_with_fast_elements_++; |
823 ExternalPixelArray* e = ExternalPixelArray::cast(elements()); | 835 ExternalPixelArray* e = ExternalPixelArray::cast(elements()); |
824 info->number_of_fast_used_elements_ += e->length(); | 836 info->number_of_fast_used_elements_ += e->length(); |
825 break; | 837 break; |
826 } | 838 } |
827 case DICTIONARY_ELEMENTS: { | 839 case DICTIONARY_ELEMENTS: { |
828 SeededNumberDictionary* dict = element_dictionary(); | 840 SeededNumberDictionary* dict = element_dictionary(); |
829 info->number_of_slow_used_elements_ += dict->NumberOfElements(); | 841 info->number_of_slow_used_elements_ += dict->NumberOfElements(); |
830 info->number_of_slow_unused_elements_ += | 842 info->number_of_slow_unused_elements_ += |
831 dict->Capacity() - dict->NumberOfElements(); | 843 dict->Capacity() - dict->NumberOfElements(); |
832 break; | 844 break; |
833 } | 845 } |
834 default: | 846 case NON_STRICT_ARGUMENTS_ELEMENTS: |
835 UNREACHABLE(); | |
836 break; | 847 break; |
837 } | 848 } |
838 } | 849 } |
839 | 850 |
840 | 851 |
841 void JSObject::SpillInformation::Clear() { | 852 void JSObject::SpillInformation::Clear() { |
842 number_of_objects_ = 0; | 853 number_of_objects_ = 0; |
843 number_of_objects_with_fast_properties_ = 0; | 854 number_of_objects_with_fast_properties_ = 0; |
844 number_of_objects_with_fast_elements_ = 0; | 855 number_of_objects_with_fast_elements_ = 0; |
845 number_of_fast_used_fields_ = 0; | 856 number_of_fast_used_fields_ = 0; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 ASSERT(e->IsUndefined()); | 999 ASSERT(e->IsUndefined()); |
989 } | 1000 } |
990 } | 1001 } |
991 } | 1002 } |
992 } | 1003 } |
993 | 1004 |
994 | 1005 |
995 #endif // DEBUG | 1006 #endif // DEBUG |
996 | 1007 |
997 } } // namespace v8::internal | 1008 } } // namespace v8::internal |
OLD | NEW |