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

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

Issue 9307083: Implement caching scheme for Date fields. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased to HEAD. Created 8 years, 9 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/x64/lithium-x64.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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 // This also means that previous results will be overwritten. 656 // This also means that previous results will be overwritten.
657 static char* buffer = NULL; 657 static char* buffer = NULL;
658 if (buffer != NULL) free(buffer); 658 if (buffer != NULL) free(buffer);
659 buffer = new char[length()+1]; 659 buffer = new char[length()+1];
660 WriteToFlat(this, buffer, 0, length()); 660 WriteToFlat(this, buffer, 0, length());
661 buffer[length()] = 0; 661 buffer[length()] = 0;
662 return buffer; 662 return buffer;
663 } 663 }
664 664
665 665
666 static const char* const weekdays[] = {
667 "???", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
668 };
669
666 void JSDate::JSDatePrint(FILE* out) { 670 void JSDate::JSDatePrint(FILE* out) {
667 HeapObject::PrintHeader(out, "JSDate"); 671 HeapObject::PrintHeader(out, "JSDate");
668 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); 672 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map()));
669 PrintF(out, " - value = "); 673 PrintF(out, " - value = ");
670 value()->Print(out); 674 value()->Print(out);
671 if (!year()->IsSmi()) { 675 if (!year()->IsSmi()) {
672 PrintF(out, " - time = NaN\n"); 676 PrintF(out, " - time = NaN\n");
673 } else { 677 } else {
674 PrintF(out, " - time = %04d/%02d/%02d %02d:%02d:%02d.%03d\n", 678 PrintF(out, " - time = %s %04d/%02d/%02d %02d:%02d:%02d\n",
675 Smi::cast(year())->value(), 679 weekdays[weekday()->IsSmi() ? Smi::cast(weekday())->value() + 1 : 0],
676 Smi::cast(month())->value(), 680 year()->IsSmi() ? Smi::cast(year())->value() : -1,
677 Smi::cast(day())->value(), 681 month()->IsSmi() ? Smi::cast(month())->value() : -1,
678 Smi::cast(hour())->value(), 682 day()->IsSmi() ? Smi::cast(day())->value() : -1,
679 Smi::cast(min())->value(), 683 hour()->IsSmi() ? Smi::cast(hour())->value() : -1,
680 Smi::cast(sec())->value(), 684 min()->IsSmi() ? Smi::cast(min())->value() : -1,
681 Smi::cast(ms())->value()); 685 sec()->IsSmi() ? Smi::cast(sec())->value() : -1);
682 } 686 }
683 } 687 }
684 688
685 689
686 void JSProxy::JSProxyPrint(FILE* out) { 690 void JSProxy::JSProxyPrint(FILE* out) {
687 HeapObject::PrintHeader(out, "JSProxy"); 691 HeapObject::PrintHeader(out, "JSProxy");
688 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); 692 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map()));
689 PrintF(out, " - handler = "); 693 PrintF(out, " - handler = ");
690 handler()->Print(out); 694 handler()->Print(out);
691 PrintF(out, " - hash = "); 695 PrintF(out, " - hash = ");
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 desc.Print(out); 1011 desc.Print(out);
1008 } 1012 }
1009 PrintF(out, "\n"); 1013 PrintF(out, "\n");
1010 } 1014 }
1011 1015
1012 1016
1013 #endif // OBJECT_PRINT 1017 #endif // OBJECT_PRINT
1014 1018
1015 1019
1016 } } // namespace v8::internal 1020 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/x64/lithium-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698