Chromium Code Reviews| 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 587 visitor->checkGCInfo(const_cast<T*>(t), GCInfoTrait<T>::get()); | 587 visitor->checkGCInfo(const_cast<T*>(t), GCInfoTrait<T>::get()); |
| 588 } | 588 } |
| 589 #endif | 589 #endif |
| 590 }; | 590 }; |
| 591 | 591 |
| 592 template<typename T> | 592 template<typename T> |
| 593 class DefaultTraceTrait<T, true> { | 593 class DefaultTraceTrait<T, true> { |
| 594 public: | 594 public: |
| 595 static void mark(Visitor* visitor, const T* self) | 595 static void mark(Visitor* visitor, const T* self) |
| 596 { | 596 { |
| 597 if (self) | 597 if (!self) |
| 598 self->adjustAndMark(visitor); | 598 return; |
| 599 | |
| 600 // Before doing adjustAndMark we need to check if the page is orphaned | |
| 601 // since we cannot call adjustAndMark if so, as there will be no vtable. | |
| 602 // If orphaned just mark the page as traced. | |
| 603 BaseHeapPage* heapPage = pageHeaderFromObject(self); | |
| 604 if (heapPage->orphaned()) { | |
|
haraken
2014/07/09 05:17:49
Just to confirm: Is this the only place where we h
wibling-chromium
2014/07/09 10:32:31
AFAICT we can get away with just checking here for
haraken
2014/07/13 17:30:38
Just to help me understand, imagine the following
wibling-chromium
2014/07/14 08:06:11
We don't want to continue tracing from X to Y. If
| |
| 605 heapPage->setTraced(); | |
| 606 return; | |
| 607 } | |
| 608 self->adjustAndMark(visitor); | |
| 599 } | 609 } |
| 600 | 610 |
| 601 #ifndef NDEBUG | 611 #ifndef NDEBUG |
| 602 static void checkGCInfo(Visitor*, const T*) { } | 612 static void checkGCInfo(Visitor*, const T*) { } |
| 603 #endif | 613 #endif |
| 604 }; | 614 }; |
| 605 | 615 |
| 606 template<typename T, bool = NeedsAdjustAndMark<T>::value> class DefaultObjectAli veTrait; | 616 template<typename T, bool = NeedsAdjustAndMark<T>::value> class DefaultObjectAli veTrait; |
| 607 | 617 |
| 608 template<typename T> | 618 template<typename T> |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 720 struct GCInfoTrait { | 730 struct GCInfoTrait { |
| 721 static const GCInfo* get() | 731 static const GCInfo* get() |
| 722 { | 732 { |
| 723 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::get(); | 733 return GCInfoAtBase<typename GetGarbageCollectedBase<T>::type>::get(); |
| 724 } | 734 } |
| 725 }; | 735 }; |
| 726 | 736 |
| 727 } | 737 } |
| 728 | 738 |
| 729 #endif | 739 #endif |
| OLD | NEW |