| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 VerifyObjectField(kDebugInfoOffset); | 500 VerifyObjectField(kDebugInfoOffset); |
| 502 } | 501 } |
| 503 | 502 |
| 504 | 503 |
| 505 void JSGlobalProxy::JSGlobalProxyVerify() { | 504 void JSGlobalProxy::JSGlobalProxyVerify() { |
| 506 CHECK(IsJSGlobalProxy()); | 505 CHECK(IsJSGlobalProxy()); |
| 507 JSObjectVerify(); | 506 JSObjectVerify(); |
| 508 VerifyObjectField(JSGlobalProxy::kContextOffset); | 507 VerifyObjectField(JSGlobalProxy::kContextOffset); |
| 509 // Make sure that this object has no properties, elements. | 508 // Make sure that this object has no properties, elements. |
| 510 CHECK_EQ(0, properties()->length()); | 509 CHECK_EQ(0, properties()->length()); |
| 511 CHECK(HasFastElements()); | 510 CHECK(HasFastObjectElements()); |
| 512 CHECK_EQ(0, FixedArray::cast(elements())->length()); | 511 CHECK_EQ(0, FixedArray::cast(elements())->length()); |
| 513 } | 512 } |
| 514 | 513 |
| 515 | 514 |
| 516 void JSGlobalObject::JSGlobalObjectVerify() { | 515 void JSGlobalObject::JSGlobalObjectVerify() { |
| 517 CHECK(IsJSGlobalObject()); | 516 CHECK(IsJSGlobalObject()); |
| 518 JSObjectVerify(); | 517 JSObjectVerify(); |
| 519 for (int i = GlobalObject::kBuiltinsOffset; | 518 for (int i = GlobalObject::kBuiltinsOffset; |
| 520 i < JSGlobalObject::kSize; | 519 i < JSGlobalObject::kSize; |
| 521 i += kPointerSize) { | 520 i += kPointerSize) { |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); | 795 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); |
| 797 info->number_of_fast_unused_fields_ += map()->unused_property_fields(); | 796 info->number_of_fast_unused_fields_ += map()->unused_property_fields(); |
| 798 } else { | 797 } else { |
| 799 StringDictionary* dict = property_dictionary(); | 798 StringDictionary* dict = property_dictionary(); |
| 800 info->number_of_slow_used_properties_ += dict->NumberOfElements(); | 799 info->number_of_slow_used_properties_ += dict->NumberOfElements(); |
| 801 info->number_of_slow_unused_properties_ += | 800 info->number_of_slow_unused_properties_ += |
| 802 dict->Capacity() - dict->NumberOfElements(); | 801 dict->Capacity() - dict->NumberOfElements(); |
| 803 } | 802 } |
| 804 // Indexed properties | 803 // Indexed properties |
| 805 switch (GetElementsKind()) { | 804 switch (GetElementsKind()) { |
| 805 case FAST_HOLEY_SMI_ELEMENTS: |
| 806 case FAST_SMI_ELEMENTS: |
| 807 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 808 case FAST_DOUBLE_ELEMENTS: |
| 809 case FAST_HOLEY_ELEMENTS: |
| 806 case FAST_ELEMENTS: { | 810 case FAST_ELEMENTS: { |
| 807 info->number_of_objects_with_fast_elements_++; | 811 info->number_of_objects_with_fast_elements_++; |
| 808 int holes = 0; | 812 int holes = 0; |
| 809 FixedArray* e = FixedArray::cast(elements()); | 813 FixedArray* e = FixedArray::cast(elements()); |
| 810 int len = e->length(); | 814 int len = e->length(); |
| 811 Heap* heap = HEAP; | 815 Heap* heap = HEAP; |
| 812 for (int i = 0; i < len; i++) { | 816 for (int i = 0; i < len; i++) { |
| 813 if (e->get(i) == heap->the_hole_value()) holes++; | 817 if (e->get(i) == heap->the_hole_value()) holes++; |
| 814 } | 818 } |
| 815 info->number_of_fast_used_elements_ += len - holes; | 819 info->number_of_fast_used_elements_ += len - holes; |
| 816 info->number_of_fast_unused_elements_ += holes; | 820 info->number_of_fast_unused_elements_ += holes; |
| 817 break; | 821 break; |
| 818 } | 822 } |
| 823 case EXTERNAL_BYTE_ELEMENTS: |
| 824 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 825 case EXTERNAL_SHORT_ELEMENTS: |
| 826 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 827 case EXTERNAL_INT_ELEMENTS: |
| 828 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 829 case EXTERNAL_FLOAT_ELEMENTS: |
| 830 case EXTERNAL_DOUBLE_ELEMENTS: |
| 819 case EXTERNAL_PIXEL_ELEMENTS: { | 831 case EXTERNAL_PIXEL_ELEMENTS: { |
| 820 info->number_of_objects_with_fast_elements_++; | 832 info->number_of_objects_with_fast_elements_++; |
| 821 ExternalPixelArray* e = ExternalPixelArray::cast(elements()); | 833 ExternalPixelArray* e = ExternalPixelArray::cast(elements()); |
| 822 info->number_of_fast_used_elements_ += e->length(); | 834 info->number_of_fast_used_elements_ += e->length(); |
| 823 break; | 835 break; |
| 824 } | 836 } |
| 825 case DICTIONARY_ELEMENTS: { | 837 case DICTIONARY_ELEMENTS: { |
| 826 SeededNumberDictionary* dict = element_dictionary(); | 838 SeededNumberDictionary* dict = element_dictionary(); |
| 827 info->number_of_slow_used_elements_ += dict->NumberOfElements(); | 839 info->number_of_slow_used_elements_ += dict->NumberOfElements(); |
| 828 info->number_of_slow_unused_elements_ += | 840 info->number_of_slow_unused_elements_ += |
| 829 dict->Capacity() - dict->NumberOfElements(); | 841 dict->Capacity() - dict->NumberOfElements(); |
| 830 break; | 842 break; |
| 831 } | 843 } |
| 832 default: | 844 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 833 UNREACHABLE(); | |
| 834 break; | 845 break; |
| 835 } | 846 } |
| 836 } | 847 } |
| 837 | 848 |
| 838 | 849 |
| 839 void JSObject::SpillInformation::Clear() { | 850 void JSObject::SpillInformation::Clear() { |
| 840 number_of_objects_ = 0; | 851 number_of_objects_ = 0; |
| 841 number_of_objects_with_fast_properties_ = 0; | 852 number_of_objects_with_fast_properties_ = 0; |
| 842 number_of_objects_with_fast_elements_ = 0; | 853 number_of_objects_with_fast_elements_ = 0; |
| 843 number_of_fast_used_fields_ = 0; | 854 number_of_fast_used_fields_ = 0; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 ASSERT(e->IsUndefined()); | 942 ASSERT(e->IsUndefined()); |
| 932 } | 943 } |
| 933 } | 944 } |
| 934 } | 945 } |
| 935 } | 946 } |
| 936 | 947 |
| 937 | 948 |
| 938 #endif // DEBUG | 949 #endif // DEBUG |
| 939 | 950 |
| 940 } } // namespace v8::internal | 951 } } // namespace v8::internal |
| OLD | NEW |