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

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

Issue 10909007: Sharing of descriptor arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 8 years, 3 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 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 number_of_fast_used_elements_, number_of_fast_unused_elements_); 894 number_of_fast_used_elements_, number_of_fast_unused_elements_);
895 895
896 PrintF(" - slow elements (#%d): %d (used) %d (unused)\n", 896 PrintF(" - slow elements (#%d): %d (used) %d (unused)\n",
897 number_of_objects_ - number_of_objects_with_fast_elements_, 897 number_of_objects_ - number_of_objects_with_fast_elements_,
898 number_of_slow_used_elements_, number_of_slow_unused_elements_); 898 number_of_slow_used_elements_, number_of_slow_unused_elements_);
899 899
900 PrintF("\n"); 900 PrintF("\n");
901 } 901 }
902 902
903 903
904 bool DescriptorArray::IsSortedNoDuplicates() { 904 bool DescriptorArray::IsSortedNoDuplicates(int valid_entries) {
905 if (valid_entries == -1) valid_entries = number_of_descriptors();
905 String* current_key = NULL; 906 String* current_key = NULL;
906 uint32_t current = 0; 907 uint32_t current = 0;
907 for (int i = 0; i < number_of_descriptors(); i++) { 908 for (int i = 0; i < valid_entries; i++) {
908 String* key = GetSortedKey(i); 909 String* key = GetSortedKey(i);
909 if (key == current_key) { 910 if (key == current_key) {
910 PrintDescriptors(); 911 PrintDescriptors();
911 return false; 912 return false;
912 } 913 }
913 current_key = key; 914 current_key = key;
914 uint32_t hash = GetSortedKey(i)->Hash(); 915 uint32_t hash = GetSortedKey(i)->Hash();
915 if (hash < current) { 916 if (hash < current) {
916 PrintDescriptors(); 917 PrintDescriptors();
917 return false; 918 return false;
918 } 919 }
919 current = hash; 920 current = hash;
920 } 921 }
921 return true; 922 return true;
922 } 923 }
923 924
924 925
925 bool TransitionArray::IsSortedNoDuplicates() { 926 bool TransitionArray::IsSortedNoDuplicates(int valid_entries) {
927 ASSERT(valid_entries == -1);
926 String* current_key = NULL; 928 String* current_key = NULL;
927 uint32_t current = 0; 929 uint32_t current = 0;
928 for (int i = 0; i < number_of_transitions(); i++) { 930 for (int i = 0; i < number_of_transitions(); i++) {
929 String* key = GetSortedKey(i); 931 String* key = GetSortedKey(i);
930 if (key == current_key) { 932 if (key == current_key) {
931 PrintTransitions(); 933 PrintTransitions();
932 return false; 934 return false;
933 } 935 }
934 current_key = key; 936 current_key = key;
935 uint32_t hash = GetSortedKey(i)->Hash(); 937 uint32_t hash = GetSortedKey(i)->Hash();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 FixedArray* proto_transitions = GetPrototypeTransitions(); 1015 FixedArray* proto_transitions = GetPrototypeTransitions();
1014 MemsetPointer(proto_transitions->data_start(), 1016 MemsetPointer(proto_transitions->data_start(),
1015 GetHeap()->the_hole_value(), 1017 GetHeap()->the_hole_value(),
1016 proto_transitions->length()); 1018 proto_transitions->length());
1017 } 1019 }
1018 1020
1019 1021
1020 #endif // DEBUG 1022 #endif // DEBUG
1021 1023
1022 } } // namespace v8::internal 1024 } } // 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