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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 513 #endif | 513 #endif |
| 514 | 514 |
| 515 #if defined(LEAK_SANITIZER) | 515 #if defined(LEAK_SANITIZER) |
| 516 void registerStaticPersistentNode(PersistentNode*); | 516 void registerStaticPersistentNode(PersistentNode*); |
| 517 void releaseStaticPersistentNodes(); | 517 void releaseStaticPersistentNodes(); |
| 518 | 518 |
| 519 void enterStaticReferenceRegistrationDisabledScope(); | 519 void enterStaticReferenceRegistrationDisabledScope(); |
| 520 void leaveStaticReferenceRegistrationDisabledScope(); | 520 void leaveStaticReferenceRegistrationDisabledScope(); |
| 521 #endif | 521 #endif |
| 522 | 522 |
| 523 void reportMemoryToV8(); | |
|
sof
2016/02/16 09:14:38
can be private (=> clearly delineating the ThreadS
peria
2016/02/17 02:31:26
Agree.
Done.
| |
| 524 | |
| 525 void resetHeapCounters(); | |
| 526 void increaseAllocatedObjectSize(size_t); | |
| 527 void decreaseAllocatedObjectSize(size_t); | |
| 528 void increaseMarkedObjectSize(size_t); | |
| 529 | |
| 523 private: | 530 private: |
| 524 enum SnapshotType { | 531 enum SnapshotType { |
| 525 HeapSnapshot, | 532 HeapSnapshot, |
| 526 FreelistSnapshot | 533 FreelistSnapshot |
| 527 }; | 534 }; |
| 528 | 535 |
| 529 ThreadState(); | 536 ThreadState(); |
| 530 ~ThreadState(); | 537 ~ThreadState(); |
| 531 | 538 |
| 532 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); | 539 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 671 size_t m_disabledStaticPersistentsRegistration; | 678 size_t m_disabledStaticPersistentsRegistration; |
| 672 #endif | 679 #endif |
| 673 | 680 |
| 674 // Ideally we want to allocate an array of size |gcInfoTableMax| but it will | 681 // Ideally we want to allocate an array of size |gcInfoTableMax| but it will |
| 675 // waste memory. Thus we limit the array size to 2^8 and share one entry | 682 // waste memory. Thus we limit the array size to 2^8 and share one entry |
| 676 // with multiple types of vectors. This won't be an issue in practice, | 683 // with multiple types of vectors. This won't be an issue in practice, |
| 677 // since there will be less than 2^8 types of objects in common cases. | 684 // since there will be less than 2^8 types of objects in common cases. |
| 678 static const int likelyToBePromptlyFreedArraySize = (1 << 8); | 685 static const int likelyToBePromptlyFreedArraySize = (1 << 8); |
| 679 static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedA rraySize - 1; | 686 static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedA rraySize - 1; |
| 680 OwnPtr<int[]> m_likelyToBePromptlyFreed; | 687 OwnPtr<int[]> m_likelyToBePromptlyFreed; |
| 688 | |
| 689 // Stats for heap memory of this thread. | |
| 690 size_t m_allocatedObjectSize; | |
| 691 size_t m_markedObjectSize; | |
| 692 size_t m_reportedMemoryToV8; | |
| 681 }; | 693 }; |
| 682 | 694 |
| 683 template<ThreadAffinity affinity> class ThreadStateFor; | 695 template<ThreadAffinity affinity> class ThreadStateFor; |
| 684 | 696 |
| 685 template<> class ThreadStateFor<MainThreadOnly> { | 697 template<> class ThreadStateFor<MainThreadOnly> { |
| 686 STATIC_ONLY(ThreadStateFor); | 698 STATIC_ONLY(ThreadStateFor); |
| 687 public: | 699 public: |
| 688 static ThreadState* state() | 700 static ThreadState* state() |
| 689 { | 701 { |
| 690 // This specialization must only be used from the main thread. | 702 // This specialization must only be used from the main thread. |
| 691 ASSERT(ThreadState::current()->isMainThread()); | 703 ASSERT(ThreadState::current()->isMainThread()); |
| 692 return ThreadState::mainThreadState(); | 704 return ThreadState::mainThreadState(); |
| 693 } | 705 } |
| 694 }; | 706 }; |
| 695 | 707 |
| 696 template<> class ThreadStateFor<AnyThread> { | 708 template<> class ThreadStateFor<AnyThread> { |
| 697 STATIC_ONLY(ThreadStateFor); | 709 STATIC_ONLY(ThreadStateFor); |
| 698 public: | 710 public: |
| 699 static ThreadState* state() { return ThreadState::current(); } | 711 static ThreadState* state() { return ThreadState::current(); } |
| 700 }; | 712 }; |
| 701 | 713 |
| 702 } // namespace blink | 714 } // namespace blink |
| 703 | 715 |
| 704 #endif // ThreadState_h | 716 #endif // ThreadState_h |
| OLD | NEW |