| 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 | 140 |
| 141 template<typename Callback> | 141 template<typename Callback> |
| 142 class VisitorDispatchTable { | 142 class VisitorDispatchTable { |
| 143 public: | 143 public: |
| 144 inline Callback GetVisitor(Map* map) { | 144 inline Callback GetVisitor(Map* map) { |
| 145 return callbacks_[map->visitor_id()]; | 145 return callbacks_[map->visitor_id()]; |
| 146 } | 146 } |
| 147 | 147 |
| 148 void Register(StaticVisitorBase::VisitorId id, Callback callback) { | 148 void Register(StaticVisitorBase::VisitorId id, Callback callback) { |
| 149 ASSERT((0 <= id) && (id < StaticVisitorBase::kVisitorIdCount)); | 149 ASSERT(id < StaticVisitorBase::kVisitorIdCount); // id is unsigned. |
| 150 callbacks_[id] = callback; | 150 callbacks_[id] = callback; |
| 151 } | 151 } |
| 152 | 152 |
| 153 template<typename Visitor, | 153 template<typename Visitor, |
| 154 StaticVisitorBase::VisitorId base, | 154 StaticVisitorBase::VisitorId base, |
| 155 StaticVisitorBase::VisitorId generic, | 155 StaticVisitorBase::VisitorId generic, |
| 156 int object_size_in_words> | 156 int object_size_in_words> |
| 157 void RegisterSpecialization() { | 157 void RegisterSpecialization() { |
| 158 static const int size = object_size_in_words * kPointerSize; | 158 static const int size = object_size_in_words * kPointerSize; |
| 159 Register(StaticVisitorBase::GetVisitorIdForSize(base, generic, size), | 159 Register(StaticVisitorBase::GetVisitorIdForSize(base, generic, size), |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 392 |
| 393 for (; !it.done(); it.next()) { | 393 for (; !it.done(); it.next()) { |
| 394 it.rinfo()->template Visit<StaticVisitor>(); | 394 it.rinfo()->template Visit<StaticVisitor>(); |
| 395 } | 395 } |
| 396 } | 396 } |
| 397 | 397 |
| 398 | 398 |
| 399 } } // namespace v8::internal | 399 } } // namespace v8::internal |
| 400 | 400 |
| 401 #endif // V8_OBJECTS_VISITING_H_ | 401 #endif // V8_OBJECTS_VISITING_H_ |
| OLD | NEW |