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/jsregexp.h" | 9 #include "src/jsregexp.h" |
10 #include "src/objects-visiting.h" | 10 #include "src/objects-visiting.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 void JSObject::PrintProperties(OStream& os) { // NOLINT | 221 void JSObject::PrintProperties(OStream& os) { // NOLINT |
222 if (HasFastProperties()) { | 222 if (HasFastProperties()) { |
223 DescriptorArray* descs = map()->instance_descriptors(); | 223 DescriptorArray* descs = map()->instance_descriptors(); |
224 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { | 224 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { |
225 os << " "; | 225 os << " "; |
226 descs->GetKey(i)->NamePrint(os); | 226 descs->GetKey(i)->NamePrint(os); |
227 os << ": "; | 227 os << ": "; |
228 switch (descs->GetType(i)) { | 228 switch (descs->GetType(i)) { |
229 case FIELD: { | 229 case FIELD: { |
230 FieldIndex index = FieldIndex::ForDescriptor(map(), i); | 230 FieldIndex index = FieldIndex::ForDescriptor(map(), i); |
231 os << Brief(RawFastPropertyAt(index)) << " (field at offset " | 231 if (map()->IsUnboxedDoubleField(index)) { |
232 << index.property_index() << ")\n"; | 232 os << "<unboxed double> " << RawFastDoublePropertyAt(index); |
| 233 } else { |
| 234 os << Brief(RawFastPropertyAt(index)); |
| 235 } |
| 236 os << " (field at offset " << index.property_index() << ")\n"; |
233 break; | 237 break; |
234 } | 238 } |
235 case CONSTANT: | 239 case CONSTANT: |
236 os << Brief(descs->GetConstant(i)) << " (constant)\n"; | 240 os << Brief(descs->GetConstant(i)) << " (constant)\n"; |
237 break; | 241 break; |
238 case CALLBACKS: | 242 case CALLBACKS: |
239 os << Brief(descs->GetCallbacksObject(i)) << " (callback)\n"; | 243 os << Brief(descs->GetCallbacksObject(i)) << " (callback)\n"; |
240 break; | 244 break; |
241 case NORMAL: // only in slow mode | 245 case NORMAL: // only in slow mode |
242 case HANDLER: // only in lookup results, not in descriptors | 246 case HANDLER: // only in lookup results, not in descriptors |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 if (is_access_check_needed()) os << " - access_check_needed\n"; | 454 if (is_access_check_needed()) os << " - access_check_needed\n"; |
451 if (is_frozen()) { | 455 if (is_frozen()) { |
452 os << " - frozen\n"; | 456 os << " - frozen\n"; |
453 } else if (!is_extensible()) { | 457 } else if (!is_extensible()) { |
454 os << " - sealed\n"; | 458 os << " - sealed\n"; |
455 } | 459 } |
456 os << " - back pointer: " << Brief(GetBackPointer()); | 460 os << " - back pointer: " << Brief(GetBackPointer()); |
457 os << "\n - instance descriptors " << (owns_descriptors() ? "(own) " : "") | 461 os << "\n - instance descriptors " << (owns_descriptors() ? "(own) " : "") |
458 << "#" << NumberOfOwnDescriptors() << ": " | 462 << "#" << NumberOfOwnDescriptors() << ": " |
459 << Brief(instance_descriptors()); | 463 << Brief(instance_descriptors()); |
| 464 if (FLAG_unbox_double_fields) { |
| 465 os << "\n - layout descriptor: " << Brief(layout_descriptor()); |
| 466 } |
460 if (HasTransitionArray()) { | 467 if (HasTransitionArray()) { |
461 os << "\n - transitions: " << Brief(transitions()); | 468 os << "\n - transitions: " << Brief(transitions()); |
462 } | 469 } |
463 os << "\n - prototype: " << Brief(prototype()); | 470 os << "\n - prototype: " << Brief(prototype()); |
464 os << "\n - constructor: " << Brief(constructor()); | 471 os << "\n - constructor: " << Brief(constructor()); |
465 os << "\n - code cache: " << Brief(code_cache()); | 472 os << "\n - code cache: " << Brief(code_cache()); |
466 os << "\n - dependent code: " << Brief(dependent_code()); | 473 os << "\n - dependent code: " << Brief(dependent_code()); |
467 os << "\n"; | 474 os << "\n"; |
| 475 instance_descriptors()->PrintDescriptors(os); |
| 476 os << "\n"; |
| 477 if (FLAG_unbox_double_fields) layout_descriptor()->Print(os); |
468 } | 478 } |
469 | 479 |
470 | 480 |
471 void CodeCache::CodeCachePrint(OStream& os) { // NOLINT | 481 void CodeCache::CodeCachePrint(OStream& os) { // NOLINT |
472 HeapObject::PrintHeader(os, "CodeCache"); | 482 HeapObject::PrintHeader(os, "CodeCache"); |
473 os << "\n - default_cache: " << Brief(default_cache()); | 483 os << "\n - default_cache: " << Brief(default_cache()); |
474 os << "\n - normal_type_cache: " << Brief(normal_type_cache()); | 484 os << "\n - normal_type_cache: " << Brief(normal_type_cache()); |
475 } | 485 } |
476 | 486 |
477 | 487 |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 HeapObject::PrintHeader(os, "BreakPointInfo"); | 1075 HeapObject::PrintHeader(os, "BreakPointInfo"); |
1066 os << "\n - code_position: " << code_position()->value(); | 1076 os << "\n - code_position: " << code_position()->value(); |
1067 os << "\n - source_position: " << source_position()->value(); | 1077 os << "\n - source_position: " << source_position()->value(); |
1068 os << "\n - statement_position: " << statement_position()->value(); | 1078 os << "\n - statement_position: " << statement_position()->value(); |
1069 os << "\n - break_point_objects: " << Brief(break_point_objects()); | 1079 os << "\n - break_point_objects: " << Brief(break_point_objects()); |
1070 os << "\n"; | 1080 os << "\n"; |
1071 } | 1081 } |
1072 | 1082 |
1073 | 1083 |
1074 void DescriptorArray::PrintDescriptors(OStream& os) { // NOLINT | 1084 void DescriptorArray::PrintDescriptors(OStream& os) { // NOLINT |
1075 os << "Descriptor array " << number_of_descriptors() << "\n"; | 1085 os << "Descriptor array " << number_of_descriptors() << "\n"; |
1076 for (int i = 0; i < number_of_descriptors(); i++) { | 1086 for (int i = 0; i < number_of_descriptors(); i++) { |
1077 Descriptor desc; | 1087 Descriptor desc; |
1078 Get(i, &desc); | 1088 Get(i, &desc); |
1079 os << " " << i << ": " << desc; | 1089 os << " " << i << ": " << desc << "\n"; |
| 1090 } |
| 1091 os << "\n"; |
| 1092 } |
| 1093 |
| 1094 |
| 1095 static void PrintBitMask(OStream& os, uint32_t value) { // NOLINT |
| 1096 for (int i = 0; i < 32; i++) { |
| 1097 if ((i & 7) == 0) os << " "; |
| 1098 os << (((value & 1) == 0) ? "_" : "x"); |
| 1099 value >>= 1; |
| 1100 } |
| 1101 } |
| 1102 |
| 1103 |
| 1104 void LayoutDescriptor::Print(OStream& os) { // NOLINT |
| 1105 os << "Layout descriptor: "; |
| 1106 if (IsUninitialized()) { |
| 1107 os << "<uninitialized>"; |
| 1108 } else if (IsFastPointerLayout()) { |
| 1109 os << "<all tagged>"; |
| 1110 } else if (IsSmi()) { |
| 1111 os << "fast"; |
| 1112 PrintBitMask(os, static_cast<uint32_t>(Smi::cast(this)->value())); |
| 1113 } else { |
| 1114 os << "slow"; |
| 1115 int len = length(); |
| 1116 for (int i = 0; i < len; i++) { |
| 1117 if (i > 0) os << " |"; |
| 1118 PrintBitMask(os, get_scalar(i)); |
| 1119 } |
1080 } | 1120 } |
1081 os << "\n"; | 1121 os << "\n"; |
1082 } | 1122 } |
1083 | 1123 |
1084 | 1124 |
1085 void TransitionArray::PrintTransitions(OStream& os) { // NOLINT | 1125 void TransitionArray::PrintTransitions(OStream& os) { // NOLINT |
1086 os << "Transition array %d\n", number_of_transitions(); | 1126 os << "Transition array " << number_of_transitions() << "\n"; |
1087 for (int i = 0; i < number_of_transitions(); i++) { | 1127 for (int i = 0; i < number_of_transitions(); i++) { |
1088 os << " " << i << ": "; | 1128 os << " " << i << ": "; |
1089 GetKey(i)->NamePrint(os); | 1129 GetKey(i)->NamePrint(os); |
1090 os << ": "; | 1130 os << ": "; |
1091 switch (GetTargetDetails(i).type()) { | 1131 switch (GetTargetDetails(i).type()) { |
1092 case FIELD: { | 1132 case FIELD: { |
1093 os << " (transition to field)\n"; | 1133 os << " (transition to field)\n"; |
1094 break; | 1134 break; |
1095 } | 1135 } |
1096 case CONSTANT: | 1136 case CONSTANT: |
(...skipping 12 matching lines...) Expand all Loading... |
1109 } | 1149 } |
1110 } | 1150 } |
1111 os << "\n"; | 1151 os << "\n"; |
1112 } | 1152 } |
1113 | 1153 |
1114 | 1154 |
1115 #endif // OBJECT_PRINT | 1155 #endif // OBJECT_PRINT |
1116 | 1156 |
1117 | 1157 |
1118 } } // namespace v8::internal | 1158 } } // namespace v8::internal |
OLD | NEW |