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

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

Issue 9117034: New class for Date objects: caches individual date components. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add constant for index of first barrier-free slot. Created 8 years, 11 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/objects-visiting.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 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 case JS_GLOBAL_OBJECT_TYPE: 144 case JS_GLOBAL_OBJECT_TYPE:
145 JSGlobalObject::cast(this)->JSGlobalObjectPrint(out); 145 JSGlobalObject::cast(this)->JSGlobalObjectPrint(out);
146 break; 146 break;
147 case JS_BUILTINS_OBJECT_TYPE: 147 case JS_BUILTINS_OBJECT_TYPE:
148 JSBuiltinsObject::cast(this)->JSBuiltinsObjectPrint(out); 148 JSBuiltinsObject::cast(this)->JSBuiltinsObjectPrint(out);
149 break; 149 break;
150 case JS_VALUE_TYPE: 150 case JS_VALUE_TYPE:
151 PrintF(out, "Value wrapper around:"); 151 PrintF(out, "Value wrapper around:");
152 JSValue::cast(this)->value()->Print(out); 152 JSValue::cast(this)->value()->Print(out);
153 break; 153 break;
154 case JS_DATE_TYPE:
155 JSDate::cast(this)->value()->Print(out);
156 break;
154 case CODE_TYPE: 157 case CODE_TYPE:
155 Code::cast(this)->CodePrint(out); 158 Code::cast(this)->CodePrint(out);
156 break; 159 break;
157 case JS_PROXY_TYPE: 160 case JS_PROXY_TYPE:
158 JSProxy::cast(this)->JSProxyPrint(out); 161 JSProxy::cast(this)->JSProxyPrint(out);
159 break; 162 break;
160 case JS_FUNCTION_PROXY_TYPE: 163 case JS_FUNCTION_PROXY_TYPE:
161 JSFunctionProxy::cast(this)->JSFunctionProxyPrint(out); 164 JSFunctionProxy::cast(this)->JSFunctionProxyPrint(out);
162 break; 165 break;
163 case JS_WEAK_MAP_TYPE: 166 case JS_WEAK_MAP_TYPE:
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 // This also means that previous results will be overwritten. 637 // This also means that previous results will be overwritten.
635 static char* buffer = NULL; 638 static char* buffer = NULL;
636 if (buffer != NULL) free(buffer); 639 if (buffer != NULL) free(buffer);
637 buffer = new char[length()+1]; 640 buffer = new char[length()+1];
638 WriteToFlat(this, buffer, 0, length()); 641 WriteToFlat(this, buffer, 0, length());
639 buffer[length()] = 0; 642 buffer[length()] = 0;
640 return buffer; 643 return buffer;
641 } 644 }
642 645
643 646
647 void JSDate::JSDatePrint(FILE* out) {
648 HeapObject::PrintHeader(out, "JSDate");
649 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map()));
650 PrintF(out, " - value = ");
651 value()->Print(out);
652 if (!year()->IsSmi()) {
653 PrintF(out, " - time = NaN\n");
654 } else {
655 PrintF(out, " - time = %04d/%02d/%02d %02d:%02d:%02d.%03d\n",
656 Smi::cast(year())->value(),
657 Smi::cast(month())->value(),
658 Smi::cast(day())->value(),
659 Smi::cast(hour())->value(),
660 Smi::cast(min())->value(),
661 Smi::cast(sec())->value(),
662 Smi::cast(ms())->value());
663 }
664 }
665
666
644 void JSProxy::JSProxyPrint(FILE* out) { 667 void JSProxy::JSProxyPrint(FILE* out) {
645 HeapObject::PrintHeader(out, "JSProxy"); 668 HeapObject::PrintHeader(out, "JSProxy");
646 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); 669 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map()));
647 PrintF(out, " - handler = "); 670 PrintF(out, " - handler = ");
648 handler()->Print(out); 671 handler()->Print(out);
649 PrintF(out, " - hash = "); 672 PrintF(out, " - hash = ");
650 hash()->Print(out); 673 hash()->Print(out);
651 PrintF(out, "\n"); 674 PrintF(out, "\n");
652 } 675 }
653 676
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 desc.Print(out); 988 desc.Print(out);
966 } 989 }
967 PrintF(out, "\n"); 990 PrintF(out, "\n");
968 } 991 }
969 992
970 993
971 #endif // OBJECT_PRINT 994 #endif // OBJECT_PRINT
972 995
973 996
974 } } // namespace v8::internal 997 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/objects-visiting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698