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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 #else | 88 #else |
| 89 #define FILL_ZERO_IF_PRODUCTION(address, size) memset((address), 0, (size)) | 89 #define FILL_ZERO_IF_PRODUCTION(address, size) memset((address), 0, (size)) |
| 90 #define FILL_ZERO_IF_NOT_PRODUCTION(address, size) do { } while (false) | 90 #define FILL_ZERO_IF_NOT_PRODUCTION(address, size) do { } while (false) |
| 91 #endif | 91 #endif |
| 92 | 92 |
| 93 class CallbackStack; | 93 class CallbackStack; |
| 94 class FreePagePool; | 94 class FreePagePool; |
| 95 class NormalPageHeap; | 95 class NormalPageHeap; |
| 96 class OrphanedPagePool; | 96 class OrphanedPagePool; |
| 97 class PageMemory; | 97 class PageMemory; |
| 98 class WebProcessMemoryDump; | |
| 98 | 99 |
| 99 #if ENABLE(GC_PROFILING) | 100 #if ENABLE(GC_PROFILING) |
| 100 class TracedValue; | 101 class TracedValue; |
| 101 #endif | 102 #endif |
| 102 | 103 |
| 103 // HeapObjectHeader is 4 byte (32 bit) that has the following layout: | 104 // HeapObjectHeader is 4 byte (32 bit) that has the following layout: |
| 104 // | 105 // |
| 105 // | gcInfoIndex (14 bit) | DOM mark bit (1 bit) | size (14 bit) | dead bit (1 b it) | freed bit (1 bit) | mark bit (1 bit) | | 106 // | gcInfoIndex (14 bit) | DOM mark bit (1 bit) | size (14 bit) | dead bit (1 b it) | freed bit (1 bit) | mark bit (1 bit) | |
| 106 // | 107 // |
| 107 // - For non-large objects, 14 bit is enough for |size| because the blink | 108 // - For non-large objects, 14 bit is enough for |size| because the blink |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 // GC. | 191 // GC. |
| 191 void zapMagic(); | 192 void zapMagic(); |
| 192 #endif | 193 #endif |
| 193 | 194 |
| 194 void finalize(Address, size_t); | 195 void finalize(Address, size_t); |
| 195 static HeapObjectHeader* fromPayload(const void*); | 196 static HeapObjectHeader* fromPayload(const void*); |
| 196 | 197 |
| 197 static const uint16_t magic = 0xfff1; | 198 static const uint16_t magic = 0xfff1; |
| 198 static const uint16_t zappedMagic = 0x4321; | 199 static const uint16_t zappedMagic = 0x4321; |
| 199 | 200 |
| 201 size_t encodedSize() const { return m_encoded; } | |
|
Primiano Tucci (use gerrit)
2015/05/28 12:47:00
Any idea what is this?
P.S: what is NO_SANITIZE_AD
Primiano Tucci (use gerrit)
2015/05/28 12:47:01
We had a chat offline on this. I don't think you w
ssid
2015/05/28 13:06:10
Done.
| |
| 200 #if ENABLE(GC_PROFILING) | 202 #if ENABLE(GC_PROFILING) |
| 201 NO_SANITIZE_ADDRESS | 203 NO_SANITIZE_ADDRESS |
| 202 size_t encodedSize() const { return m_encoded; } | |
| 203 | |
| 204 NO_SANITIZE_ADDRESS | |
| 205 size_t age() const { return m_age; } | 204 size_t age() const { return m_age; } |
| 206 | 205 |
| 207 NO_SANITIZE_ADDRESS | 206 NO_SANITIZE_ADDRESS |
| 208 void incrementAge() | 207 void incrementAge() |
| 209 { | 208 { |
| 210 if (m_age < maxHeapObjectAge) | 209 if (m_age < maxHeapObjectAge) |
| 211 m_age++; | 210 m_age++; |
| 212 } | 211 } |
| 213 #endif | 212 #endif |
| 214 | 213 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 // Check if the given address points to an object in this | 391 // Check if the given address points to an object in this |
| 393 // heap page. If so, find the start of that object and mark it | 392 // heap page. If so, find the start of that object and mark it |
| 394 // using the given Visitor. Otherwise do nothing. The pointer must | 393 // using the given Visitor. Otherwise do nothing. The pointer must |
| 395 // be within the same aligned blinkPageSize as the this-pointer. | 394 // be within the same aligned blinkPageSize as the this-pointer. |
| 396 // | 395 // |
| 397 // This is used during conservative stack scanning to | 396 // This is used during conservative stack scanning to |
| 398 // conservatively mark all objects that could be referenced from | 397 // conservatively mark all objects that could be referenced from |
| 399 // the stack. | 398 // the stack. |
| 400 virtual void checkAndMarkPointer(Visitor*, Address) = 0; | 399 virtual void checkAndMarkPointer(Visitor*, Address) = 0; |
| 401 virtual void markOrphaned(); | 400 virtual void markOrphaned(); |
| 401 | |
| 402 virtual void takeSnapshot(const String& dumpBaseName, size_t pageIndex) = 0; | |
| 402 #if ENABLE(GC_PROFILING) | 403 #if ENABLE(GC_PROFILING) |
| 403 virtual const GCInfo* findGCInfo(Address) = 0; | 404 virtual const GCInfo* findGCInfo(Address) = 0; |
| 404 virtual void snapshot(TracedValue*, ThreadState::SnapshotInfo*) = 0; | 405 virtual void snapshot(TracedValue*, ThreadState::SnapshotInfo*) = 0; |
| 405 virtual void incrementMarkedObjectsAge() = 0; | 406 virtual void incrementMarkedObjectsAge() = 0; |
| 406 virtual void countMarkedObjects(ClassAgeCountsMap&) = 0; | 407 virtual void countMarkedObjects(ClassAgeCountsMap&) = 0; |
| 407 virtual void countObjectsToSweep(ClassAgeCountsMap&) = 0; | 408 virtual void countObjectsToSweep(ClassAgeCountsMap&) = 0; |
| 408 #endif | 409 #endif |
| 409 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 410 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
| 410 virtual bool contains(Address) = 0; | 411 virtual bool contains(Address) = 0; |
| 411 #endif | 412 #endif |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 470 virtual size_t objectPayloadSizeForTesting() override; | 471 virtual size_t objectPayloadSizeForTesting() override; |
| 471 virtual bool isEmpty() override; | 472 virtual bool isEmpty() override; |
| 472 virtual void removeFromHeap() override; | 473 virtual void removeFromHeap() override; |
| 473 virtual void sweep() override; | 474 virtual void sweep() override; |
| 474 virtual void markUnmarkedObjectsDead() override; | 475 virtual void markUnmarkedObjectsDead() override; |
| 475 #if defined(ADDRESS_SANITIZER) | 476 #if defined(ADDRESS_SANITIZER) |
| 476 virtual void poisonUnmarkedObjects() override; | 477 virtual void poisonUnmarkedObjects() override; |
| 477 #endif | 478 #endif |
| 478 virtual void checkAndMarkPointer(Visitor*, Address) override; | 479 virtual void checkAndMarkPointer(Visitor*, Address) override; |
| 479 virtual void markOrphaned() override; | 480 virtual void markOrphaned() override; |
| 481 | |
| 482 void takeSnapshot(const String& dumpBaseName, size_t pageIndex) override; | |
| 480 #if ENABLE(GC_PROFILING) | 483 #if ENABLE(GC_PROFILING) |
| 481 const GCInfo* findGCInfo(Address) override; | 484 const GCInfo* findGCInfo(Address) override; |
| 482 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; | 485 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; |
| 483 void incrementMarkedObjectsAge() override; | 486 void incrementMarkedObjectsAge() override; |
| 484 void countMarkedObjects(ClassAgeCountsMap&) override; | 487 void countMarkedObjects(ClassAgeCountsMap&) override; |
| 485 void countObjectsToSweep(ClassAgeCountsMap&) override; | 488 void countObjectsToSweep(ClassAgeCountsMap&) override; |
| 486 #endif | 489 #endif |
| 487 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 490 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
| 488 // Returns true for the whole blinkPageSize page that the page is on, even | 491 // Returns true for the whole blinkPageSize page that the page is on, even |
| 489 // for the header, and the unmapped guard page at the start. That ensures | 492 // for the header, and the unmapped guard page at the start. That ensures |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 virtual bool isEmpty() override; | 536 virtual bool isEmpty() override; |
| 534 virtual void removeFromHeap() override; | 537 virtual void removeFromHeap() override; |
| 535 virtual void sweep() override; | 538 virtual void sweep() override; |
| 536 virtual void markUnmarkedObjectsDead() override; | 539 virtual void markUnmarkedObjectsDead() override; |
| 537 #if defined(ADDRESS_SANITIZER) | 540 #if defined(ADDRESS_SANITIZER) |
| 538 virtual void poisonUnmarkedObjects() override; | 541 virtual void poisonUnmarkedObjects() override; |
| 539 #endif | 542 #endif |
| 540 virtual void checkAndMarkPointer(Visitor*, Address) override; | 543 virtual void checkAndMarkPointer(Visitor*, Address) override; |
| 541 virtual void markOrphaned() override; | 544 virtual void markOrphaned() override; |
| 542 | 545 |
| 546 void takeSnapshot(const String& dumpBaseName, size_t pageIndex) override; | |
| 543 #if ENABLE(GC_PROFILING) | 547 #if ENABLE(GC_PROFILING) |
| 544 const GCInfo* findGCInfo(Address) override; | 548 const GCInfo* findGCInfo(Address) override; |
| 545 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; | 549 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; |
| 546 void incrementMarkedObjectsAge() override; | 550 void incrementMarkedObjectsAge() override; |
| 547 void countMarkedObjects(ClassAgeCountsMap&) override; | 551 void countMarkedObjects(ClassAgeCountsMap&) override; |
| 548 void countObjectsToSweep(ClassAgeCountsMap&) override; | 552 void countObjectsToSweep(ClassAgeCountsMap&) override; |
| 549 #endif | 553 #endif |
| 550 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 554 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
| 551 // Returns true for any address that is on one of the pages that this | 555 // Returns true for any address that is on one of the pages that this |
| 552 // large object uses. That ensures that we can use a negative result to | 556 // large object uses. That ensures that we can use a negative result to |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1296 size_t copySize = previousHeader->payloadSize(); | 1300 size_t copySize = previousHeader->payloadSize(); |
| 1297 if (copySize > size) | 1301 if (copySize > size) |
| 1298 copySize = size; | 1302 copySize = size; |
| 1299 memcpy(address, previous, copySize); | 1303 memcpy(address, previous, copySize); |
| 1300 return address; | 1304 return address; |
| 1301 } | 1305 } |
| 1302 | 1306 |
| 1303 } // namespace blink | 1307 } // namespace blink |
| 1304 | 1308 |
| 1305 #endif // Heap_h | 1309 #endif // Heap_h |
| OLD | NEW |