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

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

Issue 20705003: Fix printing of Harmony Set and Map instances. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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 | « no previous file | no next file » | 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 break; 173 break;
174 case CODE_TYPE: 174 case CODE_TYPE:
175 Code::cast(this)->CodePrint(out); 175 Code::cast(this)->CodePrint(out);
176 break; 176 break;
177 case JS_PROXY_TYPE: 177 case JS_PROXY_TYPE:
178 JSProxy::cast(this)->JSProxyPrint(out); 178 JSProxy::cast(this)->JSProxyPrint(out);
179 break; 179 break;
180 case JS_FUNCTION_PROXY_TYPE: 180 case JS_FUNCTION_PROXY_TYPE:
181 JSFunctionProxy::cast(this)->JSFunctionProxyPrint(out); 181 JSFunctionProxy::cast(this)->JSFunctionProxyPrint(out);
182 break; 182 break;
183 case JS_SET_TYPE:
184 JSSet::cast(this)->JSSetPrint(out);
185 break;
186 case JS_MAP_TYPE:
187 JSMap::cast(this)->JSMapPrint(out);
188 break;
183 case JS_WEAK_MAP_TYPE: 189 case JS_WEAK_MAP_TYPE:
184 JSWeakMap::cast(this)->JSWeakMapPrint(out); 190 JSWeakMap::cast(this)->JSWeakMapPrint(out);
185 break; 191 break;
186 case JS_WEAK_SET_TYPE: 192 case JS_WEAK_SET_TYPE:
187 JSWeakSet::cast(this)->JSWeakSetPrint(out); 193 JSWeakSet::cast(this)->JSWeakSetPrint(out);
188 break; 194 break;
189 case FOREIGN_TYPE: 195 case FOREIGN_TYPE:
190 Foreign::cast(this)->ForeignPrint(out); 196 Foreign::cast(this)->ForeignPrint(out);
191 break; 197 break;
192 case SHARED_FUNCTION_INFO_TYPE: 198 case SHARED_FUNCTION_INFO_TYPE:
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 PrintF(out, " {\n"); 487 PrintF(out, " {\n");
482 PrintProperties(out); 488 PrintProperties(out);
483 PrintTransitions(out); 489 PrintTransitions(out);
484 PrintElements(out); 490 PrintElements(out);
485 PrintF(out, " }\n"); 491 PrintF(out, " }\n");
486 } 492 }
487 493
488 494
489 void JSModule::JSModulePrint(FILE* out) { 495 void JSModule::JSModulePrint(FILE* out) {
490 HeapObject::PrintHeader(out, "JSModule"); 496 HeapObject::PrintHeader(out, "JSModule");
491 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); 497 PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
492 PrintF(out, " - context = "); 498 PrintF(out, " - context = ");
493 context()->Print(out); 499 context()->Print(out);
494 PrintF(out, " - scope_info = "); 500 PrintF(out, " - scope_info = ");
495 scope_info()->ShortPrint(out); 501 scope_info()->ShortPrint(out);
496 PrintElementsKind(out, this->map()->elements_kind()); 502 PrintElementsKind(out, this->map()->elements_kind());
497 PrintF(out, " {\n"); 503 PrintF(out, " {\n");
498 PrintProperties(out); 504 PrintProperties(out);
499 PrintElements(out); 505 PrintElements(out);
500 PrintF(out, " }\n"); 506 PrintF(out, " }\n");
501 } 507 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 case ODDBALL_TYPE: return "ODDBALL"; 560 case ODDBALL_TYPE: return "ODDBALL";
555 case CELL_TYPE: return "CELL"; 561 case CELL_TYPE: return "CELL";
556 case PROPERTY_CELL_TYPE: return "PROPERTY_CELL"; 562 case PROPERTY_CELL_TYPE: return "PROPERTY_CELL";
557 case SHARED_FUNCTION_INFO_TYPE: return "SHARED_FUNCTION_INFO"; 563 case SHARED_FUNCTION_INFO_TYPE: return "SHARED_FUNCTION_INFO";
558 case JS_GENERATOR_OBJECT_TYPE: return "JS_GENERATOR_OBJECT"; 564 case JS_GENERATOR_OBJECT_TYPE: return "JS_GENERATOR_OBJECT";
559 case JS_MODULE_TYPE: return "JS_MODULE"; 565 case JS_MODULE_TYPE: return "JS_MODULE";
560 case JS_FUNCTION_TYPE: return "JS_FUNCTION"; 566 case JS_FUNCTION_TYPE: return "JS_FUNCTION";
561 case CODE_TYPE: return "CODE"; 567 case CODE_TYPE: return "CODE";
562 case JS_ARRAY_TYPE: return "JS_ARRAY"; 568 case JS_ARRAY_TYPE: return "JS_ARRAY";
563 case JS_PROXY_TYPE: return "JS_PROXY"; 569 case JS_PROXY_TYPE: return "JS_PROXY";
570 case JS_SET_TYPE: return "JS_SET";
571 case JS_MAP_TYPE: return "JS_MAP";
564 case JS_WEAK_MAP_TYPE: return "JS_WEAK_MAP"; 572 case JS_WEAK_MAP_TYPE: return "JS_WEAK_MAP";
565 case JS_WEAK_SET_TYPE: return "JS_WEAK_SET"; 573 case JS_WEAK_SET_TYPE: return "JS_WEAK_SET";
566 case JS_REGEXP_TYPE: return "JS_REGEXP"; 574 case JS_REGEXP_TYPE: return "JS_REGEXP";
567 case JS_VALUE_TYPE: return "JS_VALUE"; 575 case JS_VALUE_TYPE: return "JS_VALUE";
568 case JS_GLOBAL_OBJECT_TYPE: return "JS_GLOBAL_OBJECT"; 576 case JS_GLOBAL_OBJECT_TYPE: return "JS_GLOBAL_OBJECT";
569 case JS_BUILTINS_OBJECT_TYPE: return "JS_BUILTINS_OBJECT"; 577 case JS_BUILTINS_OBJECT_TYPE: return "JS_BUILTINS_OBJECT";
570 case JS_GLOBAL_PROXY_TYPE: return "JS_GLOBAL_PROXY"; 578 case JS_GLOBAL_PROXY_TYPE: return "JS_GLOBAL_PROXY";
571 case JS_ARRAY_BUFFER_TYPE: return "JS_ARRAY_BUFFER"; 579 case JS_ARRAY_BUFFER_TYPE: return "JS_ARRAY_BUFFER";
572 case JS_TYPED_ARRAY_TYPE: return "JS_TYPED_ARRAY"; 580 case JS_TYPED_ARRAY_TYPE: return "JS_TYPED_ARRAY";
573 case JS_DATA_VIEW_TYPE: return "JS_DATA_VIEW"; 581 case JS_DATA_VIEW_TYPE: return "JS_DATA_VIEW";
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 } 778 }
771 779
772 780
773 static const char* const weekdays[] = { 781 static const char* const weekdays[] = {
774 "???", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 782 "???", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
775 }; 783 };
776 784
777 785
778 void JSDate::JSDatePrint(FILE* out) { 786 void JSDate::JSDatePrint(FILE* out) {
779 HeapObject::PrintHeader(out, "JSDate"); 787 HeapObject::PrintHeader(out, "JSDate");
780 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); 788 PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
781 PrintF(out, " - value = "); 789 PrintF(out, " - value = ");
782 value()->Print(out); 790 value()->Print(out);
783 if (!year()->IsSmi()) { 791 if (!year()->IsSmi()) {
784 PrintF(out, " - time = NaN\n"); 792 PrintF(out, " - time = NaN\n");
785 } else { 793 } else {
786 PrintF(out, " - time = %s %04d/%02d/%02d %02d:%02d:%02d\n", 794 PrintF(out, " - time = %s %04d/%02d/%02d %02d:%02d:%02d\n",
787 weekdays[weekday()->IsSmi() ? Smi::cast(weekday())->value() + 1 : 0], 795 weekdays[weekday()->IsSmi() ? Smi::cast(weekday())->value() + 1 : 0],
788 year()->IsSmi() ? Smi::cast(year())->value() : -1, 796 year()->IsSmi() ? Smi::cast(year())->value() : -1,
789 month()->IsSmi() ? Smi::cast(month())->value() : -1, 797 month()->IsSmi() ? Smi::cast(month())->value() : -1,
790 day()->IsSmi() ? Smi::cast(day())->value() : -1, 798 day()->IsSmi() ? Smi::cast(day())->value() : -1,
791 hour()->IsSmi() ? Smi::cast(hour())->value() : -1, 799 hour()->IsSmi() ? Smi::cast(hour())->value() : -1,
792 min()->IsSmi() ? Smi::cast(min())->value() : -1, 800 min()->IsSmi() ? Smi::cast(min())->value() : -1,
793 sec()->IsSmi() ? Smi::cast(sec())->value() : -1); 801 sec()->IsSmi() ? Smi::cast(sec())->value() : -1);
794 } 802 }
795 } 803 }
796 804
797 805
798 void JSProxy::JSProxyPrint(FILE* out) { 806 void JSProxy::JSProxyPrint(FILE* out) {
799 HeapObject::PrintHeader(out, "JSProxy"); 807 HeapObject::PrintHeader(out, "JSProxy");
800 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); 808 PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
801 PrintF(out, " - handler = "); 809 PrintF(out, " - handler = ");
802 handler()->Print(out); 810 handler()->Print(out);
803 PrintF(out, " - hash = "); 811 PrintF(out, " - hash = ");
804 hash()->Print(out); 812 hash()->Print(out);
805 PrintF(out, "\n"); 813 PrintF(out, "\n");
806 } 814 }
807 815
808 816
809 void JSFunctionProxy::JSFunctionProxyPrint(FILE* out) { 817 void JSFunctionProxy::JSFunctionProxyPrint(FILE* out) {
810 HeapObject::PrintHeader(out, "JSFunctionProxy"); 818 HeapObject::PrintHeader(out, "JSFunctionProxy");
811 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); 819 PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
812 PrintF(out, " - handler = "); 820 PrintF(out, " - handler = ");
813 handler()->Print(out); 821 handler()->Print(out);
814 PrintF(out, " - call_trap = "); 822 PrintF(out, " - call_trap = ");
815 call_trap()->Print(out); 823 call_trap()->Print(out);
816 PrintF(out, " - construct_trap = "); 824 PrintF(out, " - construct_trap = ");
817 construct_trap()->Print(out); 825 construct_trap()->Print(out);
818 PrintF(out, "\n"); 826 PrintF(out, "\n");
819 } 827 }
820 828
821 829
830 void JSSet::JSSetPrint(FILE* out) {
831 HeapObject::PrintHeader(out, "JSSet");
832 PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
833 PrintF(out, " - table = ");
834 table()->ShortPrint(out);
835 PrintF(out, "\n");
836 }
837
838
839 void JSMap::JSMapPrint(FILE* out) {
840 HeapObject::PrintHeader(out, "JSMap");
841 PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
842 PrintF(out, " - table = ");
843 table()->ShortPrint(out);
844 PrintF(out, "\n");
845 }
846
847
822 void JSWeakMap::JSWeakMapPrint(FILE* out) { 848 void JSWeakMap::JSWeakMapPrint(FILE* out) {
823 HeapObject::PrintHeader(out, "JSWeakMap"); 849 HeapObject::PrintHeader(out, "JSWeakMap");
824 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); 850 PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
825 PrintF(out, " - table = "); 851 PrintF(out, " - table = ");
826 table()->ShortPrint(out); 852 table()->ShortPrint(out);
827 PrintF(out, "\n"); 853 PrintF(out, "\n");
828 } 854 }
829 855
830 856
831 void JSWeakSet::JSWeakSetPrint(FILE* out) { 857 void JSWeakSet::JSWeakSetPrint(FILE* out) {
832 HeapObject::PrintHeader(out, "JSWeakSet"); 858 HeapObject::PrintHeader(out, "JSWeakSet");
833 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); 859 PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
834 PrintF(out, " - table = "); 860 PrintF(out, " - table = ");
835 table()->ShortPrint(out); 861 table()->ShortPrint(out);
836 PrintF(out, "\n"); 862 PrintF(out, "\n");
837 } 863 }
838 864
839 865
840 void JSArrayBuffer::JSArrayBufferPrint(FILE* out) { 866 void JSArrayBuffer::JSArrayBufferPrint(FILE* out) {
841 HeapObject::PrintHeader(out, "JSArrayBuffer"); 867 HeapObject::PrintHeader(out, "JSArrayBuffer");
842 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); 868 PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
843 PrintF(out, " - backing_store = -0x%p\n", backing_store()); 869 PrintF(out, " - backing_store = %p\n", backing_store());
844 PrintF(out, " - byte_length = "); 870 PrintF(out, " - byte_length = ");
845 byte_length()->ShortPrint(out); 871 byte_length()->ShortPrint(out);
846 PrintF(out, "\n"); 872 PrintF(out, "\n");
847 } 873 }
848 874
849 875
850 void JSTypedArray::JSTypedArrayPrint(FILE* out) { 876 void JSTypedArray::JSTypedArrayPrint(FILE* out) {
851 HeapObject::PrintHeader(out, "JSTypedArray"); 877 HeapObject::PrintHeader(out, "JSTypedArray");
852 PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map())); 878 PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
853 PrintF(out, " - buffer ="); 879 PrintF(out, " - buffer =");
(...skipping 17 matching lines...) Expand all
871 PrintF(out, "\n - byte_offset = "); 897 PrintF(out, "\n - byte_offset = ");
872 byte_offset()->ShortPrint(out); 898 byte_offset()->ShortPrint(out);
873 PrintF(out, "\n - byte_length = "); 899 PrintF(out, "\n - byte_length = ");
874 byte_length()->ShortPrint(out); 900 byte_length()->ShortPrint(out);
875 PrintF("\n"); 901 PrintF("\n");
876 } 902 }
877 903
878 904
879 void JSFunction::JSFunctionPrint(FILE* out) { 905 void JSFunction::JSFunctionPrint(FILE* out) {
880 HeapObject::PrintHeader(out, "Function"); 906 HeapObject::PrintHeader(out, "Function");
881 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); 907 PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
882 PrintF(out, " - initial_map = "); 908 PrintF(out, " - initial_map = ");
883 if (has_initial_map()) { 909 if (has_initial_map()) {
884 initial_map()->ShortPrint(out); 910 initial_map()->ShortPrint(out);
885 } 911 }
886 PrintF(out, "\n - shared_info = "); 912 PrintF(out, "\n - shared_info = ");
887 shared()->ShortPrint(out); 913 shared()->ShortPrint(out);
888 PrintF(out, "\n - name = "); 914 PrintF(out, "\n - name = ");
889 shared()->name()->Print(out); 915 shared()->name()->Print(out);
890 PrintF(out, "\n - context = "); 916 PrintF(out, "\n - context = ");
891 context()->ShortPrint(out); 917 context()->ShortPrint(out);
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 } 1304 }
1279 } 1305 }
1280 PrintF(out, "\n"); 1306 PrintF(out, "\n");
1281 } 1307 }
1282 1308
1283 1309
1284 #endif // OBJECT_PRINT 1310 #endif // OBJECT_PRINT
1285 1311
1286 1312
1287 } } // namespace v8::internal 1313 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698