| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 | 737 |
| 738 void Proxy::ProxyPrint() { | 738 void Proxy::ProxyPrint() { |
| 739 PrintF("proxy to %p", proxy()); | 739 PrintF("proxy to %p", proxy()); |
| 740 } | 740 } |
| 741 | 741 |
| 742 | 742 |
| 743 void Proxy::ProxyVerify() { | 743 void Proxy::ProxyVerify() { |
| 744 ASSERT(IsProxy()); | 744 ASSERT(IsProxy()); |
| 745 } | 745 } |
| 746 | 746 |
| 747 | 747 template<typename Shape, typename Key> |
| 748 void Dictionary::Print() { | 748 void Dictionary<Shape, Key>::Print() { |
| 749 int capacity = Capacity(); | 749 int capacity = HashTable<Shape, Key>::Capacity(); |
| 750 for (int i = 0; i < capacity; i++) { | 750 for (int i = 0; i < capacity; i++) { |
| 751 Object* k = KeyAt(i); | 751 Object* k = HashTable<Shape, Key>::KeyAt(i); |
| 752 if (IsKey(k)) { | 752 if (HashTable<Shape, Key>::IsKey(k)) { |
| 753 PrintF(" "); | 753 PrintF(" "); |
| 754 if (k->IsString()) { | 754 if (k->IsString()) { |
| 755 String::cast(k)->StringPrint(); | 755 String::cast(k)->StringPrint(); |
| 756 } else { | 756 } else { |
| 757 k->ShortPrint(); | 757 k->ShortPrint(); |
| 758 } | 758 } |
| 759 PrintF(": "); | 759 PrintF(": "); |
| 760 ValueAt(i)->ShortPrint(); | 760 ValueAt(i)->ShortPrint(); |
| 761 PrintF("\n"); | 761 PrintF("\n"); |
| 762 } | 762 } |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 | 1010 |
| 1011 | 1011 |
| 1012 void JSObject::IncrementSpillStatistics(SpillInformation* info) { | 1012 void JSObject::IncrementSpillStatistics(SpillInformation* info) { |
| 1013 info->number_of_objects_++; | 1013 info->number_of_objects_++; |
| 1014 // Named properties | 1014 // Named properties |
| 1015 if (HasFastProperties()) { | 1015 if (HasFastProperties()) { |
| 1016 info->number_of_objects_with_fast_properties_++; | 1016 info->number_of_objects_with_fast_properties_++; |
| 1017 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); | 1017 info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); |
| 1018 info->number_of_fast_unused_fields_ += map()->unused_property_fields(); | 1018 info->number_of_fast_unused_fields_ += map()->unused_property_fields(); |
| 1019 } else { | 1019 } else { |
| 1020 Dictionary* dict = property_dictionary(); | 1020 StringDictionary* dict = property_dictionary(); |
| 1021 info->number_of_slow_used_properties_ += dict->NumberOfElements(); | 1021 info->number_of_slow_used_properties_ += dict->NumberOfElements(); |
| 1022 info->number_of_slow_unused_properties_ += | 1022 info->number_of_slow_unused_properties_ += |
| 1023 dict->Capacity() - dict->NumberOfElements(); | 1023 dict->Capacity() - dict->NumberOfElements(); |
| 1024 } | 1024 } |
| 1025 // Indexed properties | 1025 // Indexed properties |
| 1026 if (HasFastElements()) { | 1026 if (HasFastElements()) { |
| 1027 info->number_of_objects_with_fast_elements_++; | 1027 info->number_of_objects_with_fast_elements_++; |
| 1028 int holes = 0; | 1028 int holes = 0; |
| 1029 FixedArray* e = FixedArray::cast(elements()); | 1029 FixedArray* e = FixedArray::cast(elements()); |
| 1030 int len = e->length(); | 1030 int len = e->length(); |
| 1031 for (int i = 0; i < len; i++) { | 1031 for (int i = 0; i < len; i++) { |
| 1032 if (e->get(i) == Heap::the_hole_value()) holes++; | 1032 if (e->get(i) == Heap::the_hole_value()) holes++; |
| 1033 } | 1033 } |
| 1034 info->number_of_fast_used_elements_ += len - holes; | 1034 info->number_of_fast_used_elements_ += len - holes; |
| 1035 info->number_of_fast_unused_elements_ += holes; | 1035 info->number_of_fast_unused_elements_ += holes; |
| 1036 } else { | 1036 } else { |
| 1037 Dictionary* dict = element_dictionary(); | 1037 NumberDictionary* dict = element_dictionary(); |
| 1038 info->number_of_slow_used_elements_ += dict->NumberOfElements(); | 1038 info->number_of_slow_used_elements_ += dict->NumberOfElements(); |
| 1039 info->number_of_slow_unused_elements_ += | 1039 info->number_of_slow_unused_elements_ += |
| 1040 dict->Capacity() - dict->NumberOfElements(); | 1040 dict->Capacity() - dict->NumberOfElements(); |
| 1041 } | 1041 } |
| 1042 } | 1042 } |
| 1043 | 1043 |
| 1044 | 1044 |
| 1045 void JSObject::SpillInformation::Clear() { | 1045 void JSObject::SpillInformation::Clear() { |
| 1046 number_of_objects_ = 0; | 1046 number_of_objects_ = 0; |
| 1047 number_of_objects_with_fast_properties_ = 0; | 1047 number_of_objects_with_fast_properties_ = 0; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 } | 1109 } |
| 1110 current = hash; | 1110 current = hash; |
| 1111 } | 1111 } |
| 1112 return true; | 1112 return true; |
| 1113 } | 1113 } |
| 1114 | 1114 |
| 1115 | 1115 |
| 1116 #endif // DEBUG | 1116 #endif // DEBUG |
| 1117 | 1117 |
| 1118 } } // namespace v8::internal | 1118 } } // namespace v8::internal |
| OLD | NEW |