OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 template<typename Callback> | 140 template<typename Callback> |
141 class VisitorDispatchTable { | 141 class VisitorDispatchTable { |
142 public: | 142 public: |
143 inline Callback GetVisitor(Map* map) { | 143 inline Callback GetVisitor(Map* map) { |
144 return callbacks_[map->visitor_id()]; | 144 return callbacks_[map->visitor_id()]; |
145 } | 145 } |
146 | 146 |
147 void Register(StaticVisitorBase::VisitorId id, Callback callback) { | 147 void Register(StaticVisitorBase::VisitorId id, Callback callback) { |
148 ASSERT((0 <= id) && (id < StaticVisitorBase::kVisitorIdCount)); | 148 ASSERT((0 <= id) && (id < StaticVisitorBase::kVisitorIdCount)); |
149 callbacks_[id] = callback; | 149 if (callbacks_[id] != callback) callbacks_[id] = callback; |
150 } | 150 } |
151 | 151 |
152 template<typename Visitor, | 152 template<typename Visitor, |
153 StaticVisitorBase::VisitorId base, | 153 StaticVisitorBase::VisitorId base, |
154 StaticVisitorBase::VisitorId generic, | 154 StaticVisitorBase::VisitorId generic, |
155 int object_size_in_words> | 155 int object_size_in_words> |
156 void RegisterSpecialization() { | 156 void RegisterSpecialization() { |
157 static const int size = object_size_in_words * kPointerSize; | 157 static const int size = object_size_in_words * kPointerSize; |
158 Register(StaticVisitorBase::GetVisitorIdForSize(base, generic, size), | 158 Register(StaticVisitorBase::GetVisitorIdForSize(base, generic, size), |
159 &Visitor::template VisitSpecialized<size>); | 159 &Visitor::template VisitSpecialized<size>); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 380 |
381 StaticVisitor::VisitPointer( | 381 StaticVisitor::VisitPointer( |
382 reinterpret_cast<Object**>(this->address() + kRelocationInfoOffset)); | 382 reinterpret_cast<Object**>(this->address() + kRelocationInfoOffset)); |
383 | 383 |
384 for (; !it.done(); it.next()) { | 384 for (; !it.done(); it.next()) { |
385 it.rinfo()->template Visit<StaticVisitor>(); | 385 it.rinfo()->template Visit<StaticVisitor>(); |
386 } | 386 } |
387 } | 387 } |
388 | 388 |
389 | 389 |
| 390 template<typename StaticVisitor, typename Data> |
| 391 void Code::CodeIterateBody(Data data) { |
| 392 int mode_mask = RelocInfo::kCodeTargetMask | |
| 393 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 394 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | |
| 395 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | |
| 396 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | |
| 397 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); |
| 398 |
| 399 // Use the relocation info pointer before it is visited by |
| 400 // the heap compaction in the next statement. |
| 401 RelocIterator it(this, mode_mask); |
| 402 |
| 403 StaticVisitor::VisitPointer( |
| 404 reinterpret_cast<Object**>(this->address() + kRelocationInfoOffset), data)
; |
| 405 |
| 406 for (; !it.done(); it.next()) { |
| 407 it.rinfo()->template Visit<StaticVisitor, Data>(data); |
| 408 } |
| 409 } |
| 410 |
| 411 |
| 412 |
390 } } // namespace v8::internal | 413 } } // namespace v8::internal |
391 | 414 |
392 #endif // V8_OBJECTS_VISITING_H_ | 415 #endif // V8_OBJECTS_VISITING_H_ |
OLD | NEW |