Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Side by Side Diff: src/objects-debug.cc

Issue 10170030: Implement tracking and optimizations of packed arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 FixedArray* proto_transitions = prototype_transitions(); 1021 FixedArray* proto_transitions = prototype_transitions();
1011 MemsetPointer(proto_transitions->data_start(), 1022 MemsetPointer(proto_transitions->data_start(),
1012 GetHeap()->the_hole_value(), 1023 GetHeap()->the_hole_value(),
1013 proto_transitions->length()); 1024 proto_transitions->length());
1014 } 1025 }
1015 1026
1016 1027
1017 #endif // DEBUG 1028 #endif // DEBUG
1018 1029
1019 } } // namespace v8::internal 1030 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698