| 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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 // and finalized. The predicate returns false in all other cases. | 822 // and finalized. The predicate returns false in all other cases. |
| 823 // | 823 // |
| 824 // Holding a reference to an already-dead object is not a valid state | 824 // Holding a reference to an already-dead object is not a valid state |
| 825 // to be in; willObjectBeLazilySwept() has undefined behavior if passed | 825 // to be in; willObjectBeLazilySwept() has undefined behavior if passed |
| 826 // such a reference. | 826 // such a reference. |
| 827 template<typename T> | 827 template<typename T> |
| 828 NO_LAZY_SWEEP_SANITIZE_ADDRESS | 828 NO_LAZY_SWEEP_SANITIZE_ADDRESS |
| 829 static bool willObjectBeLazilySwept(const T* objectPointer) | 829 static bool willObjectBeLazilySwept(const T* objectPointer) |
| 830 { | 830 { |
| 831 static_assert(IsGarbageCollectedType<T>::value, "only objects deriving f
rom GarbageCollected can be used."); | 831 static_assert(IsGarbageCollectedType<T>::value, "only objects deriving f
rom GarbageCollected can be used."); |
| 832 #if ENABLE_LAZY_SWEEPING | 832 #if ENABLE(LAZY_SWEEPING) |
| 833 BasePage* page = pageFromObject(objectPointer); | 833 BasePage* page = pageFromObject(objectPointer); |
| 834 if (page->hasBeenSwept()) | 834 if (page->hasBeenSwept()) |
| 835 return false; | 835 return false; |
| 836 ASSERT(page->heap()->threadState()->isSweepingInProgress()); | 836 ASSERT(page->heap()->threadState()->isSweepingInProgress()); |
| 837 | 837 |
| 838 return !ObjectAliveTrait<T>::isHeapObjectAlive(s_markingVisitor, const_c
ast<T*>(objectPointer)); | 838 return !ObjectAliveTrait<T>::isHeapObjectAlive(s_markingVisitor, const_c
ast<T*>(objectPointer)); |
| 839 #else | 839 #else |
| 840 return false; | 840 return false; |
| 841 #endif | 841 #endif |
| 842 } | 842 } |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 if (size < 32) | 1099 if (size < 32) |
| 1100 return NormalPage1HeapIndex; | 1100 return NormalPage1HeapIndex; |
| 1101 return NormalPage2HeapIndex; | 1101 return NormalPage2HeapIndex; |
| 1102 } | 1102 } |
| 1103 if (size < 128) | 1103 if (size < 128) |
| 1104 return NormalPage3HeapIndex; | 1104 return NormalPage3HeapIndex; |
| 1105 return NormalPage4HeapIndex; | 1105 return NormalPage4HeapIndex; |
| 1106 } | 1106 } |
| 1107 }; | 1107 }; |
| 1108 | 1108 |
| 1109 #if ENABLE_LAZY_SWEEPING | 1109 #if ENABLE(LAZY_SWEEPING) |
| 1110 #define EAGERLY_FINALIZE() typedef int IsEagerlyFinalizedMarker | 1110 #define EAGERLY_FINALIZE() typedef int IsEagerlyFinalizedMarker |
| 1111 #define EAGERLY_FINALIZE_WILL_BE_REMOVED() | 1111 #define EAGERLY_FINALIZE_WILL_BE_REMOVED() |
| 1112 #else | 1112 #else |
| 1113 #define EAGERLY_FINALIZE() | 1113 #define EAGERLY_FINALIZE() |
| 1114 // TODO(Oilpan): define in terms of Oilpan's EAGERLY_FINALIZE() once lazy | 1114 // TODO(Oilpan): define in terms of Oilpan's EAGERLY_FINALIZE() once lazy |
| 1115 // sweeping is enabled non-Oilpan. | 1115 // sweeping is enabled non-Oilpan. |
| 1116 #define EAGERLY_FINALIZE_WILL_BE_REMOVED() | 1116 #define EAGERLY_FINALIZE_WILL_BE_REMOVED() |
| 1117 #endif | 1117 #endif |
| 1118 | 1118 |
| 1119 template<typename T> | 1119 template<typename T> |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 size_t copySize = previousHeader->payloadSize(); | 1293 size_t copySize = previousHeader->payloadSize(); |
| 1294 if (copySize > size) | 1294 if (copySize > size) |
| 1295 copySize = size; | 1295 copySize = size; |
| 1296 memcpy(address, previous, copySize); | 1296 memcpy(address, previous, copySize); |
| 1297 return address; | 1297 return address; |
| 1298 } | 1298 } |
| 1299 | 1299 |
| 1300 } // namespace blink | 1300 } // namespace blink |
| 1301 | 1301 |
| 1302 #endif // Heap_h | 1302 #endif // Heap_h |
| OLD | NEW |