| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 void Code::CodeIterateBody(ObjectVisitor* v) { | 98 void Code::CodeIterateBody(ObjectVisitor* v) { |
| 99 int mode_mask = RelocInfo::kCodeTargetMask | | 99 int mode_mask = RelocInfo::kCodeTargetMask | |
| 100 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 100 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 101 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | | 101 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | |
| 102 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | 102 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | |
| 103 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | | 103 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | |
| 104 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | | 104 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | |
| 105 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); | 105 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); |
| 106 | 106 |
| 107 // There are two places where we iterate code bodies: here and the |
| 108 // templated CodeIterateBody (below). They should be kept in sync. |
| 107 IteratePointer(v, kRelocationInfoOffset); | 109 IteratePointer(v, kRelocationInfoOffset); |
| 110 IteratePointer(v, kHandlerTableOffset); |
| 108 IteratePointer(v, kDeoptimizationDataOffset); | 111 IteratePointer(v, kDeoptimizationDataOffset); |
| 109 | 112 |
| 110 RelocIterator it(this, mode_mask); | 113 RelocIterator it(this, mode_mask); |
| 111 for (; !it.done(); it.next()) { | 114 for (; !it.done(); it.next()) { |
| 112 it.rinfo()->Visit(v); | 115 it.rinfo()->Visit(v); |
| 113 } | 116 } |
| 114 } | 117 } |
| 115 | 118 |
| 116 | 119 |
| 117 template<typename StaticVisitor> | 120 template<typename StaticVisitor> |
| 118 void Code::CodeIterateBody(Heap* heap) { | 121 void Code::CodeIterateBody(Heap* heap) { |
| 119 int mode_mask = RelocInfo::kCodeTargetMask | | 122 int mode_mask = RelocInfo::kCodeTargetMask | |
| 120 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 123 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 121 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | | 124 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | |
| 122 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | 125 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | |
| 123 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | | 126 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | |
| 124 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | | 127 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | |
| 125 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); | 128 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); |
| 126 | 129 |
| 130 // There are two places where we iterate code bodies: here and the |
| 131 // non-templated CodeIterateBody (above). They should be kept in sync. |
| 127 StaticVisitor::VisitPointer( | 132 StaticVisitor::VisitPointer( |
| 128 heap, | 133 heap, |
| 129 reinterpret_cast<Object**>(this->address() + kRelocationInfoOffset)); | 134 reinterpret_cast<Object**>(this->address() + kRelocationInfoOffset)); |
| 130 StaticVisitor::VisitPointer( | 135 StaticVisitor::VisitPointer( |
| 131 heap, | 136 heap, |
| 137 reinterpret_cast<Object**>(this->address() + kHandlerTableOffset)); |
| 138 StaticVisitor::VisitPointer( |
| 139 heap, |
| 132 reinterpret_cast<Object**>(this->address() + kDeoptimizationDataOffset)); | 140 reinterpret_cast<Object**>(this->address() + kDeoptimizationDataOffset)); |
| 133 | 141 |
| 134 RelocIterator it(this, mode_mask); | 142 RelocIterator it(this, mode_mask); |
| 135 for (; !it.done(); it.next()) { | 143 for (; !it.done(); it.next()) { |
| 136 it.rinfo()->template Visit<StaticVisitor>(heap); | 144 it.rinfo()->template Visit<StaticVisitor>(heap); |
| 137 } | 145 } |
| 138 } | 146 } |
| 139 | 147 |
| 140 | 148 |
| 141 } } // namespace v8::internal | 149 } } // namespace v8::internal |
| 142 | 150 |
| 143 #endif // V8_OBJECTS_VISITING_INL_H_ | 151 #endif // V8_OBJECTS_VISITING_INL_H_ |
| OLD | NEW |