| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 base + (object_size >> kPointerSizeLog2) - kMinObjectSizeInWords); | 135 base + (object_size >> kPointerSizeLog2) - kMinObjectSizeInWords); |
| 136 | 136 |
| 137 return Min(specialization, generic); | 137 return Min(specialization, generic); |
| 138 } | 138 } |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 | 141 |
| 142 template<typename Callback> | 142 template<typename Callback> |
| 143 class VisitorDispatchTable { | 143 class VisitorDispatchTable { |
| 144 public: | 144 public: |
| 145 void CopyFrom(VisitorDispatchTable* other) { |
| 146 memcpy(callbacks_, |
| 147 other->callbacks_, |
| 148 kPointerSize*StaticVisitorBase::kVisitorIdCount); |
| 149 } |
| 150 |
| 145 inline Callback GetVisitor(Map* map) { | 151 inline Callback GetVisitor(Map* map) { |
| 146 return callbacks_[map->visitor_id()]; | 152 return callbacks_[map->visitor_id()]; |
| 147 } | 153 } |
| 148 | 154 |
| 149 void Register(StaticVisitorBase::VisitorId id, Callback callback) { | 155 void Register(StaticVisitorBase::VisitorId id, Callback callback) { |
| 150 ASSERT(id < StaticVisitorBase::kVisitorIdCount); // id is unsigned. | 156 ASSERT(id < StaticVisitorBase::kVisitorIdCount); // id is unsigned. |
| 151 callbacks_[id] = callback; | 157 callbacks_[id] = callback; |
| 152 } | 158 } |
| 153 | 159 |
| 154 template<typename Visitor, | 160 template<typename Visitor, |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 399 |
| 394 for (; !it.done(); it.next()) { | 400 for (; !it.done(); it.next()) { |
| 395 it.rinfo()->template Visit<StaticVisitor>(); | 401 it.rinfo()->template Visit<StaticVisitor>(); |
| 396 } | 402 } |
| 397 } | 403 } |
| 398 | 404 |
| 399 | 405 |
| 400 } } // namespace v8::internal | 406 } } // namespace v8::internal |
| 401 | 407 |
| 402 #endif // V8_OBJECTS_VISITING_H_ | 408 #endif // V8_OBJECTS_VISITING_H_ |
| OLD | NEW |