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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 namespace { | 693 namespace { |
694 | 694 |
695 #define UNEXPECTED_GCSTATE(s) case ThreadState::s: RELEASE_ASSERT_WITH_MESSAGE(f
alse, "Unexpected transition while in GCState " #s); return | 695 #define UNEXPECTED_GCSTATE(s) case ThreadState::s: RELEASE_ASSERT_WITH_MESSAGE(f
alse, "Unexpected transition while in GCState " #s); return |
696 | 696 |
697 void unexpectedGCState(ThreadState::GCState gcState) | 697 void unexpectedGCState(ThreadState::GCState gcState) |
698 { | 698 { |
699 switch (gcState) { | 699 switch (gcState) { |
700 UNEXPECTED_GCSTATE(NoGCScheduled); | 700 UNEXPECTED_GCSTATE(NoGCScheduled); |
701 UNEXPECTED_GCSTATE(IdleGCScheduled); | 701 UNEXPECTED_GCSTATE(IdleGCScheduled); |
702 UNEXPECTED_GCSTATE(PreciseGCScheduled); | 702 UNEXPECTED_GCSTATE(PreciseGCScheduled); |
703 UNEXPECTED_GCSTATE(GCScheduledForTesting); | 703 UNEXPECTED_GCSTATE(FullGCScheduled); |
704 UNEXPECTED_GCSTATE(StoppingOtherThreads); | 704 UNEXPECTED_GCSTATE(StoppingOtherThreads); |
705 UNEXPECTED_GCSTATE(GCRunning); | 705 UNEXPECTED_GCSTATE(GCRunning); |
706 UNEXPECTED_GCSTATE(EagerSweepScheduled); | 706 UNEXPECTED_GCSTATE(EagerSweepScheduled); |
707 UNEXPECTED_GCSTATE(LazySweepScheduled); | 707 UNEXPECTED_GCSTATE(LazySweepScheduled); |
708 UNEXPECTED_GCSTATE(Sweeping); | 708 UNEXPECTED_GCSTATE(Sweeping); |
709 UNEXPECTED_GCSTATE(SweepingAndIdleGCScheduled); | 709 UNEXPECTED_GCSTATE(SweepingAndIdleGCScheduled); |
710 UNEXPECTED_GCSTATE(SweepingAndPreciseGCScheduled); | 710 UNEXPECTED_GCSTATE(SweepingAndPreciseGCScheduled); |
711 default: | 711 default: |
712 ASSERT_NOT_REACHED(); | 712 ASSERT_NOT_REACHED(); |
713 return; | 713 return; |
714 } | 714 } |
715 } | 715 } |
716 | 716 |
717 #undef UNEXPECTED_GCSTATE | 717 #undef UNEXPECTED_GCSTATE |
718 | 718 |
719 } // namespace | 719 } // namespace |
720 | 720 |
721 #define VERIFY_STATE_TRANSITION(condition) if (UNLIKELY(!(condition))) unexpecte
dGCState(m_gcState) | 721 #define VERIFY_STATE_TRANSITION(condition) if (UNLIKELY(!(condition))) unexpecte
dGCState(m_gcState) |
722 | 722 |
723 void ThreadState::setGCState(GCState gcState) | 723 void ThreadState::setGCState(GCState gcState) |
724 { | 724 { |
725 switch (gcState) { | 725 switch (gcState) { |
726 case NoGCScheduled: | 726 case NoGCScheduled: |
727 checkThread(); | 727 checkThread(); |
728 VERIFY_STATE_TRANSITION(m_gcState == StoppingOtherThreads || m_gcState =
= Sweeping || m_gcState == SweepingAndIdleGCScheduled); | 728 VERIFY_STATE_TRANSITION(m_gcState == StoppingOtherThreads || m_gcState =
= Sweeping || m_gcState == SweepingAndIdleGCScheduled); |
729 break; | 729 break; |
730 case IdleGCScheduled: | 730 case IdleGCScheduled: |
731 case PreciseGCScheduled: | 731 case PreciseGCScheduled: |
732 case GCScheduledForTesting: | 732 case FullGCScheduled: |
733 checkThread(); | 733 checkThread(); |
734 VERIFY_STATE_TRANSITION(m_gcState == NoGCScheduled || m_gcState == IdleG
CScheduled || m_gcState == PreciseGCScheduled || m_gcState == GCScheduledForTest
ing || m_gcState == StoppingOtherThreads || m_gcState == SweepingAndIdleGCSchedu
led || m_gcState == SweepingAndPreciseGCScheduled); | 734 VERIFY_STATE_TRANSITION(m_gcState == NoGCScheduled || m_gcState == IdleG
CScheduled || m_gcState == PreciseGCScheduled || m_gcState == FullGCScheduled ||
m_gcState == StoppingOtherThreads || m_gcState == SweepingAndIdleGCScheduled ||
m_gcState == SweepingAndPreciseGCScheduled); |
735 completeSweep(); | 735 completeSweep(); |
736 break; | 736 break; |
737 case StoppingOtherThreads: | 737 case StoppingOtherThreads: |
738 checkThread(); | 738 checkThread(); |
739 VERIFY_STATE_TRANSITION(m_gcState == NoGCScheduled || m_gcState == IdleG
CScheduled || m_gcState == PreciseGCScheduled || m_gcState == GCScheduledForTest
ing || m_gcState == Sweeping || m_gcState == SweepingAndIdleGCScheduled || m_gcS
tate == SweepingAndPreciseGCScheduled); | 739 VERIFY_STATE_TRANSITION(m_gcState == NoGCScheduled || m_gcState == IdleG
CScheduled || m_gcState == PreciseGCScheduled || m_gcState == FullGCScheduled ||
m_gcState == Sweeping || m_gcState == SweepingAndIdleGCScheduled || m_gcState =
= SweepingAndPreciseGCScheduled); |
740 completeSweep(); | 740 completeSweep(); |
741 break; | 741 break; |
742 case GCRunning: | 742 case GCRunning: |
743 ASSERT(!isInGC()); | 743 ASSERT(!isInGC()); |
744 VERIFY_STATE_TRANSITION(m_gcState != GCRunning); | 744 VERIFY_STATE_TRANSITION(m_gcState != GCRunning); |
745 break; | 745 break; |
746 case EagerSweepScheduled: | 746 case EagerSweepScheduled: |
747 case LazySweepScheduled: | 747 case LazySweepScheduled: |
748 ASSERT(isInGC()); | 748 ASSERT(isInGC()); |
749 VERIFY_STATE_TRANSITION(m_gcState == GCRunning); | 749 VERIFY_STATE_TRANSITION(m_gcState == GCRunning); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 } | 781 } |
782 } | 782 } |
783 | 783 |
784 void ThreadState::runScheduledGC(StackState stackState) | 784 void ThreadState::runScheduledGC(StackState stackState) |
785 { | 785 { |
786 checkThread(); | 786 checkThread(); |
787 if (stackState != NoHeapPointersOnStack) | 787 if (stackState != NoHeapPointersOnStack) |
788 return; | 788 return; |
789 | 789 |
790 switch (gcState()) { | 790 switch (gcState()) { |
791 case GCScheduledForTesting: | 791 case FullGCScheduled: |
792 Heap::collectAllGarbage(); | 792 Heap::collectAllGarbage(); |
793 break; | 793 break; |
794 case PreciseGCScheduled: | 794 case PreciseGCScheduled: |
795 Heap::collectGarbage(NoHeapPointersOnStack, GCWithoutSweep, Heap::Precis
eGC); | 795 Heap::collectGarbage(NoHeapPointersOnStack, GCWithoutSweep, Heap::Precis
eGC); |
796 break; | 796 break; |
797 case IdleGCScheduled: | 797 case IdleGCScheduled: |
798 // Idle time GC will be scheduled by Blink Scheduler. | 798 // Idle time GC will be scheduled by Blink Scheduler. |
799 break; | 799 break; |
800 default: | 800 default: |
801 break; | 801 break; |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 json->beginArray(it->key.ascii().data()); | 1292 json->beginArray(it->key.ascii().data()); |
1293 for (size_t age = 0; age <= maxHeapObjectAge; ++age) | 1293 for (size_t age = 0; age <= maxHeapObjectAge; ++age) |
1294 json->pushInteger(it->value.ages[age]); | 1294 json->pushInteger(it->value.ages[age]); |
1295 json->endArray(); | 1295 json->endArray(); |
1296 } | 1296 } |
1297 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); | 1297 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); |
1298 } | 1298 } |
1299 #endif | 1299 #endif |
1300 | 1300 |
1301 } // namespace blink | 1301 } // namespace blink |
OLD | NEW |