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

Side by Side Diff: src/liveedit.cc

Issue 3156028: Change code pointer in function objects to a pointer to the first... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/mark-compact.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 } 743 }
744 } 744 }
745 745
746 746
747 // Visitor that collects all references to a particular code object, 747 // Visitor that collects all references to a particular code object,
748 // including "CODE_TARGET" references in other code objects. 748 // including "CODE_TARGET" references in other code objects.
749 // It works in context of ZoneScope. 749 // It works in context of ZoneScope.
750 class ReferenceCollectorVisitor : public ObjectVisitor { 750 class ReferenceCollectorVisitor : public ObjectVisitor {
751 public: 751 public:
752 explicit ReferenceCollectorVisitor(Code* original) 752 explicit ReferenceCollectorVisitor(Code* original)
753 : original_(original), rvalues_(10), reloc_infos_(10) { 753 : original_(original), rvalues_(10), reloc_infos_(10), code_entries_(10) {
754 } 754 }
755 755
756 virtual void VisitPointers(Object** start, Object** end) { 756 virtual void VisitPointers(Object** start, Object** end) {
757 for (Object** p = start; p < end; p++) { 757 for (Object** p = start; p < end; p++) {
758 if (*p == original_) { 758 if (*p == original_) {
759 rvalues_.Add(p); 759 rvalues_.Add(p);
760 } 760 }
761 } 761 }
762 } 762 }
763 763
764 void VisitCodeTarget(RelocInfo* rinfo) { 764 virtual void VisitCodeEntry(Address entry) {
765 if (Code::GetObjectFromEntryAddress(entry) == original_) {
766 code_entries_.Add(entry);
767 }
768 }
769
770 virtual void VisitCodeTarget(RelocInfo* rinfo) {
765 if (RelocInfo::IsCodeTarget(rinfo->rmode()) && 771 if (RelocInfo::IsCodeTarget(rinfo->rmode()) &&
766 Code::GetCodeFromTargetAddress(rinfo->target_address()) == original_) { 772 Code::GetCodeFromTargetAddress(rinfo->target_address()) == original_) {
767 reloc_infos_.Add(*rinfo); 773 reloc_infos_.Add(*rinfo);
768 } 774 }
769 } 775 }
770 776
771 virtual void VisitDebugTarget(RelocInfo* rinfo) { 777 virtual void VisitDebugTarget(RelocInfo* rinfo) {
772 VisitCodeTarget(rinfo); 778 VisitCodeTarget(rinfo);
773 } 779 }
774 780
775 // Post-visiting method that iterates over all collected references and 781 // Post-visiting method that iterates over all collected references and
776 // modifies them. 782 // modifies them.
777 void Replace(Code* substitution) { 783 void Replace(Code* substitution) {
778 for (int i = 0; i < rvalues_.length(); i++) { 784 for (int i = 0; i < rvalues_.length(); i++) {
779 *(rvalues_[i]) = substitution; 785 *(rvalues_[i]) = substitution;
780 } 786 }
787 Address substitution_entry = substitution->instruction_start();
781 for (int i = 0; i < reloc_infos_.length(); i++) { 788 for (int i = 0; i < reloc_infos_.length(); i++) {
782 reloc_infos_[i].set_target_address(substitution->instruction_start()); 789 reloc_infos_[i].set_target_address(substitution_entry);
790 }
791 for (int i = 0; i < code_entries_.length(); i++) {
792 Address entry = code_entries_[i];
793 Memory::Address_at(entry) = substitution_entry;
783 } 794 }
784 } 795 }
785 796
786 private: 797 private:
787 Code* original_; 798 Code* original_;
788 ZoneList<Object**> rvalues_; 799 ZoneList<Object**> rvalues_;
789 ZoneList<RelocInfo> reloc_infos_; 800 ZoneList<RelocInfo> reloc_infos_;
801 ZoneList<Address> code_entries_;
790 }; 802 };
791 803
792 804
793 class FrameCookingThreadVisitor : public ThreadVisitor { 805 class FrameCookingThreadVisitor : public ThreadVisitor {
794 public: 806 public:
795 void VisitThread(ThreadLocalTop* top) { 807 void VisitThread(ThreadLocalTop* top) {
796 StackFrame::CookFramesForThread(top); 808 StackFrame::CookFramesForThread(top);
797 } 809 }
798 }; 810 };
799 811
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 1506
1495 bool LiveEditFunctionTracker::IsActive() { 1507 bool LiveEditFunctionTracker::IsActive() {
1496 return false; 1508 return false;
1497 } 1509 }
1498 1510
1499 #endif // ENABLE_DEBUGGER_SUPPORT 1511 #endif // ENABLE_DEBUGGER_SUPPORT
1500 1512
1501 1513
1502 1514
1503 } } // namespace v8::internal 1515 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698