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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 void HeapObject::HeapObjectPrint(FILE* out) { | 69 void HeapObject::HeapObjectPrint(FILE* out) { |
70 InstanceType instance_type = map()->instance_type(); | 70 InstanceType instance_type = map()->instance_type(); |
71 | 71 |
72 HandleScope scope; | 72 HandleScope scope; |
73 if (instance_type < FIRST_NONSTRING_TYPE) { | 73 if (instance_type < FIRST_NONSTRING_TYPE) { |
74 String::cast(this)->StringPrint(out); | 74 String::cast(this)->StringPrint(out); |
75 return; | 75 return; |
76 } | 76 } |
77 | 77 |
78 switch (instance_type) { | 78 switch (instance_type) { |
| 79 case SYMBOL_TYPE: |
| 80 Symbol::cast(this)->SymbolPrint(out); |
| 81 break; |
79 case MAP_TYPE: | 82 case MAP_TYPE: |
80 Map::cast(this)->MapPrint(out); | 83 Map::cast(this)->MapPrint(out); |
81 break; | 84 break; |
82 case HEAP_NUMBER_TYPE: | 85 case HEAP_NUMBER_TYPE: |
83 HeapNumber::cast(this)->HeapNumberPrint(out); | 86 HeapNumber::cast(this)->HeapNumberPrint(out); |
84 break; | 87 break; |
85 case FIXED_DOUBLE_ARRAY_TYPE: | 88 case FIXED_DOUBLE_ARRAY_TYPE: |
86 FixedDoubleArray::cast(this)->FixedDoubleArrayPrint(out); | 89 FixedDoubleArray::cast(this)->FixedDoubleArrayPrint(out); |
87 break; | 90 break; |
88 case FIXED_ARRAY_TYPE: | 91 case FIXED_ARRAY_TYPE: |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 PrintElements(out); | 473 PrintElements(out); |
471 PrintF(out, " }\n"); | 474 PrintF(out, " }\n"); |
472 } | 475 } |
473 | 476 |
474 | 477 |
475 static const char* TypeToString(InstanceType type) { | 478 static const char* TypeToString(InstanceType type) { |
476 switch (type) { | 479 switch (type) { |
477 case INVALID_TYPE: return "INVALID"; | 480 case INVALID_TYPE: return "INVALID"; |
478 case MAP_TYPE: return "MAP"; | 481 case MAP_TYPE: return "MAP"; |
479 case HEAP_NUMBER_TYPE: return "HEAP_NUMBER"; | 482 case HEAP_NUMBER_TYPE: return "HEAP_NUMBER"; |
| 483 case SYMBOL_TYPE: return "SYMBOL"; |
480 case STRING_TYPE: return "TWO_BYTE_STRING"; | 484 case STRING_TYPE: return "TWO_BYTE_STRING"; |
481 case ASCII_STRING_TYPE: return "ASCII_STRING"; | 485 case ASCII_STRING_TYPE: return "ASCII_STRING"; |
482 case CONS_STRING_TYPE: | 486 case CONS_STRING_TYPE: |
483 case CONS_ASCII_STRING_TYPE: | 487 case CONS_ASCII_STRING_TYPE: |
484 return "CONS_STRING"; | 488 return "CONS_STRING"; |
485 case EXTERNAL_STRING_TYPE: | 489 case EXTERNAL_STRING_TYPE: |
486 case EXTERNAL_ASCII_STRING_TYPE: | 490 case EXTERNAL_ASCII_STRING_TYPE: |
487 case EXTERNAL_STRING_WITH_ASCII_DATA_TYPE: | 491 case EXTERNAL_STRING_WITH_ASCII_DATA_TYPE: |
488 return "EXTERNAL_STRING"; | 492 return "EXTERNAL_STRING"; |
489 case SHORT_EXTERNAL_STRING_TYPE: | 493 case SHORT_EXTERNAL_STRING_TYPE: |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 case FOREIGN_TYPE: return "FOREIGN"; | 542 case FOREIGN_TYPE: return "FOREIGN"; |
539 case JS_MESSAGE_OBJECT_TYPE: return "JS_MESSAGE_OBJECT_TYPE"; | 543 case JS_MESSAGE_OBJECT_TYPE: return "JS_MESSAGE_OBJECT_TYPE"; |
540 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return #NAME; | 544 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return #NAME; |
541 STRUCT_LIST(MAKE_STRUCT_CASE) | 545 STRUCT_LIST(MAKE_STRUCT_CASE) |
542 #undef MAKE_STRUCT_CASE | 546 #undef MAKE_STRUCT_CASE |
543 default: return "UNKNOWN"; | 547 default: return "UNKNOWN"; |
544 } | 548 } |
545 } | 549 } |
546 | 550 |
547 | 551 |
| 552 void Symbol::SymbolPrint(FILE* out) { |
| 553 HeapObject::PrintHeader(out, "Symbol"); |
| 554 PrintF(out, " - hash: %d\n", Hash()); |
| 555 } |
| 556 |
| 557 |
548 void Map::MapPrint(FILE* out) { | 558 void Map::MapPrint(FILE* out) { |
549 HeapObject::PrintHeader(out, "Map"); | 559 HeapObject::PrintHeader(out, "Map"); |
550 PrintF(out, " - type: %s\n", TypeToString(instance_type())); | 560 PrintF(out, " - type: %s\n", TypeToString(instance_type())); |
551 PrintF(out, " - instance size: %d\n", instance_size()); | 561 PrintF(out, " - instance size: %d\n", instance_size()); |
552 PrintF(out, " - inobject properties: %d\n", inobject_properties()); | 562 PrintF(out, " - inobject properties: %d\n", inobject_properties()); |
553 PrintF(out, " - elements kind: "); | 563 PrintF(out, " - elements kind: "); |
554 PrintElementsKind(out, elements_kind()); | 564 PrintElementsKind(out, elements_kind()); |
555 PrintF(out, "\n - pre-allocated property fields: %d\n", | 565 PrintF(out, "\n - pre-allocated property fields: %d\n", |
556 pre_allocated_property_fields()); | 566 pre_allocated_property_fields()); |
557 PrintF(out, " - unused property fields: %d\n", unused_property_fields()); | 567 PrintF(out, " - unused property fields: %d\n", unused_property_fields()); |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 } | 1131 } |
1122 } | 1132 } |
1123 PrintF(out, "\n"); | 1133 PrintF(out, "\n"); |
1124 } | 1134 } |
1125 | 1135 |
1126 | 1136 |
1127 #endif // OBJECT_PRINT | 1137 #endif // OBJECT_PRINT |
1128 | 1138 |
1129 | 1139 |
1130 } } // namespace v8::internal | 1140 } } // namespace v8::internal |
OLD | NEW |