| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 // Check if the given address points to an object in this | 394 // Check if the given address points to an object in this |
| 394 // heap page. If so, find the start of that object and mark it | 395 // heap page. If so, find the start of that object and mark it |
| 395 // using the given Visitor. Otherwise do nothing. The pointer must | 396 // using the given Visitor. Otherwise do nothing. The pointer must |
| 396 // be within the same aligned blinkPageSize as the this-pointer. | 397 // be within the same aligned blinkPageSize as the this-pointer. |
| 397 // | 398 // |
| 398 // This is used during conservative stack scanning to | 399 // This is used during conservative stack scanning to |
| 399 // conservatively mark all objects that could be referenced from | 400 // conservatively mark all objects that could be referenced from |
| 400 // the stack. | 401 // the stack. |
| 401 virtual void checkAndMarkPointer(Visitor*, Address) = 0; | 402 virtual void checkAndMarkPointer(Visitor*, Address) = 0; |
| 402 virtual void markOrphaned(); | 403 virtual void markOrphaned(); |
| 404 |
| 405 virtual void takeSnapshot(const String& dumpBaseName, size_t pageIndex) = 0; |
| 403 #if ENABLE(GC_PROFILING) | 406 #if ENABLE(GC_PROFILING) |
| 404 virtual const GCInfo* findGCInfo(Address) = 0; | 407 virtual const GCInfo* findGCInfo(Address) = 0; |
| 405 virtual void snapshot(TracedValue*, ThreadState::SnapshotInfo*) = 0; | 408 virtual void snapshot(TracedValue*, ThreadState::SnapshotInfo*) = 0; |
| 406 virtual void incrementMarkedObjectsAge() = 0; | 409 virtual void incrementMarkedObjectsAge() = 0; |
| 407 virtual void countMarkedObjects(ClassAgeCountsMap&) = 0; | 410 virtual void countMarkedObjects(ClassAgeCountsMap&) = 0; |
| 408 virtual void countObjectsToSweep(ClassAgeCountsMap&) = 0; | 411 virtual void countObjectsToSweep(ClassAgeCountsMap&) = 0; |
| 409 #endif | 412 #endif |
| 410 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 413 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
| 411 virtual bool contains(Address) = 0; | 414 virtual bool contains(Address) = 0; |
| 412 #endif | 415 #endif |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 virtual bool isEmpty() override; | 476 virtual bool isEmpty() override; |
| 474 virtual void removeFromHeap() override; | 477 virtual void removeFromHeap() override; |
| 475 virtual void sweep() override; | 478 virtual void sweep() override; |
| 476 virtual void makeConsistentForGC() override; | 479 virtual void makeConsistentForGC() override; |
| 477 virtual void makeConsistentForMutator() override; | 480 virtual void makeConsistentForMutator() override; |
| 478 #if defined(ADDRESS_SANITIZER) | 481 #if defined(ADDRESS_SANITIZER) |
| 479 virtual void poisonUnmarkedObjects() override; | 482 virtual void poisonUnmarkedObjects() override; |
| 480 #endif | 483 #endif |
| 481 virtual void checkAndMarkPointer(Visitor*, Address) override; | 484 virtual void checkAndMarkPointer(Visitor*, Address) override; |
| 482 virtual void markOrphaned() override; | 485 virtual void markOrphaned() override; |
| 486 |
| 487 void takeSnapshot(const String& dumpBaseName, size_t pageIndex) override; |
| 483 #if ENABLE(GC_PROFILING) | 488 #if ENABLE(GC_PROFILING) |
| 484 const GCInfo* findGCInfo(Address) override; | 489 const GCInfo* findGCInfo(Address) override; |
| 485 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; | 490 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; |
| 486 void incrementMarkedObjectsAge() override; | 491 void incrementMarkedObjectsAge() override; |
| 487 void countMarkedObjects(ClassAgeCountsMap&) override; | 492 void countMarkedObjects(ClassAgeCountsMap&) override; |
| 488 void countObjectsToSweep(ClassAgeCountsMap&) override; | 493 void countObjectsToSweep(ClassAgeCountsMap&) override; |
| 489 #endif | 494 #endif |
| 490 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 495 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
| 491 // Returns true for the whole blinkPageSize page that the page is on, even | 496 // Returns true for the whole blinkPageSize page that the page is on, even |
| 492 // for the header, and the unmapped guard page at the start. That ensures | 497 // for the header, and the unmapped guard page at the start. That ensures |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 virtual void removeFromHeap() override; | 542 virtual void removeFromHeap() override; |
| 538 virtual void sweep() override; | 543 virtual void sweep() override; |
| 539 virtual void makeConsistentForGC() override; | 544 virtual void makeConsistentForGC() override; |
| 540 virtual void makeConsistentForMutator() override; | 545 virtual void makeConsistentForMutator() override; |
| 541 #if defined(ADDRESS_SANITIZER) | 546 #if defined(ADDRESS_SANITIZER) |
| 542 virtual void poisonUnmarkedObjects() override; | 547 virtual void poisonUnmarkedObjects() override; |
| 543 #endif | 548 #endif |
| 544 virtual void checkAndMarkPointer(Visitor*, Address) override; | 549 virtual void checkAndMarkPointer(Visitor*, Address) override; |
| 545 virtual void markOrphaned() override; | 550 virtual void markOrphaned() override; |
| 546 | 551 |
| 552 void takeSnapshot(const String& dumpBaseName, size_t pageIndex) override; |
| 547 #if ENABLE(GC_PROFILING) | 553 #if ENABLE(GC_PROFILING) |
| 548 const GCInfo* findGCInfo(Address) override; | 554 const GCInfo* findGCInfo(Address) override; |
| 549 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; | 555 void snapshot(TracedValue*, ThreadState::SnapshotInfo*) override; |
| 550 void incrementMarkedObjectsAge() override; | 556 void incrementMarkedObjectsAge() override; |
| 551 void countMarkedObjects(ClassAgeCountsMap&) override; | 557 void countMarkedObjects(ClassAgeCountsMap&) override; |
| 552 void countObjectsToSweep(ClassAgeCountsMap&) override; | 558 void countObjectsToSweep(ClassAgeCountsMap&) override; |
| 553 #endif | 559 #endif |
| 554 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 560 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
| 555 // Returns true for any address that is on one of the pages that this | 561 // Returns true for any address that is on one of the pages that this |
| 556 // large object uses. That ensures that we can use a negative result to | 562 // large object uses. That ensures that we can use a negative result to |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1301 size_t copySize = previousHeader->payloadSize(); | 1307 size_t copySize = previousHeader->payloadSize(); |
| 1302 if (copySize > size) | 1308 if (copySize > size) |
| 1303 copySize = size; | 1309 copySize = size; |
| 1304 memcpy(address, previous, copySize); | 1310 memcpy(address, previous, copySize); |
| 1305 return address; | 1311 return address; |
| 1306 } | 1312 } |
| 1307 | 1313 |
| 1308 } // namespace blink | 1314 } // namespace blink |
| 1309 | 1315 |
| 1310 #endif // Heap_h | 1316 #endif // Heap_h |
| OLD | NEW |