Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: third_party/WebKit/Source/platform/heap/Heap.h

Issue 2640163004: Replace ENABLE(ASSERT) with DCHECK_IS_ON(). (Closed)
Patch Set: m_domTreeVersion initialization Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 class PLATFORM_EXPORT ThreadHeap { 227 class PLATFORM_EXPORT ThreadHeap {
228 public: 228 public:
229 ThreadHeap(); 229 ThreadHeap();
230 ~ThreadHeap(); 230 ~ThreadHeap();
231 231
232 // Returns true for main thread's heap. 232 // Returns true for main thread's heap.
233 // TODO(keishi): Per-thread-heap will return false. 233 // TODO(keishi): Per-thread-heap will return false.
234 bool isMainThreadHeap() { return this == ThreadHeap::mainThreadHeap(); } 234 bool isMainThreadHeap() { return this == ThreadHeap::mainThreadHeap(); }
235 static ThreadHeap* mainThreadHeap() { return s_mainThreadHeap; } 235 static ThreadHeap* mainThreadHeap() { return s_mainThreadHeap; }
236 236
237 #if ENABLE(ASSERT) 237 #if DCHECK_IS_ON()
238 bool isAtSafePoint(); 238 bool isAtSafePoint();
239 BasePage* findPageFromAddress(Address); 239 BasePage* findPageFromAddress(Address);
240 #endif 240 #endif
241 241
242 template <typename T> 242 template <typename T>
243 static inline bool isHeapObjectAlive(const T* object) { 243 static inline bool isHeapObjectAlive(const T* object) {
244 static_assert(sizeof(T), "T must be fully defined"); 244 static_assert(sizeof(T), "T must be fully defined");
245 // The strongification of collections relies on the fact that once a 245 // The strongification of collections relies on the fact that once a
246 // collection has been strongified, there is no way that it can contain 246 // collection has been strongified, there is no way that it can contain
247 // non-live entries, so no entries will be removed. Since you can't set 247 // non-live entries, so no entries will be removed. Since you can't set
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 371
372 // Remove an item from the weak callback work list and call the callback 372 // Remove an item from the weak callback work list and call the callback
373 // with the visitor and the closure pointer. Returns false when there is 373 // with the visitor and the closure pointer. Returns false when there is
374 // nothing more to do. 374 // nothing more to do.
375 bool popAndInvokeGlobalWeakCallback(Visitor*); 375 bool popAndInvokeGlobalWeakCallback(Visitor*);
376 376
377 // Register an ephemeron table for fixed-point iteration. 377 // Register an ephemeron table for fixed-point iteration.
378 void registerWeakTable(void* containerObject, 378 void registerWeakTable(void* containerObject,
379 EphemeronCallback, 379 EphemeronCallback,
380 EphemeronCallback); 380 EphemeronCallback);
381 #if ENABLE(ASSERT) 381 #if DCHECK_IS_ON()
382 bool weakTableRegistered(const void*); 382 bool weakTableRegistered(const void*);
383 #endif 383 #endif
384 384
385 // Heap compaction registration methods: 385 // Heap compaction registration methods:
386 386
387 // Register |slot| as containing a reference to a movable heap object. 387 // Register |slot| as containing a reference to a movable heap object.
388 // 388 //
389 // When compaction moves the object pointed to by |*slot| to |newAddress|, 389 // When compaction moves the object pointed to by |*slot| to |newAddress|,
390 // |*slot| must be updated to hold |newAddress| instead. 390 // |*slot| must be updated to hold |newAddress| instead.
391 void registerMovingObjectReference(MovableReference*); 391 void registerMovingObjectReference(MovableReference*);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 index <= BlinkGC::NormalPage4ArenaIndex; 583 index <= BlinkGC::NormalPage4ArenaIndex;
584 } 584 }
585 585
586 #define DECLARE_EAGER_FINALIZATION_OPERATOR_NEW() \ 586 #define DECLARE_EAGER_FINALIZATION_OPERATOR_NEW() \
587 public: \ 587 public: \
588 GC_PLUGIN_IGNORE("491488") \ 588 GC_PLUGIN_IGNORE("491488") \
589 void* operator new(size_t size) { return allocateObject(size, true); } 589 void* operator new(size_t size) { return allocateObject(size, true); }
590 590
591 #define IS_EAGERLY_FINALIZED() \ 591 #define IS_EAGERLY_FINALIZED() \
592 (pageFromObject(this)->arena()->arenaIndex() == BlinkGC::EagerSweepArenaIndex) 592 (pageFromObject(this)->arena()->arenaIndex() == BlinkGC::EagerSweepArenaIndex)
593 #if ENABLE(ASSERT) 593 #if DCHECK_IS_ON()
594 class VerifyEagerFinalization { 594 class VerifyEagerFinalization {
595 DISALLOW_NEW(); 595 DISALLOW_NEW();
596 596
597 public: 597 public:
598 ~VerifyEagerFinalization() { 598 ~VerifyEagerFinalization() {
599 // If this assert triggers, the class annotated as eagerly 599 // If this assert triggers, the class annotated as eagerly
600 // finalized ended up not being allocated on the heap 600 // finalized ended up not being allocated on the heap
601 // set aside for eager finalization. The reason is most 601 // set aside for eager finalization. The reason is most
602 // likely that the effective 'operator new' overload for 602 // likely that the effective 'operator new' overload for
603 // this class' leftmost base is for a class that is not 603 // this class' leftmost base is for a class that is not
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 template <typename T> 696 template <typename T>
697 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) { 697 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) {
698 T** cell = reinterpret_cast<T**>(object); 698 T** cell = reinterpret_cast<T**>(object);
699 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) 699 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell))
700 *cell = nullptr; 700 *cell = nullptr;
701 } 701 }
702 702
703 } // namespace blink 703 } // namespace blink
704 704
705 #endif // Heap_h 705 #endif // Heap_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/GCInfo.cpp ('k') | third_party/WebKit/Source/platform/heap/Heap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698