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