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