Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(604)

Side by Side Diff: src/assembler.cc

Issue 1232803002: Debugger: refactor reloc info. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix mips Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/assembler.h ('k') | src/builtins.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 } 442 }
443 next_position_candidate_flushed_ = false; 443 next_position_candidate_flushed_ = false;
444 } 444 }
445 last_position_ = static_cast<int>(rinfo->data()); 445 last_position_ = static_cast<int>(rinfo->data());
446 } else { 446 } else {
447 WriteModeAndPC(pc_delta, rmode); 447 WriteModeAndPC(pc_delta, rmode);
448 if (RelocInfo::IsComment(rmode)) { 448 if (RelocInfo::IsComment(rmode)) {
449 WriteData(rinfo->data()); 449 WriteData(rinfo->data());
450 } else if (RelocInfo::IsConstPool(rmode) || 450 } else if (RelocInfo::IsConstPool(rmode) ||
451 RelocInfo::IsVeneerPool(rmode) || 451 RelocInfo::IsVeneerPool(rmode) ||
452 RelocInfo::IsDebugBreakSlot(rmode)) { 452 RelocInfo::IsDebugBreakSlotAtCall(rmode)) {
453 WriteIntData(static_cast<int>(rinfo->data())); 453 WriteIntData(static_cast<int>(rinfo->data()));
454 } 454 }
455 } 455 }
456 last_pc_ = rinfo->pc(); 456 last_pc_ = rinfo->pc();
457 last_mode_ = rmode; 457 last_mode_ = rmode;
458 #ifdef DEBUG 458 #ifdef DEBUG
459 DCHECK(begin_pos - pos_ <= kMaxSize); 459 DCHECK(begin_pos - pos_ <= kMaxSize);
460 #endif 460 #endif
461 } 461 }
462 462
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 if (mode_mask_ & RelocInfo::kPositionMask) { 634 if (mode_mask_ & RelocInfo::kPositionMask) {
635 // Always update the position if we are interested in either 635 // Always update the position if we are interested in either
636 // statement positions or non-statement positions. 636 // statement positions or non-statement positions.
637 AdvanceReadPosition(); 637 AdvanceReadPosition();
638 if (SetMode(rmode)) return; 638 if (SetMode(rmode)) return;
639 } else { 639 } else {
640 Advance(kIntSize); 640 Advance(kIntSize);
641 } 641 }
642 } else if (RelocInfo::IsConstPool(rmode) || 642 } else if (RelocInfo::IsConstPool(rmode) ||
643 RelocInfo::IsVeneerPool(rmode) || 643 RelocInfo::IsVeneerPool(rmode) ||
644 RelocInfo::IsDebugBreakSlot(rmode)) { 644 RelocInfo::IsDebugBreakSlotAtCall(rmode)) {
645 if (SetMode(rmode)) { 645 if (SetMode(rmode)) {
646 AdvanceReadInt(); 646 AdvanceReadInt();
647 return; 647 return;
648 } 648 }
649 Advance(kIntSize); 649 Advance(kIntSize);
650 } else if (SetMode(static_cast<RelocInfo::Mode>(rmode))) { 650 } else if (SetMode(static_cast<RelocInfo::Mode>(rmode))) {
651 return; 651 return;
652 } 652 }
653 } 653 }
654 } 654 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) { 730 const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) {
731 switch (rmode) { 731 switch (rmode) {
732 case NONE32: 732 case NONE32:
733 return "no reloc 32"; 733 return "no reloc 32";
734 case NONE64: 734 case NONE64:
735 return "no reloc 64"; 735 return "no reloc 64";
736 case EMBEDDED_OBJECT: 736 case EMBEDDED_OBJECT:
737 return "embedded object"; 737 return "embedded object";
738 case CONSTRUCT_CALL: 738 case CONSTRUCT_CALL:
739 return "code target (js construct call)"; 739 return "code target (js construct call)";
740 case DEBUG_BREAK: 740 case DEBUGGER_STATEMENT:
741 return "debug break"; 741 return "debugger statement";
742 case CODE_TARGET: 742 case CODE_TARGET:
743 return "code target"; 743 return "code target";
744 case CODE_TARGET_WITH_ID: 744 case CODE_TARGET_WITH_ID:
745 return "code target with id"; 745 return "code target with id";
746 case CELL: 746 case CELL:
747 return "property cell"; 747 return "property cell";
748 case RUNTIME_ENTRY: 748 case RUNTIME_ENTRY:
749 return "runtime entry"; 749 return "runtime entry";
750 case JS_RETURN: 750 case JS_RETURN:
751 return "js return"; 751 return "js return";
752 case COMMENT: 752 case COMMENT:
753 return "comment"; 753 return "comment";
754 case POSITION: 754 case POSITION:
755 return "position"; 755 return "position";
756 case STATEMENT_POSITION: 756 case STATEMENT_POSITION:
757 return "statement position"; 757 return "statement position";
758 case EXTERNAL_REFERENCE: 758 case EXTERNAL_REFERENCE:
759 return "external reference"; 759 return "external reference";
760 case INTERNAL_REFERENCE: 760 case INTERNAL_REFERENCE:
761 return "internal reference"; 761 return "internal reference";
762 case INTERNAL_REFERENCE_ENCODED: 762 case INTERNAL_REFERENCE_ENCODED:
763 return "encoded internal reference"; 763 return "encoded internal reference";
764 case DEOPT_REASON: 764 case DEOPT_REASON:
765 return "deopt reason"; 765 return "deopt reason";
766 case CONST_POOL: 766 case CONST_POOL:
767 return "constant pool"; 767 return "constant pool";
768 case VENEER_POOL: 768 case VENEER_POOL:
769 return "veneer pool"; 769 return "veneer pool";
770 case DEBUG_BREAK_SLOT: 770 case DEBUG_BREAK_SLOT_AT_POSITION:
771 return "debug break slot"; 771 return "debug break slot at position";
772 case DEBUG_BREAK_SLOT_AT_CALL:
773 return "debug break slot at call";
774 case DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL:
775 return "debug break slot at construct call";
772 case CODE_AGE_SEQUENCE: 776 case CODE_AGE_SEQUENCE:
773 return "code_age_sequence"; 777 return "code_age_sequence";
774 case NUMBER_OF_MODES: 778 case NUMBER_OF_MODES:
775 case PC_JUMP: 779 case PC_JUMP:
776 UNREACHABLE(); 780 UNREACHABLE();
777 return "number_of_modes"; 781 return "number_of_modes";
778 } 782 }
779 return "unknown relocation type"; 783 return "unknown relocation type";
780 } 784 }
781 785
(...skipping 25 matching lines...) Expand all
807 } else if (IsRuntimeEntry(rmode_) && 811 } else if (IsRuntimeEntry(rmode_) &&
808 isolate->deoptimizer_data() != NULL) { 812 isolate->deoptimizer_data() != NULL) {
809 // Depotimization bailouts are stored as runtime entries. 813 // Depotimization bailouts are stored as runtime entries.
810 int id = Deoptimizer::GetDeoptimizationId( 814 int id = Deoptimizer::GetDeoptimizationId(
811 isolate, target_address(), Deoptimizer::EAGER); 815 isolate, target_address(), Deoptimizer::EAGER);
812 if (id != Deoptimizer::kNotDeoptimizationEntry) { 816 if (id != Deoptimizer::kNotDeoptimizationEntry) {
813 os << " (deoptimization bailout " << id << ")"; 817 os << " (deoptimization bailout " << id << ")";
814 } 818 }
815 } else if (IsConstPool(rmode_)) { 819 } else if (IsConstPool(rmode_)) {
816 os << " (size " << static_cast<int>(data_) << ")"; 820 os << " (size " << static_cast<int>(data_) << ")";
817 } else if (IsDebugBreakSlot(rmode_)) {
818 if (DebugBreakIsCall(data_)) {
819 os << " (call with " << DebugBreakCallArgumentsCount(data_) << " args)";
820 } else if (DebugBreakIsConstructCall(data_)) {
821 os << " (construct call)";
822 } else {
823 os << " (slot)";
824 }
825 } 821 }
826 822
827 os << "\n"; 823 os << "\n";
828 } 824 }
829 #endif // ENABLE_DISASSEMBLER 825 #endif // ENABLE_DISASSEMBLER
830 826
831 827
832 #ifdef VERIFY_HEAP 828 #ifdef VERIFY_HEAP
833 void RelocInfo::Verify(Isolate* isolate) { 829 void RelocInfo::Verify(Isolate* isolate) {
834 switch (rmode_) { 830 switch (rmode_) {
835 case EMBEDDED_OBJECT: 831 case EMBEDDED_OBJECT:
836 Object::VerifyPointer(target_object()); 832 Object::VerifyPointer(target_object());
837 break; 833 break;
838 case CELL: 834 case CELL:
839 Object::VerifyPointer(target_cell()); 835 Object::VerifyPointer(target_cell());
840 break; 836 break;
841 case DEBUG_BREAK: 837 case DEBUGGER_STATEMENT:
842 case CONSTRUCT_CALL: 838 case CONSTRUCT_CALL:
843 case CODE_TARGET_WITH_ID: 839 case CODE_TARGET_WITH_ID:
844 case CODE_TARGET: { 840 case CODE_TARGET: {
845 // convert inline target address to code object 841 // convert inline target address to code object
846 Address addr = target_address(); 842 Address addr = target_address();
847 CHECK(addr != NULL); 843 CHECK(addr != NULL);
848 // Check that we can find the right code object. 844 // Check that we can find the right code object.
849 Code* code = Code::GetCodeFromTargetAddress(addr); 845 Code* code = Code::GetCodeFromTargetAddress(addr);
850 Object* found = isolate->FindCodeObject(addr); 846 Object* found = isolate->FindCodeObject(addr);
851 CHECK(found->IsCode()); 847 CHECK(found->IsCode());
(...skipping 11 matching lines...) Expand all
863 } 859 }
864 case RUNTIME_ENTRY: 860 case RUNTIME_ENTRY:
865 case JS_RETURN: 861 case JS_RETURN:
866 case COMMENT: 862 case COMMENT:
867 case POSITION: 863 case POSITION:
868 case STATEMENT_POSITION: 864 case STATEMENT_POSITION:
869 case EXTERNAL_REFERENCE: 865 case EXTERNAL_REFERENCE:
870 case DEOPT_REASON: 866 case DEOPT_REASON:
871 case CONST_POOL: 867 case CONST_POOL:
872 case VENEER_POOL: 868 case VENEER_POOL:
873 case DEBUG_BREAK_SLOT: 869 case DEBUG_BREAK_SLOT_AT_POSITION:
870 case DEBUG_BREAK_SLOT_AT_CALL:
871 case DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL:
874 case NONE32: 872 case NONE32:
875 case NONE64: 873 case NONE64:
876 break; 874 break;
877 case NUMBER_OF_MODES: 875 case NUMBER_OF_MODES:
878 case PC_JUMP: 876 case PC_JUMP:
879 UNREACHABLE(); 877 UNREACHABLE();
880 break; 878 break;
881 case CODE_AGE_SEQUENCE: 879 case CODE_AGE_SEQUENCE:
882 DCHECK(Code::IsYoungSequence(isolate, pc_) || code_age_stub()->IsCode()); 880 DCHECK(Code::IsYoungSequence(isolate, pc_) || code_age_stub()->IsCode());
883 break; 881 break;
884 } 882 }
885 } 883 }
886 #endif // VERIFY_HEAP 884 #endif // VERIFY_HEAP
887 885
888 886
889 bool RelocInfo::DebugBreakIsConstructCall(intptr_t data) {
890 return data == static_cast<intptr_t>(kDebugBreakConstructCallSentinel);
891 }
892
893
894 bool RelocInfo::DebugBreakIsCall(intptr_t data) { return data >= 0; }
895
896
897 int RelocInfo::DebugBreakCallArgumentsCount(intptr_t data) { 887 int RelocInfo::DebugBreakCallArgumentsCount(intptr_t data) {
898 DCHECK(DebugBreakIsCall(data));
899 return static_cast<int>(data); 888 return static_cast<int>(data);
900 } 889 }
901 890
902 891
903 // ----------------------------------------------------------------------------- 892 // -----------------------------------------------------------------------------
904 // Implementation of ExternalReference 893 // Implementation of ExternalReference
905 894
906 void ExternalReference::SetUp() { 895 void ExternalReference::SetUp() {
907 double_constants.min_int = kMinInt; 896 double_constants.min_int = kMinInt;
908 double_constants.one_half = 0.5; 897 double_constants.one_half = 0.5;
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1816 1805
1817 void Assembler::RecordJSReturn() { 1806 void Assembler::RecordJSReturn() {
1818 positions_recorder()->WriteRecordedPositions(); 1807 positions_recorder()->WriteRecordedPositions();
1819 EnsureSpace ensure_space(this); 1808 EnsureSpace ensure_space(this);
1820 RecordRelocInfo(RelocInfo::JS_RETURN); 1809 RecordRelocInfo(RelocInfo::JS_RETURN);
1821 } 1810 }
1822 1811
1823 1812
1824 void Assembler::RecordDebugBreakSlot() { 1813 void Assembler::RecordDebugBreakSlot() {
1825 EnsureSpace ensure_space(this); 1814 EnsureSpace ensure_space(this);
1826 intptr_t data = static_cast<intptr_t>(RelocInfo::kDebugBreakNonCallSentinel); 1815 RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION);
1827 RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT, data);
1828 } 1816 }
1829 1817
1830 1818
1831 void Assembler::RecordDebugBreakSlotForCall(int argc) { 1819 void Assembler::RecordDebugBreakSlotForCall(int argc) {
1832 EnsureSpace ensure_space(this); 1820 EnsureSpace ensure_space(this);
1833 intptr_t data = static_cast<intptr_t>(argc); 1821 intptr_t data = static_cast<intptr_t>(argc);
1834 RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT, data); 1822 RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT_AT_CALL, data);
1835 } 1823 }
1836 1824
1837 1825
1838 void Assembler::RecordDebugBreakSlotForConstructCall() { 1826 void Assembler::RecordDebugBreakSlotForConstructCall() {
1839 EnsureSpace ensure_space(this); 1827 EnsureSpace ensure_space(this);
1840 intptr_t data = 1828 RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL);
1841 static_cast<intptr_t>(RelocInfo::kDebugBreakConstructCallSentinel);
1842 RecordRelocInfo(RelocInfo::DEBUG_BREAK_SLOT, data);
1843 } 1829 }
1844 1830
1845 1831
1846 void Assembler::DataAlign(int m) { 1832 void Assembler::DataAlign(int m) {
1847 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); 1833 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m));
1848 while ((pc_offset() & (m - 1)) != 0) { 1834 while ((pc_offset() & (m - 1)) != 0) {
1849 db(0); 1835 db(0);
1850 } 1836 }
1851 } 1837 }
1852 } // namespace internal 1838 } // namespace internal
1853 } // namespace v8 1839 } // namespace v8
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698