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 24 matching lines...) Expand all Loading... |
35 #include "platform/heap/GarbageCollected.h" | 35 #include "platform/heap/GarbageCollected.h" |
36 #include "platform/heap/StackFrameDepth.h" | 36 #include "platform/heap/StackFrameDepth.h" |
37 #include "platform/heap/ThreadState.h" | 37 #include "platform/heap/ThreadState.h" |
38 #include "wtf/Assertions.h" | 38 #include "wtf/Assertions.h" |
39 #include "wtf/Atomics.h" | 39 #include "wtf/Atomics.h" |
40 #include "wtf/Deque.h" | 40 #include "wtf/Deque.h" |
41 #include "wtf/Forward.h" | 41 #include "wtf/Forward.h" |
42 #include "wtf/HashMap.h" | 42 #include "wtf/HashMap.h" |
43 #include "wtf/HashTraits.h" | 43 #include "wtf/HashTraits.h" |
44 #include "wtf/TypeTraits.h" | 44 #include "wtf/TypeTraits.h" |
45 #if ENABLE(GC_PROFILING) | |
46 #include "wtf/InstanceCounter.h" | 45 #include "wtf/InstanceCounter.h" |
47 #include "wtf/text/WTFString.h" | 46 #include "wtf/text/WTFString.h" |
48 #endif | |
49 | 47 |
50 namespace blink { | 48 namespace blink { |
51 | 49 |
52 template<typename T> class GarbageCollected; | 50 template<typename T> class GarbageCollected; |
53 class HeapObjectHeader; | 51 class HeapObjectHeader; |
54 class InlinedGlobalMarkingVisitor; | 52 class InlinedGlobalMarkingVisitor; |
55 template<typename T> class TraceTrait; | 53 template<typename T> class TraceTrait; |
56 template<typename T> class TraceEagerlyTrait; | 54 template<typename T> class TraceEagerlyTrait; |
57 class Visitor; | 55 class Visitor; |
58 | 56 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 | 387 |
390 virtual void registerWeakTable(const void*, EphemeronCallback, EphemeronCall
back) = 0; | 388 virtual void registerWeakTable(const void*, EphemeronCallback, EphemeronCall
back) = 0; |
391 #if ENABLE(ASSERT) | 389 #if ENABLE(ASSERT) |
392 virtual bool weakTableRegistered(const void*) = 0; | 390 virtual bool weakTableRegistered(const void*) = 0; |
393 #endif | 391 #endif |
394 | 392 |
395 virtual bool ensureMarked(const void*) = 0; | 393 virtual bool ensureMarked(const void*) = 0; |
396 | 394 |
397 inline MarkingMode markingMode() const { return m_markingMode; } | 395 inline MarkingMode markingMode() const { return m_markingMode; } |
398 | 396 |
| 397 void setHostInfo(void* object, const String& name) |
| 398 { |
| 399 m_hostObject = object; |
| 400 m_hostName = name; |
| 401 } |
| 402 |
| 403 inline bool isGlobalMarkingVisitor() const { return m_isGlobalMarkingVisitor
; } |
| 404 |
399 protected: | 405 protected: |
400 explicit Visitor(MarkingMode markingMode) | 406 explicit Visitor(MarkingMode markingMode) |
401 : m_markingMode(markingMode) | 407 : m_markingMode(markingMode) |
402 { } | 408 { } |
403 | 409 |
404 virtual void registerWeakCellWithCallback(void**, WeakCallback) = 0; | 410 virtual void registerWeakCellWithCallback(void**, WeakCallback) = 0; |
| 411 #if ENABLE(GC_PROFILING) |
| 412 virtual void recordObjectGraphEdge(const void*) = 0; |
| 413 #endif |
| 414 |
| 415 void* m_hostObject; |
| 416 String m_hostName; |
| 417 |
| 418 #if ENABLE(ASSERT) |
| 419 virtual void checkMarkingAllowed() { } |
| 420 #endif |
405 | 421 |
406 private: | 422 private: |
407 static Visitor* fromHelper(VisitorHelper<Visitor>* helper) { return static_c
ast<Visitor*>(helper); } | 423 static Visitor* fromHelper(VisitorHelper<Visitor>* helper) { return static_c
ast<Visitor*>(helper); } |
408 | 424 |
409 const MarkingMode m_markingMode; | 425 const MarkingMode m_markingMode; |
410 bool m_isGlobalMarkingVisitor; | 426 bool m_isGlobalMarkingVisitor; |
411 }; | 427 }; |
412 | 428 |
413 #if ENABLE(GC_PROFILING) | 429 #if ENABLE(GC_PROFILING) |
| 430 template <typename Derived> |
| 431 template <typename T> |
| 432 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* obj) |
| 433 { |
| 434 T** cell = reinterpret_cast<T**>(obj); |
| 435 if (*cell && !self->isHeapObjectAlive(*cell)) |
| 436 *cell = nullptr; |
| 437 } |
| 438 #endif |
| 439 |
414 template<typename T> | 440 template<typename T> |
415 struct TypenameStringTrait { | 441 struct TypenameStringTrait { |
416 static const String& get() | 442 static const String& get() |
417 { | 443 { |
418 DEFINE_STATIC_LOCAL(String, typenameString, (WTF::extractTypeNameFromFun
ctionName(WTF::extractNameFunction<T>()))); | 444 DEFINE_STATIC_LOCAL(String, typenameString, (WTF::extractTypeNameFromFun
ctionName(WTF::extractNameFunction<T>()))); |
419 return typenameString; | 445 return typenameString; |
420 } | 446 } |
421 }; | 447 }; |
422 #endif | |
423 | 448 |
424 } // namespace blink | 449 } // namespace blink |
425 | 450 |
426 #endif // Visitor_h | 451 #endif // Visitor_h |
OLD | NEW |