OLD | NEW |
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 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 WriteToFlat(this, reinterpret_cast<uint8_t*>(buffer), 0, length()); | 753 WriteToFlat(this, reinterpret_cast<uint8_t*>(buffer), 0, length()); |
754 buffer[length()] = 0; | 754 buffer[length()] = 0; |
755 return buffer; | 755 return buffer; |
756 } | 756 } |
757 | 757 |
758 | 758 |
759 static const char* const weekdays[] = { | 759 static const char* const weekdays[] = { |
760 "???", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" | 760 "???", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" |
761 }; | 761 }; |
762 | 762 |
| 763 |
763 void JSDate::JSDatePrint(FILE* out) { | 764 void JSDate::JSDatePrint(FILE* out) { |
764 HeapObject::PrintHeader(out, "JSDate"); | 765 HeapObject::PrintHeader(out, "JSDate"); |
765 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); | 766 PrintF(out, " - map = 0x%p\n", reinterpret_cast<void*>(map())); |
766 PrintF(out, " - value = "); | 767 PrintF(out, " - value = "); |
767 value()->Print(out); | 768 value()->Print(out); |
768 if (!year()->IsSmi()) { | 769 if (!year()->IsSmi()) { |
769 PrintF(out, " - time = NaN\n"); | 770 PrintF(out, " - time = NaN\n"); |
770 } else { | 771 } else { |
771 PrintF(out, " - time = %s %04d/%02d/%02d %02d:%02d:%02d\n", | 772 PrintF(out, " - time = %s %04d/%02d/%02d %02d:%02d:%02d\n", |
772 weekdays[weekday()->IsSmi() ? Smi::cast(weekday())->value() + 1 : 0], | 773 weekdays[weekday()->IsSmi() ? Smi::cast(weekday())->value() + 1 : 0], |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 } | 1110 } |
1110 | 1111 |
1111 | 1112 |
1112 void TypeSwitchInfo::TypeSwitchInfoPrint(FILE* out) { | 1113 void TypeSwitchInfo::TypeSwitchInfoPrint(FILE* out) { |
1113 HeapObject::PrintHeader(out, "TypeSwitchInfo"); | 1114 HeapObject::PrintHeader(out, "TypeSwitchInfo"); |
1114 PrintF(out, "\n - types: "); | 1115 PrintF(out, "\n - types: "); |
1115 types()->ShortPrint(out); | 1116 types()->ShortPrint(out); |
1116 } | 1117 } |
1117 | 1118 |
1118 | 1119 |
1119 void AllocationSiteInfo::AllocationSiteInfoPrint(FILE* out) { | 1120 void AllocationSite::AllocationSitePrint(FILE* out) { |
1120 HeapObject::PrintHeader(out, "AllocationSiteInfo"); | 1121 HeapObject::PrintHeader(out, "AllocationSite"); |
1121 PrintF(out, " - payload: "); | 1122 PrintF(out, " - payload: "); |
1122 if (payload()->IsCell()) { | 1123 if (payload()->IsCell()) { |
1123 Cell* cell = Cell::cast(payload()); | 1124 Cell* cell = Cell::cast(payload()); |
1124 Object* cell_contents = cell->value(); | 1125 Object* cell_contents = cell->value(); |
1125 if (cell_contents->IsSmi()) { | 1126 if (cell_contents->IsSmi()) { |
1126 ElementsKind kind = static_cast<ElementsKind>( | 1127 ElementsKind kind = static_cast<ElementsKind>( |
1127 Smi::cast(cell_contents)->value()); | 1128 Smi::cast(cell_contents)->value()); |
1128 PrintF(out, "Array allocation with ElementsKind "); | 1129 PrintF(out, "Array allocation with ElementsKind "); |
1129 PrintElementsKind(out, kind); | 1130 PrintElementsKind(out, kind); |
1130 PrintF(out, "\n"); | 1131 PrintF(out, "\n"); |
1131 return; | 1132 return; |
1132 } | 1133 } |
1133 } else if (payload()->IsJSArray()) { | 1134 } else if (payload()->IsJSArray()) { |
1134 PrintF(out, "Array literal "); | 1135 PrintF(out, "Array literal "); |
1135 payload()->ShortPrint(out); | 1136 payload()->ShortPrint(out); |
1136 PrintF(out, "\n"); | 1137 PrintF(out, "\n"); |
1137 return; | 1138 return; |
1138 } | 1139 } |
1139 | 1140 |
1140 PrintF(out, "unknown payload "); | 1141 PrintF(out, "unknown payload "); |
1141 payload()->ShortPrint(out); | 1142 payload()->ShortPrint(out); |
1142 PrintF(out, "\n"); | 1143 PrintF(out, "\n"); |
1143 } | 1144 } |
1144 | 1145 |
1145 | 1146 |
| 1147 void AllocationSiteInfo::AllocationSiteInfoPrint(FILE* out) { |
| 1148 HeapObject::PrintHeader(out, "AllocationSiteInfo"); |
| 1149 PrintF(out, " - allocation site: "); |
| 1150 if (IsValid()) { |
| 1151 GetAllocationSite()->Print(); |
| 1152 } else { |
| 1153 PrintF(out, "<invalid>\n"); |
| 1154 } |
| 1155 } |
| 1156 |
| 1157 |
1146 void Script::ScriptPrint(FILE* out) { | 1158 void Script::ScriptPrint(FILE* out) { |
1147 HeapObject::PrintHeader(out, "Script"); | 1159 HeapObject::PrintHeader(out, "Script"); |
1148 PrintF(out, "\n - source: "); | 1160 PrintF(out, "\n - source: "); |
1149 source()->ShortPrint(out); | 1161 source()->ShortPrint(out); |
1150 PrintF(out, "\n - name: "); | 1162 PrintF(out, "\n - name: "); |
1151 name()->ShortPrint(out); | 1163 name()->ShortPrint(out); |
1152 PrintF(out, "\n - line_offset: "); | 1164 PrintF(out, "\n - line_offset: "); |
1153 line_offset()->ShortPrint(out); | 1165 line_offset()->ShortPrint(out); |
1154 PrintF(out, "\n - column_offset: "); | 1166 PrintF(out, "\n - column_offset: "); |
1155 column_offset()->ShortPrint(out); | 1167 column_offset()->ShortPrint(out); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 } | 1252 } |
1241 } | 1253 } |
1242 PrintF(out, "\n"); | 1254 PrintF(out, "\n"); |
1243 } | 1255 } |
1244 | 1256 |
1245 | 1257 |
1246 #endif // OBJECT_PRINT | 1258 #endif // OBJECT_PRINT |
1247 | 1259 |
1248 | 1260 |
1249 } } // namespace v8::internal | 1261 } } // namespace v8::internal |
OLD | NEW |