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

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

Issue 12210083: Renamed "symbols" to "internalized strings" throughout the code base, (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Yang's comments Created 7 years, 10 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-inl.h ('k') | src/parser.cc » ('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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 PrintElements(out); 470 PrintElements(out);
471 PrintF(out, " }\n"); 471 PrintF(out, " }\n");
472 } 472 }
473 473
474 474
475 static const char* TypeToString(InstanceType type) { 475 static const char* TypeToString(InstanceType type) {
476 switch (type) { 476 switch (type) {
477 case INVALID_TYPE: return "INVALID"; 477 case INVALID_TYPE: return "INVALID";
478 case MAP_TYPE: return "MAP"; 478 case MAP_TYPE: return "MAP";
479 case HEAP_NUMBER_TYPE: return "HEAP_NUMBER"; 479 case HEAP_NUMBER_TYPE: return "HEAP_NUMBER";
480 case SYMBOL_TYPE: return "SYMBOL"; 480 case STRING_TYPE: return "TWO_BYTE_STRING";
481 case ASCII_SYMBOL_TYPE: return "ASCII_SYMBOL";
482 case CONS_SYMBOL_TYPE: return "CONS_SYMBOL";
483 case CONS_ASCII_SYMBOL_TYPE: return "CONS_ASCII_SYMBOL";
484 case EXTERNAL_ASCII_SYMBOL_TYPE:
485 case EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE:
486 case EXTERNAL_SYMBOL_TYPE: return "EXTERNAL_SYMBOL";
487 case SHORT_EXTERNAL_ASCII_SYMBOL_TYPE:
488 case SHORT_EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE:
489 case SHORT_EXTERNAL_SYMBOL_TYPE: return "SHORT_EXTERNAL_SYMBOL";
490 case ASCII_STRING_TYPE: return "ASCII_STRING"; 481 case ASCII_STRING_TYPE: return "ASCII_STRING";
491 case STRING_TYPE: return "TWO_BYTE_STRING";
492 case CONS_STRING_TYPE: 482 case CONS_STRING_TYPE:
493 case CONS_ASCII_STRING_TYPE: return "CONS_STRING"; 483 case CONS_ASCII_STRING_TYPE:
484 return "CONS_STRING";
485 case EXTERNAL_STRING_TYPE:
494 case EXTERNAL_ASCII_STRING_TYPE: 486 case EXTERNAL_ASCII_STRING_TYPE:
495 case EXTERNAL_STRING_WITH_ASCII_DATA_TYPE: 487 case EXTERNAL_STRING_WITH_ASCII_DATA_TYPE:
496 case EXTERNAL_STRING_TYPE: return "EXTERNAL_STRING"; 488 return "EXTERNAL_STRING";
489 case SHORT_EXTERNAL_STRING_TYPE:
497 case SHORT_EXTERNAL_ASCII_STRING_TYPE: 490 case SHORT_EXTERNAL_ASCII_STRING_TYPE:
498 case SHORT_EXTERNAL_STRING_WITH_ASCII_DATA_TYPE: 491 case SHORT_EXTERNAL_STRING_WITH_ASCII_DATA_TYPE:
499 case SHORT_EXTERNAL_STRING_TYPE: return "SHORT_EXTERNAL_STRING"; 492 return "SHORT_EXTERNAL_STRING";
493 case INTERNALIZED_STRING_TYPE: return "INTERNALIZED_STRING";
494 case ASCII_INTERNALIZED_STRING_TYPE: return "ASCII_INTERNALIZED_STRING";
495 case CONS_INTERNALIZED_STRING_TYPE: return "CONS_INTERNALIZED_STRING";
496 case CONS_ASCII_INTERNALIZED_STRING_TYPE:
497 return "CONS_ASCII_INTERNALIZED_STRING";
498 case EXTERNAL_INTERNALIZED_STRING_TYPE:
499 case EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE:
500 case EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE:
501 return "EXTERNAL_INTERNALIZED_STRING";
502 case SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE:
503 case SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE:
504 case SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE:
505 return "SHORT_EXTERNAL_INTERNALIZED_STRING";
500 case FIXED_ARRAY_TYPE: return "FIXED_ARRAY"; 506 case FIXED_ARRAY_TYPE: return "FIXED_ARRAY";
501 case BYTE_ARRAY_TYPE: return "BYTE_ARRAY"; 507 case BYTE_ARRAY_TYPE: return "BYTE_ARRAY";
502 case FREE_SPACE_TYPE: return "FREE_SPACE"; 508 case FREE_SPACE_TYPE: return "FREE_SPACE";
503 case EXTERNAL_PIXEL_ARRAY_TYPE: return "EXTERNAL_PIXEL_ARRAY"; 509 case EXTERNAL_PIXEL_ARRAY_TYPE: return "EXTERNAL_PIXEL_ARRAY";
504 case EXTERNAL_BYTE_ARRAY_TYPE: return "EXTERNAL_BYTE_ARRAY"; 510 case EXTERNAL_BYTE_ARRAY_TYPE: return "EXTERNAL_BYTE_ARRAY";
505 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: 511 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
506 return "EXTERNAL_UNSIGNED_BYTE_ARRAY"; 512 return "EXTERNAL_UNSIGNED_BYTE_ARRAY";
507 case EXTERNAL_SHORT_ARRAY_TYPE: return "EXTERNAL_SHORT_ARRAY"; 513 case EXTERNAL_SHORT_ARRAY_TYPE: return "EXTERNAL_SHORT_ARRAY";
508 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: 514 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
509 return "EXTERNAL_UNSIGNED_SHORT_ARRAY"; 515 return "EXTERNAL_UNSIGNED_SHORT_ARRAY";
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 script()->ShortPrint(out); 667 script()->ShortPrint(out);
662 PrintF(out, "\n - stack_trace: "); 668 PrintF(out, "\n - stack_trace: ");
663 stack_trace()->ShortPrint(out); 669 stack_trace()->ShortPrint(out);
664 PrintF(out, "\n - stack_frames: "); 670 PrintF(out, "\n - stack_frames: ");
665 stack_frames()->ShortPrint(out); 671 stack_frames()->ShortPrint(out);
666 PrintF(out, "\n"); 672 PrintF(out, "\n");
667 } 673 }
668 674
669 675
670 void String::StringPrint(FILE* out) { 676 void String::StringPrint(FILE* out) {
671 if (StringShape(this).IsSymbol()) { 677 if (StringShape(this).IsInternalized()) {
672 PrintF(out, "#"); 678 PrintF(out, "#");
673 } else if (StringShape(this).IsCons()) { 679 } else if (StringShape(this).IsCons()) {
674 PrintF(out, "c\""); 680 PrintF(out, "c\"");
675 } else { 681 } else {
676 PrintF(out, "\""); 682 PrintF(out, "\"");
677 } 683 }
678 684
679 const char truncated_epilogue[] = "...<truncated>"; 685 const char truncated_epilogue[] = "...<truncated>";
680 int len = length(); 686 int len = length();
681 if (!FLAG_use_verbose_printer) { 687 if (!FLAG_use_verbose_printer) {
682 if (len > 100) { 688 if (len > 100) {
683 len = 100 - sizeof(truncated_epilogue); 689 len = 100 - sizeof(truncated_epilogue);
684 } 690 }
685 } 691 }
686 for (int i = 0; i < len; i++) { 692 for (int i = 0; i < len; i++) {
687 PrintF(out, "%c", Get(i)); 693 PrintF(out, "%c", Get(i));
688 } 694 }
689 if (len != length()) { 695 if (len != length()) {
690 PrintF(out, "%s", truncated_epilogue); 696 PrintF(out, "%s", truncated_epilogue);
691 } 697 }
692 698
693 if (!StringShape(this).IsSymbol()) PrintF(out, "\""); 699 if (!StringShape(this).IsInternalized()) PrintF(out, "\"");
694 } 700 }
695 701
696 702
697 // This method is only meant to be called from gdb for debugging purposes. 703 // This method is only meant to be called from gdb for debugging purposes.
698 // Since the string can also be in two-byte encoding, non-ASCII characters 704 // Since the string can also be in two-byte encoding, non-ASCII characters
699 // will be ignored in the output. 705 // will be ignored in the output.
700 char* String::ToAsciiArray() { 706 char* String::ToAsciiArray() {
701 // Static so that subsequent calls frees previously allocated space. 707 // Static so that subsequent calls frees previously allocated space.
702 // This also means that previous results will be overwritten. 708 // This also means that previous results will be overwritten.
703 static char* buffer = NULL; 709 static char* buffer = NULL;
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 } 1121 }
1116 } 1122 }
1117 PrintF(out, "\n"); 1123 PrintF(out, "\n");
1118 } 1124 }
1119 1125
1120 1126
1121 #endif // OBJECT_PRINT 1127 #endif // OBJECT_PRINT
1122 1128
1123 1129
1124 } } // namespace v8::internal 1130 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698