| 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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 } | 628 } |
| 629 | 629 |
| 630 | 630 |
| 631 void Code::CodeIterateBody(ObjectVisitor* v) { | 631 void Code::CodeIterateBody(ObjectVisitor* v) { |
| 632 int mode_mask = RelocInfo::kCodeTargetMask | | 632 int mode_mask = RelocInfo::kCodeTargetMask | |
| 633 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 633 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 634 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | | 634 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | |
| 635 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | 635 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | |
| 636 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | | 636 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | |
| 637 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | | 637 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | |
| 638 #if defined(V8_TARGET_ARCH_X64) |
| 639 RelocInfo::ModeMask(RelocInfo::DEOPT_ENTRY) | |
| 640 #endif |
| 638 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); | 641 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); |
| 639 | 642 |
| 640 // There are two places where we iterate code bodies: here and the | 643 // There are two places where we iterate code bodies: here and the |
| 641 // templated CodeIterateBody (below). They should be kept in sync. | 644 // templated CodeIterateBody (below). They should be kept in sync. |
| 642 IteratePointer(v, kRelocationInfoOffset); | 645 IteratePointer(v, kRelocationInfoOffset); |
| 643 IteratePointer(v, kHandlerTableOffset); | 646 IteratePointer(v, kHandlerTableOffset); |
| 644 IteratePointer(v, kDeoptimizationDataOffset); | 647 IteratePointer(v, kDeoptimizationDataOffset); |
| 645 IteratePointer(v, kTypeFeedbackInfoOffset); | 648 IteratePointer(v, kTypeFeedbackInfoOffset); |
| 646 | 649 |
| 647 RelocIterator it(this, mode_mask); | 650 RelocIterator it(this, mode_mask); |
| 648 for (; !it.done(); it.next()) { | 651 for (; !it.done(); it.next()) { |
| 649 it.rinfo()->Visit(v); | 652 it.rinfo()->Visit(v); |
| 650 } | 653 } |
| 651 } | 654 } |
| 652 | 655 |
| 653 | 656 |
| 654 template<typename StaticVisitor> | 657 template<typename StaticVisitor> |
| 655 void Code::CodeIterateBody(Heap* heap) { | 658 void Code::CodeIterateBody(Heap* heap) { |
| 656 int mode_mask = RelocInfo::kCodeTargetMask | | 659 int mode_mask = RelocInfo::kCodeTargetMask | |
| 657 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 660 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 658 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | | 661 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | |
| 659 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | 662 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | |
| 660 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | | 663 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | |
| 661 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | | 664 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | |
| 665 #if defined(V8_TARGET_ARCH_X64) |
| 666 RelocInfo::ModeMask(RelocInfo::DEOPT_ENTRY) | |
| 667 #endif |
| 662 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); | 668 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); |
| 663 | 669 |
| 664 // There are two places where we iterate code bodies: here and the | 670 // There are two places where we iterate code bodies: here and the |
| 665 // non-templated CodeIterateBody (above). They should be kept in sync. | 671 // non-templated CodeIterateBody (above). They should be kept in sync. |
| 666 StaticVisitor::VisitPointer( | 672 StaticVisitor::VisitPointer( |
| 667 heap, | 673 heap, |
| 668 reinterpret_cast<Object**>(this->address() + kRelocationInfoOffset)); | 674 reinterpret_cast<Object**>(this->address() + kRelocationInfoOffset)); |
| 669 StaticVisitor::VisitPointer( | 675 StaticVisitor::VisitPointer( |
| 670 heap, | 676 heap, |
| 671 reinterpret_cast<Object**>(this->address() + kHandlerTableOffset)); | 677 reinterpret_cast<Object**>(this->address() + kHandlerTableOffset)); |
| 672 StaticVisitor::VisitPointer( | 678 StaticVisitor::VisitPointer( |
| 673 heap, | 679 heap, |
| 674 reinterpret_cast<Object**>(this->address() + kDeoptimizationDataOffset)); | 680 reinterpret_cast<Object**>(this->address() + kDeoptimizationDataOffset)); |
| 675 StaticVisitor::VisitPointer( | 681 StaticVisitor::VisitPointer( |
| 676 heap, | 682 heap, |
| 677 reinterpret_cast<Object**>(this->address() + kTypeFeedbackInfoOffset)); | 683 reinterpret_cast<Object**>(this->address() + kTypeFeedbackInfoOffset)); |
| 678 | 684 |
| 679 RelocIterator it(this, mode_mask); | 685 RelocIterator it(this, mode_mask); |
| 680 for (; !it.done(); it.next()) { | 686 for (; !it.done(); it.next()) { |
| 681 it.rinfo()->template Visit<StaticVisitor>(heap); | 687 it.rinfo()->template Visit<StaticVisitor>(heap); |
| 682 } | 688 } |
| 683 } | 689 } |
| 684 | 690 |
| 685 | 691 |
| 686 } } // namespace v8::internal | 692 } } // namespace v8::internal |
| 687 | 693 |
| 688 #endif // V8_OBJECTS_VISITING_INL_H_ | 694 #endif // V8_OBJECTS_VISITING_INL_H_ |
| OLD | NEW |