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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // | 182 // |
183 // | BaseHeapPage | next pointer | FinalizedHeapObjectHeader or HeapObjectHeader
| payload | | 183 // | BaseHeapPage | next pointer | FinalizedHeapObjectHeader or HeapObjectHeader
| payload | |
184 template<typename Header> | 184 template<typename Header> |
185 class LargeHeapObject : public BaseHeapPage { | 185 class LargeHeapObject : public BaseHeapPage { |
186 public: | 186 public: |
187 LargeHeapObject(PageMemory* storage, const GCInfo* gcInfo, ThreadState* stat
e) : BaseHeapPage(storage, gcInfo, state) | 187 LargeHeapObject(PageMemory* storage, const GCInfo* gcInfo, ThreadState* stat
e) : BaseHeapPage(storage, gcInfo, state) |
188 { | 188 { |
189 COMPILE_ASSERT(!(sizeof(LargeHeapObject<Header>) & allocationMask), larg
e_heap_object_header_misaligned); | 189 COMPILE_ASSERT(!(sizeof(LargeHeapObject<Header>) & allocationMask), larg
e_heap_object_header_misaligned); |
190 } | 190 } |
191 | 191 |
192 virtual void checkAndMarkPointer(Visitor*, Address) OVERRIDE; | 192 virtual void checkAndMarkPointer(Visitor*, Address) override; |
193 virtual bool isLargeObject() OVERRIDE { return true; } | 193 virtual bool isLargeObject() override { return true; } |
194 | 194 |
195 #if ENABLE(GC_PROFILE_MARKING) | 195 #if ENABLE(GC_PROFILE_MARKING) |
196 virtual const GCInfo* findGCInfo(Address address) | 196 virtual const GCInfo* findGCInfo(Address address) |
197 { | 197 { |
198 if (!objectContains(address)) | 198 if (!objectContains(address)) |
199 return 0; | 199 return 0; |
200 return gcInfo(); | 200 return gcInfo(); |
201 } | 201 } |
202 #endif | 202 #endif |
203 | 203 |
(...skipping 15 matching lines...) Expand all Loading... |
219 // The LargeHeapObject pseudo-page contains one actual object. Determine | 219 // The LargeHeapObject pseudo-page contains one actual object. Determine |
220 // whether the pointer is within that object. | 220 // whether the pointer is within that object. |
221 bool objectContains(Address object) | 221 bool objectContains(Address object) |
222 { | 222 { |
223 return (payload() <= object) && (object < address() + size()); | 223 return (payload() <= object) && (object < address() + size()); |
224 } | 224 } |
225 | 225 |
226 // Returns true for any address that is on one of the pages that this | 226 // Returns true for any address that is on one of the pages that this |
227 // large object uses. That ensures that we can use a negative result to | 227 // large object uses. That ensures that we can use a negative result to |
228 // populate the negative page cache. | 228 // populate the negative page cache. |
229 virtual bool contains(Address object) OVERRIDE | 229 virtual bool contains(Address object) override |
230 { | 230 { |
231 return roundToBlinkPageStart(address()) <= object && object < roundToBli
nkPageEnd(address() + size()); | 231 return roundToBlinkPageStart(address()) <= object && object < roundToBli
nkPageEnd(address() + size()); |
232 } | 232 } |
233 | 233 |
234 LargeHeapObject<Header>* next() | 234 LargeHeapObject<Header>* next() |
235 { | 235 { |
236 return m_next; | 236 return m_next; |
237 } | 237 } |
238 | 238 |
239 size_t size() | 239 size_t size() |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 HeapPage(PageMemory*, ThreadHeap<Header>*, const GCInfo*); | 495 HeapPage(PageMemory*, ThreadHeap<Header>*, const GCInfo*); |
496 | 496 |
497 void link(HeapPage**); | 497 void link(HeapPage**); |
498 static void unlink(ThreadHeap<Header>*, HeapPage*, HeapPage**); | 498 static void unlink(ThreadHeap<Header>*, HeapPage*, HeapPage**); |
499 | 499 |
500 bool isEmpty(); | 500 bool isEmpty(); |
501 | 501 |
502 // Returns true for the whole blinkPageSize page that the page is on, even | 502 // Returns true for the whole blinkPageSize page that the page is on, even |
503 // for the header, and the unmapped guard page at the start. That ensures | 503 // for the header, and the unmapped guard page at the start. That ensures |
504 // the result can be used to populate the negative page cache. | 504 // the result can be used to populate the negative page cache. |
505 virtual bool contains(Address addr) OVERRIDE | 505 virtual bool contains(Address addr) override |
506 { | 506 { |
507 Address blinkPageStart = roundToBlinkPageStart(address()); | 507 Address blinkPageStart = roundToBlinkPageStart(address()); |
508 ASSERT(blinkPageStart == address() - osPageSize()); // Page is at aligne
d address plus guard page size. | 508 ASSERT(blinkPageStart == address() - osPageSize()); // Page is at aligne
d address plus guard page size. |
509 return blinkPageStart <= addr && addr < blinkPageStart + blinkPageSize; | 509 return blinkPageStart <= addr && addr < blinkPageStart + blinkPageSize; |
510 } | 510 } |
511 | 511 |
512 HeapPage* next() { return m_next; } | 512 HeapPage* next() { return m_next; } |
513 | 513 |
514 Address payload() | 514 Address payload() |
515 { | 515 { |
516 return address() + sizeof(*this) + headerPadding<Header>(); | 516 return address() + sizeof(*this) + headerPadding<Header>(); |
517 } | 517 } |
518 | 518 |
519 static size_t payloadSize() | 519 static size_t payloadSize() |
520 { | 520 { |
521 return (blinkPagePayloadSize() - sizeof(HeapPage) - headerPadding<Header
>()) & ~allocationMask; | 521 return (blinkPagePayloadSize() - sizeof(HeapPage) - headerPadding<Header
>()) & ~allocationMask; |
522 } | 522 } |
523 | 523 |
524 Address end() { return payload() + payloadSize(); } | 524 Address end() { return payload() + payloadSize(); } |
525 | 525 |
526 void getStats(HeapStats&); | 526 void getStats(HeapStats&); |
527 void clearLiveAndMarkDead(); | 527 void clearLiveAndMarkDead(); |
528 void sweep(HeapStats*, ThreadHeap<Header>*); | 528 void sweep(HeapStats*, ThreadHeap<Header>*); |
529 void clearObjectStartBitMap(); | 529 void clearObjectStartBitMap(); |
530 void finalize(Header*); | 530 void finalize(Header*); |
531 virtual void checkAndMarkPointer(Visitor*, Address) OVERRIDE; | 531 virtual void checkAndMarkPointer(Visitor*, Address) override; |
532 #if ENABLE(GC_PROFILE_MARKING) | 532 #if ENABLE(GC_PROFILE_MARKING) |
533 const GCInfo* findGCInfo(Address) OVERRIDE; | 533 const GCInfo* findGCInfo(Address) override; |
534 #endif | 534 #endif |
535 #if ENABLE(GC_PROFILE_HEAP) | 535 #if ENABLE(GC_PROFILE_HEAP) |
536 virtual void snapshot(TracedValue*, ThreadState::SnapshotInfo*); | 536 virtual void snapshot(TracedValue*, ThreadState::SnapshotInfo*); |
537 #endif | 537 #endif |
538 | 538 |
539 #if defined(ADDRESS_SANITIZER) | 539 #if defined(ADDRESS_SANITIZER) |
540 void poisonUnmarkedObjects(); | 540 void poisonUnmarkedObjects(); |
541 #endif | 541 #endif |
542 NO_SANITIZE_ADDRESS | 542 NO_SANITIZE_ADDRESS |
543 virtual void markOrphaned() | 543 virtual void markOrphaned() |
(...skipping 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2450 }; | 2450 }; |
2451 | 2451 |
2452 template<typename T> | 2452 template<typename T> |
2453 struct IfWeakMember<WeakMember<T> > { | 2453 struct IfWeakMember<WeakMember<T> > { |
2454 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit
or->isAlive(t.get()); } | 2454 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit
or->isAlive(t.get()); } |
2455 }; | 2455 }; |
2456 | 2456 |
2457 } | 2457 } |
2458 | 2458 |
2459 #endif // Heap_h | 2459 #endif // Heap_h |
OLD | NEW |