OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/disasm.h" | 7 #include "src/disasm.h" |
8 #include "src/disassembler.h" | 8 #include "src/disassembler.h" |
9 #include "src/heap/objects-visiting.h" | 9 #include "src/heap/objects-visiting.h" |
10 #include "src/jsregexp.h" | 10 #include "src/jsregexp.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 void JSObject::PrintProperties(std::ostream& os) { // NOLINT | 226 void JSObject::PrintProperties(std::ostream& os) { // NOLINT |
227 if (HasFastProperties()) { | 227 if (HasFastProperties()) { |
228 DescriptorArray* descs = map()->instance_descriptors(); | 228 DescriptorArray* descs = map()->instance_descriptors(); |
229 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { | 229 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { |
230 os << " "; | 230 os << " "; |
231 descs->GetKey(i)->NamePrint(os); | 231 descs->GetKey(i)->NamePrint(os); |
232 os << ": "; | 232 os << ": "; |
233 switch (descs->GetType(i)) { | 233 switch (descs->GetType(i)) { |
234 case FIELD: { | 234 case FIELD: { |
235 FieldIndex index = FieldIndex::ForDescriptor(map(), i); | 235 FieldIndex index = FieldIndex::ForDescriptor(map(), i); |
236 os << Brief(RawFastPropertyAt(index)) << " (field at offset " | 236 if (IsUnboxedDoubleField(index)) { |
237 << index.property_index() << ")\n"; | 237 os << "<unboxed double> " << RawFastDoublePropertyAt(index); |
| 238 } else { |
| 239 os << Brief(RawFastPropertyAt(index)); |
| 240 } |
| 241 os << " (field at offset " << index.property_index() << ")\n"; |
238 break; | 242 break; |
239 } | 243 } |
240 case CONSTANT: | 244 case CONSTANT: |
241 os << Brief(descs->GetConstant(i)) << " (constant)\n"; | 245 os << Brief(descs->GetConstant(i)) << " (constant)\n"; |
242 break; | 246 break; |
243 case CALLBACKS: | 247 case CALLBACKS: |
244 os << Brief(descs->GetCallbacksObject(i)) << " (callback)\n"; | 248 os << Brief(descs->GetCallbacksObject(i)) << " (callback)\n"; |
245 break; | 249 break; |
246 case NORMAL: // only in slow mode | 250 case NORMAL: // only in slow mode |
247 UNREACHABLE(); | 251 UNREACHABLE(); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 if (is_access_check_needed()) os << " - access_check_needed\n"; | 427 if (is_access_check_needed()) os << " - access_check_needed\n"; |
424 if (is_frozen()) { | 428 if (is_frozen()) { |
425 os << " - frozen\n"; | 429 os << " - frozen\n"; |
426 } else if (!is_extensible()) { | 430 } else if (!is_extensible()) { |
427 os << " - sealed\n"; | 431 os << " - sealed\n"; |
428 } | 432 } |
429 os << " - back pointer: " << Brief(GetBackPointer()); | 433 os << " - back pointer: " << Brief(GetBackPointer()); |
430 os << "\n - instance descriptors " << (owns_descriptors() ? "(own) " : "") | 434 os << "\n - instance descriptors " << (owns_descriptors() ? "(own) " : "") |
431 << "#" << NumberOfOwnDescriptors() << ": " | 435 << "#" << NumberOfOwnDescriptors() << ": " |
432 << Brief(instance_descriptors()); | 436 << Brief(instance_descriptors()); |
| 437 if (FLAG_unbox_double_fields) { |
| 438 os << "\n - layout descriptor: " << Brief(layout_descriptor()); |
| 439 } |
433 if (HasTransitionArray()) { | 440 if (HasTransitionArray()) { |
434 os << "\n - transitions: " << Brief(transitions()); | 441 os << "\n - transitions: " << Brief(transitions()); |
435 } | 442 } |
436 os << "\n - prototype: " << Brief(prototype()); | 443 os << "\n - prototype: " << Brief(prototype()); |
437 os << "\n - constructor: " << Brief(constructor()); | 444 os << "\n - constructor: " << Brief(constructor()); |
438 os << "\n - code cache: " << Brief(code_cache()); | 445 os << "\n - code cache: " << Brief(code_cache()); |
439 os << "\n - dependent code: " << Brief(dependent_code()); | 446 os << "\n - dependent code: " << Brief(dependent_code()); |
440 os << "\n"; | 447 os << "\n"; |
441 } | 448 } |
442 | 449 |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 os << "Descriptor array " << number_of_descriptors() << "\n"; | 1076 os << "Descriptor array " << number_of_descriptors() << "\n"; |
1070 for (int i = 0; i < number_of_descriptors(); i++) { | 1077 for (int i = 0; i < number_of_descriptors(); i++) { |
1071 Descriptor desc; | 1078 Descriptor desc; |
1072 Get(i, &desc); | 1079 Get(i, &desc); |
1073 os << " " << i << ": " << desc << "\n"; | 1080 os << " " << i << ": " << desc << "\n"; |
1074 } | 1081 } |
1075 os << "\n"; | 1082 os << "\n"; |
1076 } | 1083 } |
1077 | 1084 |
1078 | 1085 |
| 1086 static void PrintBitMask(std::ostream& os, uint32_t value) { // NOLINT |
| 1087 for (int i = 0; i < 32; i++) { |
| 1088 if ((i & 7) == 0) os << " "; |
| 1089 os << (((value & 1) == 0) ? "_" : "x"); |
| 1090 value >>= 1; |
| 1091 } |
| 1092 } |
| 1093 |
| 1094 |
| 1095 void LayoutDescriptor::Print() { |
| 1096 OFStream os(stdout); |
| 1097 this->Print(os); |
| 1098 os << std::flush; |
| 1099 } |
| 1100 |
| 1101 |
| 1102 void LayoutDescriptor::Print(std::ostream& os) { // NOLINT |
| 1103 os << "Layout descriptor: "; |
| 1104 if (IsUninitialized()) { |
| 1105 os << "<uninitialized>"; |
| 1106 } else if (IsFastPointerLayout()) { |
| 1107 os << "<all tagged>"; |
| 1108 } else if (IsSmi()) { |
| 1109 os << "fast"; |
| 1110 PrintBitMask(os, static_cast<uint32_t>(Smi::cast(this)->value())); |
| 1111 } else { |
| 1112 os << "slow"; |
| 1113 int len = length(); |
| 1114 for (int i = 0; i < len; i++) { |
| 1115 if (i > 0) os << " |"; |
| 1116 PrintBitMask(os, get_scalar(i)); |
| 1117 } |
| 1118 } |
| 1119 os << "\n"; |
| 1120 } |
| 1121 |
| 1122 |
1079 void TransitionArray::Print() { | 1123 void TransitionArray::Print() { |
1080 OFStream os(stdout); | 1124 OFStream os(stdout); |
1081 this->PrintTransitions(os); | 1125 this->PrintTransitions(os); |
1082 os << std::flush; | 1126 os << std::flush; |
1083 } | 1127 } |
1084 | 1128 |
1085 | 1129 |
1086 void TransitionArray::PrintTransitions(std::ostream& os, | 1130 void TransitionArray::PrintTransitions(std::ostream& os, |
1087 bool print_header) { // NOLINT | 1131 bool print_header) { // NOLINT |
1088 if (print_header) { | 1132 if (print_header) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 return SNPrintF(str, "#<%s>", s->PrivateSymbolToName()); | 1201 return SNPrintF(str, "#<%s>", s->PrivateSymbolToName()); |
1158 } else { | 1202 } else { |
1159 return SNPrintF(str, "<%s>", String::cast(s->name())->ToCString().get()); | 1203 return SNPrintF(str, "<%s>", String::cast(s->name())->ToCString().get()); |
1160 } | 1204 } |
1161 } | 1205 } |
1162 } | 1206 } |
1163 | 1207 |
1164 | 1208 |
1165 #endif // TRACE_MAPS | 1209 #endif // TRACE_MAPS |
1166 } } // namespace v8::internal | 1210 } } // namespace v8::internal |
OLD | NEW |