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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 Platform::current()->currentThread()->scheduler()->postNonNestableIdleTask(F
ROM_HERE, WTF::bind<double>(&ThreadState::performIdleGC, this)); | 669 Platform::current()->currentThread()->scheduler()->postNonNestableIdleTask(F
ROM_HERE, WTF::bind<double>(&ThreadState::performIdleGC, this)); |
670 setGCState(IdleGCScheduled); | 670 setGCState(IdleGCScheduled); |
671 } | 671 } |
672 | 672 |
673 void ThreadState::scheduleIdleLazySweep() | 673 void ThreadState::scheduleIdleLazySweep() |
674 { | 674 { |
675 // Idle complete sweep is supported only in the main thread. | 675 // Idle complete sweep is supported only in the main thread. |
676 if (!isMainThread()) | 676 if (!isMainThread()) |
677 return; | 677 return; |
678 | 678 |
679 // TODO(haraken): Remove this. Lazy sweeping is not yet enabled in non-oilpa
n builds. | |
680 #if ENABLE(OILPAN) | |
681 Platform::current()->currentThread()->scheduler()->postIdleTask(FROM_HERE, W
TF::bind<double>(&ThreadState::performIdleLazySweep, this)); | 679 Platform::current()->currentThread()->scheduler()->postIdleTask(FROM_HERE, W
TF::bind<double>(&ThreadState::performIdleLazySweep, this)); |
682 #endif | |
683 } | 680 } |
684 | 681 |
685 void ThreadState::schedulePreciseGC() | 682 void ThreadState::schedulePreciseGC() |
686 { | 683 { |
687 if (isSweepingInProgress()) { | 684 if (isSweepingInProgress()) { |
688 setGCState(SweepingAndPreciseGCScheduled); | 685 setGCState(SweepingAndPreciseGCScheduled); |
689 return; | 686 return; |
690 } | 687 } |
691 | 688 |
692 setGCState(PreciseGCScheduled); | 689 setGCState(PreciseGCScheduled); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 #if defined(ADDRESS_SANITIZER) | 894 #if defined(ADDRESS_SANITIZER) |
898 // TODO(haraken): Currently we cannot enable the poisoning because we have | 895 // TODO(haraken): Currently we cannot enable the poisoning because we have |
899 // real bugs where destructors touch other on-heap objects. Remove all the bugs | 896 // real bugs where destructors touch other on-heap objects. Remove all the bugs |
900 // and enable the poisoning. | 897 // and enable the poisoning. |
901 #if 0 | 898 #if 0 |
902 for (int i = 0; i < NumberOfHeaps; i++) | 899 for (int i = 0; i < NumberOfHeaps; i++) |
903 m_heaps[i]->poisonUnmarkedObjects(); | 900 m_heaps[i]->poisonUnmarkedObjects(); |
904 #endif | 901 #endif |
905 #endif | 902 #endif |
906 | 903 |
907 #if ENABLE(OILPAN) | |
908 if (gcState() == EagerSweepScheduled) { | 904 if (gcState() == EagerSweepScheduled) { |
909 // Eager sweeping should happen only in testing. | 905 // Eager sweeping should happen only in testing. |
910 setGCState(Sweeping); | 906 setGCState(Sweeping); |
911 completeSweep(); | 907 completeSweep(); |
912 } else { | 908 } else { |
913 // The default behavior is lazy sweeping. | 909 // The default behavior is lazy sweeping. |
914 setGCState(Sweeping); | 910 setGCState(Sweeping); |
915 scheduleIdleLazySweep(); | 911 scheduleIdleLazySweep(); |
916 } | 912 } |
917 #else | |
918 // FIXME: For now, we disable lazy sweeping in non-oilpan builds | |
919 // to avoid unacceptable behavior regressions on trunk. | |
920 setGCState(Sweeping); | |
921 completeSweep(); | |
922 #endif | |
923 | 913 |
924 #if ENABLE(GC_PROFILING) | 914 #if ENABLE(GC_PROFILING) |
925 snapshotFreeListIfNecessary(); | 915 snapshotFreeListIfNecessary(); |
926 #endif | 916 #endif |
927 } | 917 } |
928 | 918 |
929 void ThreadState::completeSweep() | 919 void ThreadState::completeSweep() |
930 { | 920 { |
931 // If we are not in a sweeping phase, there is nothing to do here. | 921 // If we are not in a sweeping phase, there is nothing to do here. |
932 if (!isSweepingInProgress()) | 922 if (!isSweepingInProgress()) |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 json->beginArray(it->key.ascii().data()); | 1298 json->beginArray(it->key.ascii().data()); |
1309 for (size_t age = 0; age <= maxHeapObjectAge; ++age) | 1299 for (size_t age = 0; age <= maxHeapObjectAge; ++age) |
1310 json->pushInteger(it->value.ages[age]); | 1300 json->pushInteger(it->value.ages[age]); |
1311 json->endArray(); | 1301 json->endArray(); |
1312 } | 1302 } |
1313 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); | 1303 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); |
1314 } | 1304 } |
1315 #endif | 1305 #endif |
1316 | 1306 |
1317 } // namespace blink | 1307 } // namespace blink |
OLD | NEW |