OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 } | 620 } |
621 if (len != length()) { | 621 if (len != length()) { |
622 PrintF(out, "%s", truncated_epilogue); | 622 PrintF(out, "%s", truncated_epilogue); |
623 } | 623 } |
624 | 624 |
625 if (!StringShape(this).IsSymbol()) PrintF(out, "\""); | 625 if (!StringShape(this).IsSymbol()) PrintF(out, "\""); |
626 } | 626 } |
627 | 627 |
628 | 628 |
629 // This method is only meant to be called from gdb for debugging purposes. | 629 // This method is only meant to be called from gdb for debugging purposes. |
630 // Since the string can also be in two-byte encoding, non-ascii characters | 630 // Since the string can also be in two-byte encoding, non-ASCII characters |
631 // will be ignored in the output. | 631 // will be ignored in the output. |
632 char* String::ToAsciiArray() { | 632 char* String::ToAsciiArray() { |
633 // Static so that subsequent calls frees previously allocated space. | 633 // Static so that subsequent calls frees previously allocated space. |
634 // This also means that previous results will be overwritten. | 634 // This also means that previous results will be overwritten. |
635 static char* buffer = NULL; | 635 static char* buffer = NULL; |
636 if (buffer != NULL) free(buffer); | 636 if (buffer != NULL) free(buffer); |
637 buffer = new char[length()+1]; | 637 buffer = new char[length()+1]; |
638 WriteToFlat(this, buffer, 0, length()); | 638 WriteToFlat(this, buffer, 0, length()); |
639 buffer[length()] = 0; | 639 buffer[length()] = 0; |
640 return buffer; | 640 return buffer; |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 desc.Print(out); | 965 desc.Print(out); |
966 } | 966 } |
967 PrintF(out, "\n"); | 967 PrintF(out, "\n"); |
968 } | 968 } |
969 | 969 |
970 | 970 |
971 #endif // OBJECT_PRINT | 971 #endif // OBJECT_PRINT |
972 | 972 |
973 | 973 |
974 } } // namespace v8::internal | 974 } } // namespace v8::internal |
OLD | NEW |