| 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 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 return index >= NormalPage1HeapIndex && index <= NormalPage4HeapIndex; | 1176 return index >= NormalPage1HeapIndex && index <= NormalPage4HeapIndex; |
| 1177 } | 1177 } |
| 1178 | 1178 |
| 1179 #define DECLARE_EAGER_FINALIZATION_OPERATOR_NEW() \ | 1179 #define DECLARE_EAGER_FINALIZATION_OPERATOR_NEW() \ |
| 1180 public: \ | 1180 public: \ |
| 1181 GC_PLUGIN_IGNORE("491488") \ | 1181 GC_PLUGIN_IGNORE("491488") \ |
| 1182 void* operator new(size_t size) \ | 1182 void* operator new(size_t size) \ |
| 1183 { \ | 1183 { \ |
| 1184 return allocateObject(size, true); \ | 1184 return allocateObject(size, true); \ |
| 1185 } | 1185 } |
| 1186 #define EAGERLY_FINALIZE_WILL_BE_REMOVED() | |
| 1187 #if ENABLE(ASSERT) && ENABLE(OILPAN) | 1186 #if ENABLE(ASSERT) && ENABLE(OILPAN) |
| 1188 class VerifyEagerFinalization { | 1187 class VerifyEagerFinalization { |
| 1189 public: | 1188 public: |
| 1190 ~VerifyEagerFinalization() | 1189 ~VerifyEagerFinalization() |
| 1191 { | 1190 { |
| 1192 // If this assert triggers, the class annotated as eagerly | 1191 // If this assert triggers, the class annotated as eagerly |
| 1193 // finalized ended up not being allocated on the heap | 1192 // finalized ended up not being allocated on the heap |
| 1194 // set aside for eager finalization. The reason is most | 1193 // set aside for eager finalization. The reason is most |
| 1195 // likely that the effective 'operator new' overload for | 1194 // likely that the effective 'operator new' overload for |
| 1196 // this class' leftmost base is for a class that is not | 1195 // this class' leftmost base is for a class that is not |
| 1197 // eagerly finalized. Declaring and defining an 'operator new' | 1196 // eagerly finalized. Declaring and defining an 'operator new' |
| 1198 // for this class is what's required -- consider using | 1197 // for this class is what's required -- consider using |
| 1199 // DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(). | 1198 // DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(). |
| 1200 ASSERT(pageFromObject(this)->heap()->heapIndex() == EagerSweepHeapIndex)
; | 1199 ASSERT(pageFromObject(this)->heap()->heapIndex() == EagerSweepHeapIndex)
; |
| 1201 } | 1200 } |
| 1202 }; | 1201 }; |
| 1203 #define EAGERLY_FINALIZE() \ | 1202 #define EAGERLY_FINALIZE() \ |
| 1204 private: \ | 1203 private: \ |
| 1205 VerifyEagerFinalization m_verifyEagerFinalization; \ | 1204 VerifyEagerFinalization m_verifyEagerFinalization; \ |
| 1206 public: \ | 1205 public: \ |
| 1207 typedef int IsEagerlyFinalizedMarker | 1206 typedef int IsEagerlyFinalizedMarker |
| 1208 #else | 1207 #else |
| 1209 #define EAGERLY_FINALIZE() typedef int IsEagerlyFinalizedMarker | 1208 #define EAGERLY_FINALIZE() typedef int IsEagerlyFinalizedMarker |
| 1210 #endif | 1209 #endif |
| 1211 | 1210 |
| 1211 #if !ENABLE(OILPAN) && ENABLE(LAZY_SWEEPING) |
| 1212 #define EAGERLY_FINALIZE_WILL_BE_REMOVED() EAGERLY_FINALIZE() |
| 1213 #else |
| 1214 #define EAGERLY_FINALIZE_WILL_BE_REMOVED() |
| 1215 #endif |
| 1216 |
| 1212 NO_SANITIZE_ADDRESS inline | 1217 NO_SANITIZE_ADDRESS inline |
| 1213 size_t HeapObjectHeader::size() const | 1218 size_t HeapObjectHeader::size() const |
| 1214 { | 1219 { |
| 1215 size_t result = m_encoded & headerSizeMask; | 1220 size_t result = m_encoded & headerSizeMask; |
| 1216 // Large objects should not refer to header->size(). | 1221 // Large objects should not refer to header->size(). |
| 1217 // The actual size of a large object is stored in | 1222 // The actual size of a large object is stored in |
| 1218 // LargeObjectPage::m_payloadSize. | 1223 // LargeObjectPage::m_payloadSize. |
| 1219 ASSERT(result != largeObjectSizeInHeader); | 1224 ASSERT(result != largeObjectSizeInHeader); |
| 1220 ASSERT(!pageFromObject(this)->isLargeObjectPage()); | 1225 ASSERT(!pageFromObject(this)->isLargeObjectPage()); |
| 1221 return result; | 1226 return result; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 size_t copySize = previousHeader->payloadSize(); | 1382 size_t copySize = previousHeader->payloadSize(); |
| 1378 if (copySize > size) | 1383 if (copySize > size) |
| 1379 copySize = size; | 1384 copySize = size; |
| 1380 memcpy(address, previous, copySize); | 1385 memcpy(address, previous, copySize); |
| 1381 return address; | 1386 return address; |
| 1382 } | 1387 } |
| 1383 | 1388 |
| 1384 } // namespace blink | 1389 } // namespace blink |
| 1385 | 1390 |
| 1386 #endif // Heap_h | 1391 #endif // Heap_h |
| OLD | NEW |