| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 void ExternalDoubleArray::ExternalDoubleArrayPrint(FILE* out) { | 252 void ExternalDoubleArray::ExternalDoubleArrayPrint(FILE* out) { |
| 253 PrintF(out, "external double array"); | 253 PrintF(out, "external double array"); |
| 254 } | 254 } |
| 255 | 255 |
| 256 | 256 |
| 257 void JSObject::PrintProperties(FILE* out) { | 257 void JSObject::PrintProperties(FILE* out) { |
| 258 if (HasFastProperties()) { | 258 if (HasFastProperties()) { |
| 259 DescriptorArray* descs = map()->instance_descriptors(); | 259 DescriptorArray* descs = map()->instance_descriptors(); |
| 260 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { | 260 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { |
| 261 PrintF(out, " "); | 261 PrintF(out, " "); |
| 262 descs->GetKey(i)->StringPrint(out); | 262 descs->GetKey(i)->NamePrint(out); |
| 263 PrintF(out, ": "); | 263 PrintF(out, ": "); |
| 264 switch (descs->GetType(i)) { | 264 switch (descs->GetType(i)) { |
| 265 case FIELD: { | 265 case FIELD: { |
| 266 int index = descs->GetFieldIndex(i); | 266 int index = descs->GetFieldIndex(i); |
| 267 FastPropertyAt(index)->ShortPrint(out); | 267 FastPropertyAt(index)->ShortPrint(out); |
| 268 PrintF(out, " (field at offset %d)\n", index); | 268 PrintF(out, " (field at offset %d)\n", index); |
| 269 break; | 269 break; |
| 270 } | 270 } |
| 271 case CONSTANT_FUNCTION: | 271 case CONSTANT_FUNCTION: |
| 272 descs->GetConstantFunction(i)->ShortPrint(out); | 272 descs->GetConstantFunction(i)->ShortPrint(out); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 } | 410 } |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 | 413 |
| 414 | 414 |
| 415 void JSObject::PrintTransitions(FILE* out) { | 415 void JSObject::PrintTransitions(FILE* out) { |
| 416 if (!map()->HasTransitionArray()) return; | 416 if (!map()->HasTransitionArray()) return; |
| 417 TransitionArray* transitions = map()->transitions(); | 417 TransitionArray* transitions = map()->transitions(); |
| 418 for (int i = 0; i < transitions->number_of_transitions(); i++) { | 418 for (int i = 0; i < transitions->number_of_transitions(); i++) { |
| 419 PrintF(out, " "); | 419 PrintF(out, " "); |
| 420 transitions->GetKey(i)->StringPrint(out); | 420 transitions->GetKey(i)->NamePrint(out); |
| 421 PrintF(out, ": "); | 421 PrintF(out, ": "); |
| 422 switch (transitions->GetTargetDetails(i).type()) { | 422 switch (transitions->GetTargetDetails(i).type()) { |
| 423 case FIELD: { | 423 case FIELD: { |
| 424 PrintF(out, " (transition to field)\n"); | 424 PrintF(out, " (transition to field)\n"); |
| 425 break; | 425 break; |
| 426 } | 426 } |
| 427 case CONSTANT_FUNCTION: | 427 case CONSTANT_FUNCTION: |
| 428 PrintF(out, " (transition to constant function)\n"); | 428 PrintF(out, " (transition to constant function)\n"); |
| 429 break; | 429 break; |
| 430 case CALLBACKS: | 430 case CALLBACKS: |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 PrintF(out, "%c", Get(i)); | 703 PrintF(out, "%c", Get(i)); |
| 704 } | 704 } |
| 705 if (len != length()) { | 705 if (len != length()) { |
| 706 PrintF(out, "%s", truncated_epilogue); | 706 PrintF(out, "%s", truncated_epilogue); |
| 707 } | 707 } |
| 708 | 708 |
| 709 if (!StringShape(this).IsInternalized()) PrintF(out, "\""); | 709 if (!StringShape(this).IsInternalized()) PrintF(out, "\""); |
| 710 } | 710 } |
| 711 | 711 |
| 712 | 712 |
| 713 void Name::NamePrint(FILE* out) { |
| 714 if (IsString()) |
| 715 String::cast(this)->StringPrint(out); |
| 716 else |
| 717 ShortPrint(); |
| 718 } |
| 719 |
| 720 |
| 713 // This method is only meant to be called from gdb for debugging purposes. | 721 // This method is only meant to be called from gdb for debugging purposes. |
| 714 // Since the string can also be in two-byte encoding, non-ASCII characters | 722 // Since the string can also be in two-byte encoding, non-ASCII characters |
| 715 // will be ignored in the output. | 723 // will be ignored in the output. |
| 716 char* String::ToAsciiArray() { | 724 char* String::ToAsciiArray() { |
| 717 // Static so that subsequent calls frees previously allocated space. | 725 // Static so that subsequent calls frees previously allocated space. |
| 718 // This also means that previous results will be overwritten. | 726 // This also means that previous results will be overwritten. |
| 719 static char* buffer = NULL; | 727 static char* buffer = NULL; |
| 720 if (buffer != NULL) free(buffer); | 728 if (buffer != NULL) free(buffer); |
| 721 buffer = new char[length()+1]; | 729 buffer = new char[length()+1]; |
| 722 WriteToFlat(this, reinterpret_cast<uint8_t*>(buffer), 0, length()); | 730 WriteToFlat(this, reinterpret_cast<uint8_t*>(buffer), 0, length()); |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 desc.Print(out); | 1108 desc.Print(out); |
| 1101 } | 1109 } |
| 1102 PrintF(out, "\n"); | 1110 PrintF(out, "\n"); |
| 1103 } | 1111 } |
| 1104 | 1112 |
| 1105 | 1113 |
| 1106 void TransitionArray::PrintTransitions(FILE* out) { | 1114 void TransitionArray::PrintTransitions(FILE* out) { |
| 1107 PrintF(out, "Transition array %d\n", number_of_transitions()); | 1115 PrintF(out, "Transition array %d\n", number_of_transitions()); |
| 1108 for (int i = 0; i < number_of_transitions(); i++) { | 1116 for (int i = 0; i < number_of_transitions(); i++) { |
| 1109 PrintF(out, " %d: ", i); | 1117 PrintF(out, " %d: ", i); |
| 1110 GetKey(i)->StringPrint(out); | 1118 GetKey(i)->NamePrint(out); |
| 1111 PrintF(out, ": "); | 1119 PrintF(out, ": "); |
| 1112 switch (GetTargetDetails(i).type()) { | 1120 switch (GetTargetDetails(i).type()) { |
| 1113 case FIELD: { | 1121 case FIELD: { |
| 1114 PrintF(out, " (transition to field)\n"); | 1122 PrintF(out, " (transition to field)\n"); |
| 1115 break; | 1123 break; |
| 1116 } | 1124 } |
| 1117 case CONSTANT_FUNCTION: | 1125 case CONSTANT_FUNCTION: |
| 1118 PrintF(out, " (transition to constant function)\n"); | 1126 PrintF(out, " (transition to constant function)\n"); |
| 1119 break; | 1127 break; |
| 1120 case CALLBACKS: | 1128 case CALLBACKS: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1131 } | 1139 } |
| 1132 } | 1140 } |
| 1133 PrintF(out, "\n"); | 1141 PrintF(out, "\n"); |
| 1134 } | 1142 } |
| 1135 | 1143 |
| 1136 | 1144 |
| 1137 #endif // OBJECT_PRINT | 1145 #endif // OBJECT_PRINT |
| 1138 | 1146 |
| 1139 | 1147 |
| 1140 } } // namespace v8::internal | 1148 } } // namespace v8::internal |
| OLD | NEW |