OLD | NEW |
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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 } | 795 } |
796 | 796 |
797 private: | 797 private: |
798 Code* original_; | 798 Code* original_; |
799 ZoneList<Object**> rvalues_; | 799 ZoneList<Object**> rvalues_; |
800 ZoneList<RelocInfo> reloc_infos_; | 800 ZoneList<RelocInfo> reloc_infos_; |
801 ZoneList<Address> code_entries_; | 801 ZoneList<Address> code_entries_; |
802 }; | 802 }; |
803 | 803 |
804 | 804 |
805 class FrameCookingThreadVisitor : public ThreadVisitor { | |
806 public: | |
807 void VisitThread(ThreadLocalTop* top) { | |
808 StackFrame::CookFramesForThread(top); | |
809 } | |
810 }; | |
811 | |
812 class FrameUncookingThreadVisitor : public ThreadVisitor { | |
813 public: | |
814 void VisitThread(ThreadLocalTop* top) { | |
815 StackFrame::UncookFramesForThread(top); | |
816 } | |
817 }; | |
818 | |
819 static void IterateAllThreads(ThreadVisitor* visitor) { | |
820 Top::IterateThread(visitor); | |
821 ThreadManager::IterateArchivedThreads(visitor); | |
822 } | |
823 | |
824 // Finds all references to original and replaces them with substitution. | 805 // Finds all references to original and replaces them with substitution. |
825 static void ReplaceCodeObject(Code* original, Code* substitution) { | 806 static void ReplaceCodeObject(Code* original, Code* substitution) { |
826 ASSERT(!Heap::InNewSpace(substitution)); | 807 ASSERT(!Heap::InNewSpace(substitution)); |
827 | 808 |
828 AssertNoAllocation no_allocations_please; | 809 AssertNoAllocation no_allocations_please; |
829 | 810 |
830 // A zone scope for ReferenceCollectorVisitor. | 811 // A zone scope for ReferenceCollectorVisitor. |
831 ZoneScope scope(DELETE_ON_EXIT); | 812 ZoneScope scope(DELETE_ON_EXIT); |
832 | 813 |
833 ReferenceCollectorVisitor visitor(original); | 814 ReferenceCollectorVisitor visitor(original); |
834 | 815 |
835 // Iterate over all roots. Stack frames may have pointer into original code, | 816 // Iterate over all roots. Stack frames may have pointer into original code, |
836 // so temporary replace the pointers with offset numbers | 817 // so temporary replace the pointers with offset numbers |
837 // in prologue/epilogue. | 818 // in prologue/epilogue. |
838 { | 819 { |
839 FrameCookingThreadVisitor cooking_visitor; | |
840 IterateAllThreads(&cooking_visitor); | |
841 | |
842 Heap::IterateStrongRoots(&visitor, VISIT_ALL); | 820 Heap::IterateStrongRoots(&visitor, VISIT_ALL); |
843 | |
844 FrameUncookingThreadVisitor uncooking_visitor; | |
845 IterateAllThreads(&uncooking_visitor); | |
846 } | 821 } |
847 | 822 |
848 // Now iterate over all pointers of all objects, including code_target | 823 // Now iterate over all pointers of all objects, including code_target |
849 // implicit pointers. | 824 // implicit pointers. |
850 HeapIterator iterator; | 825 HeapIterator iterator; |
851 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 826 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
852 obj->Iterate(&visitor); | 827 obj->Iterate(&visitor); |
853 } | 828 } |
854 | 829 |
855 visitor.Replace(substitution); | 830 visitor.Replace(substitution); |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1506 | 1481 |
1507 bool LiveEditFunctionTracker::IsActive() { | 1482 bool LiveEditFunctionTracker::IsActive() { |
1508 return false; | 1483 return false; |
1509 } | 1484 } |
1510 | 1485 |
1511 #endif // ENABLE_DEBUGGER_SUPPORT | 1486 #endif // ENABLE_DEBUGGER_SUPPORT |
1512 | 1487 |
1513 | 1488 |
1514 | 1489 |
1515 } } // namespace v8::internal | 1490 } } // namespace v8::internal |
OLD | NEW |