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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 if (is_the_hole(i)) { | 496 if (is_the_hole(i)) { |
497 os << "<the hole>"; | 497 os << "<the hole>"; |
498 } else { | 498 } else { |
499 os << get_scalar(i); | 499 os << get_scalar(i); |
500 } | 500 } |
501 } | 501 } |
502 os << "\n"; | 502 os << "\n"; |
503 } | 503 } |
504 | 504 |
505 | 505 |
| 506 void TypeFeedbackVector::Print() { |
| 507 OFStream os(stdout); |
| 508 TypeFeedbackVectorPrint(os); |
| 509 os << std::flush; |
| 510 } |
| 511 |
| 512 |
| 513 void TypeFeedbackVector::TypeFeedbackVectorPrint(std::ostream& os) { // NOLINT |
| 514 HeapObject::PrintHeader(os, "TypeFeedbackVector"); |
| 515 os << " - length: " << length(); |
| 516 if (length() == 0) { |
| 517 os << " (empty)\n"; |
| 518 return; |
| 519 } |
| 520 |
| 521 os << "\n - ics with type info: " << ic_with_type_info_count(); |
| 522 os << "\n - generic ics: " << ic_generic_count(); |
| 523 |
| 524 if (Slots() > 0) { |
| 525 for (int i = 0; i < Slots(); i++) { |
| 526 FeedbackVectorSlot slot(i); |
| 527 os << "\n Slot " << i << " [" << GetIndex(slot) |
| 528 << "]: " << Brief(Get(slot)); |
| 529 } |
| 530 } |
| 531 |
| 532 if (ICSlots() > 0) { |
| 533 DCHECK(elements_per_ic_slot() == 2); |
| 534 |
| 535 for (int i = 0; i < ICSlots(); i++) { |
| 536 FeedbackVectorICSlot slot(i); |
| 537 Code::Kind kind = GetKind(slot); |
| 538 os << "\n ICSlot " << i; |
| 539 if (kind == Code::LOAD_IC) { |
| 540 LoadICNexus nexus(this, slot); |
| 541 os << " LOAD_IC " << Code::ICState2String(nexus.StateFromFeedback()); |
| 542 } else if (kind == Code::KEYED_LOAD_IC) { |
| 543 KeyedLoadICNexus nexus(this, slot); |
| 544 os << " KEYED_LOAD_IC " |
| 545 << Code::ICState2String(nexus.StateFromFeedback()); |
| 546 } else { |
| 547 DCHECK(kind == Code::CALL_IC); |
| 548 CallICNexus nexus(this, slot); |
| 549 os << " CALL_IC " << Code::ICState2String(nexus.StateFromFeedback()); |
| 550 } |
| 551 |
| 552 os << "\n [" << GetIndex(slot) << "]: " << Brief(Get(slot)); |
| 553 os << "\n [" << (GetIndex(slot) + 1) |
| 554 << "]: " << Brief(get(GetIndex(slot) + 1)); |
| 555 } |
| 556 } |
| 557 os << "\n"; |
| 558 } |
| 559 |
| 560 |
506 void JSValue::JSValuePrint(std::ostream& os) { // NOLINT | 561 void JSValue::JSValuePrint(std::ostream& os) { // NOLINT |
507 HeapObject::PrintHeader(os, "ValueObject"); | 562 HeapObject::PrintHeader(os, "ValueObject"); |
508 value()->Print(os); | 563 value()->Print(os); |
509 } | 564 } |
510 | 565 |
511 | 566 |
512 void JSMessageObject::JSMessageObjectPrint(std::ostream& os) { // NOLINT | 567 void JSMessageObject::JSMessageObjectPrint(std::ostream& os) { // NOLINT |
513 HeapObject::PrintHeader(os, "JSMessageObject"); | 568 HeapObject::PrintHeader(os, "JSMessageObject"); |
514 os << " - type: " << type(); | 569 os << " - type: " << type(); |
515 os << "\n - arguments: " << Brief(argument()); | 570 os << "\n - arguments: " << Brief(argument()); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 // os << "\n - script ="; | 809 // os << "\n - script ="; |
755 // script()->Print(os); | 810 // script()->Print(os); |
756 os << "\n - function token position = " << function_token_position(); | 811 os << "\n - function token position = " << function_token_position(); |
757 os << "\n - start position = " << start_position(); | 812 os << "\n - start position = " << start_position(); |
758 os << "\n - end position = " << end_position(); | 813 os << "\n - end position = " << end_position(); |
759 os << "\n - is expression = " << is_expression(); | 814 os << "\n - is expression = " << is_expression(); |
760 os << "\n - debug info = " << Brief(debug_info()); | 815 os << "\n - debug info = " << Brief(debug_info()); |
761 os << "\n - length = " << length(); | 816 os << "\n - length = " << length(); |
762 os << "\n - optimized_code_map = " << Brief(optimized_code_map()); | 817 os << "\n - optimized_code_map = " << Brief(optimized_code_map()); |
763 os << "\n - feedback_vector = "; | 818 os << "\n - feedback_vector = "; |
764 feedback_vector()->FixedArrayPrint(os); | 819 feedback_vector()->TypeFeedbackVectorPrint(os); |
765 os << "\n"; | 820 os << "\n"; |
766 } | 821 } |
767 | 822 |
768 | 823 |
769 void JSGlobalProxy::JSGlobalProxyPrint(std::ostream& os) { // NOLINT | 824 void JSGlobalProxy::JSGlobalProxyPrint(std::ostream& os) { // NOLINT |
770 os << "global_proxy "; | 825 os << "global_proxy "; |
771 JSObjectPrint(os); | 826 JSObjectPrint(os); |
772 os << "native context : " << Brief(native_context()); | 827 os << "native context : " << Brief(native_context()); |
773 os << "\n"; | 828 os << "\n"; |
774 } | 829 } |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 } | 1223 } |
1169 } | 1224 } |
1170 | 1225 |
1171 | 1226 |
1172 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT | 1227 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT |
1173 TransitionArray::PrintTransitions(os, map()->raw_transitions()); | 1228 TransitionArray::PrintTransitions(os, map()->raw_transitions()); |
1174 } | 1229 } |
1175 #endif // defined(DEBUG) || defined(OBJECT_PRINT) | 1230 #endif // defined(DEBUG) || defined(OBJECT_PRINT) |
1176 } // namespace internal | 1231 } // namespace internal |
1177 } // namespace v8 | 1232 } // namespace v8 |
OLD | NEW |