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

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

Issue 7461126: Removing String::ToAsciiArray() since String::ToCString does a better job. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 | « src/objects.h ('k') | 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 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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 PrintF(out, "%c", Get(i)); 557 PrintF(out, "%c", Get(i));
558 } 558 }
559 if (len != length()) { 559 if (len != length()) {
560 PrintF(out, "%s", truncated_epilogue); 560 PrintF(out, "%s", truncated_epilogue);
561 } 561 }
562 562
563 if (!StringShape(this).IsSymbol()) PrintF(out, "\""); 563 if (!StringShape(this).IsSymbol()) PrintF(out, "\"");
564 } 564 }
565 565
566 566
567 // This method is only meant to be called from gdb for debugging purposes.
568 // Since the string can also be in two-byte encoding, non-ascii characters
569 // will be ignored in the output.
570 char* String::ToAsciiArray() {
571 // Static so that subsequent calls frees previously allocated space.
572 // This also means that previous results will be overwritten.
573 static char* buffer = NULL;
574 if (buffer != NULL) free(buffer);
575 buffer = new char[length()+1];
576 WriteToFlat(this, buffer, 0, length());
577 buffer[length()] = 0;
578 return buffer;
579 }
580
581
582 void JSProxy::JSProxyPrint(FILE* out) { 567 void JSProxy::JSProxyPrint(FILE* out) {
583 HeapObject::PrintHeader(out, "JSProxy"); 568 HeapObject::PrintHeader(out, "JSProxy");
584 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); 569 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map()));
585 PrintF(out, " - handler = "); 570 PrintF(out, " - handler = ");
586 handler()->Print(out); 571 handler()->Print(out);
587 PrintF(out, "\n"); 572 PrintF(out, "\n");
588 } 573 }
589 574
590 575
591 void JSWeakMap::JSWeakMapPrint(FILE* out) { 576 void JSWeakMap::JSWeakMapPrint(FILE* out) {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 desc.Print(out); 860 desc.Print(out);
876 } 861 }
877 PrintF(out, "\n"); 862 PrintF(out, "\n");
878 } 863 }
879 864
880 865
881 #endif // OBJECT_PRINT 866 #endif // OBJECT_PRINT
882 867
883 868
884 } } // namespace v8::internal 869 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698