OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 273 |
274 template <typename T, void (T::*method)(Visitor*)> | 274 template <typename T, void (T::*method)(Visitor*)> |
275 void registerWeakMembers(const T* obj) { | 275 void registerWeakMembers(const T* obj) { |
276 registerWeakMembers(obj, &TraceMethodDelegate<T, method>::trampoline); | 276 registerWeakMembers(obj, &TraceMethodDelegate<T, method>::trampoline); |
277 } | 277 } |
278 | 278 |
279 void registerWeakMembers(const void* object, WeakCallback callback) { | 279 void registerWeakMembers(const void* object, WeakCallback callback) { |
280 Derived::fromHelper(this)->registerWeakMembers(object, object, callback); | 280 Derived::fromHelper(this)->registerWeakMembers(object, object, callback); |
281 } | 281 } |
282 | 282 |
283 template <typename T> | 283 void registerBackingStoreReference(void* slot) { |
284 void registerBackingStoreReference(T** slot) { | 284 if (getMarkingMode() != VisitorMarkingMode::GlobalMarkingWithCompaction) |
| 285 return; |
285 Derived::fromHelper(this)->registerMovingObjectReference( | 286 Derived::fromHelper(this)->registerMovingObjectReference( |
286 reinterpret_cast<MovableReference*>(slot)); | 287 reinterpret_cast<MovableReference*>(slot)); |
287 } | 288 } |
288 | 289 |
289 template <typename T> | 290 void registerBackingStoreCallback(void* backingStore, |
290 void registerBackingStoreCallback(T* backingStore, | |
291 MovingObjectCallback callback, | 291 MovingObjectCallback callback, |
292 void* callbackData) { | 292 void* callbackData) { |
| 293 if (getMarkingMode() != VisitorMarkingMode::GlobalMarkingWithCompaction) |
| 294 return; |
293 Derived::fromHelper(this)->registerMovingObjectCallback( | 295 Derived::fromHelper(this)->registerMovingObjectCallback( |
294 reinterpret_cast<MovableReference>(backingStore), callback, | 296 reinterpret_cast<MovableReference>(backingStore), callback, |
295 callbackData); | 297 callbackData); |
296 } | 298 } |
297 | 299 |
298 inline ThreadState* state() const { return m_state; } | 300 inline ThreadState* state() const { return m_state; } |
299 inline ThreadHeap& heap() const { return state()->heap(); } | 301 inline ThreadHeap& heap() const { return state()->heap(); } |
300 | 302 |
301 inline VisitorMarkingMode getMarkingMode() const { return m_markingMode; } | 303 inline VisitorMarkingMode getMarkingMode() const { return m_markingMode; } |
302 | 304 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 400 |
399 private: | 401 private: |
400 static Visitor* fromHelper(VisitorHelper<Visitor>* helper) { | 402 static Visitor* fromHelper(VisitorHelper<Visitor>* helper) { |
401 return static_cast<Visitor*>(helper); | 403 return static_cast<Visitor*>(helper); |
402 } | 404 } |
403 }; | 405 }; |
404 | 406 |
405 } // namespace blink | 407 } // namespace blink |
406 | 408 |
407 #endif // Visitor_h | 409 #endif // Visitor_h |
OLD | NEW |