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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 | 589 |
590 if (gcState() != IdleGCScheduled) | 590 if (gcState() != IdleGCScheduled) |
591 return; | 591 return; |
592 | 592 |
593 double idleDeltaInSeconds = deadlineSeconds - Platform::current()->monotonic
allyIncreasingTime(); | 593 double idleDeltaInSeconds = deadlineSeconds - Platform::current()->monotonic
allyIncreasingTime(); |
594 if (idleDeltaInSeconds <= Heap::estimatedMarkingTime()) { | 594 if (idleDeltaInSeconds <= Heap::estimatedMarkingTime()) { |
595 scheduleIdleGC(); | 595 scheduleIdleGC(); |
596 return; | 596 return; |
597 } | 597 } |
598 | 598 |
599 // FIXME: Make this precise once idle task is guaranteed to be not in nested
loop. | 599 Heap::collectGarbage(NoHeapPointersOnStack, GCWithoutSweep, Heap::IdleGC); |
600 Heap::collectGarbage(HeapPointersOnStack, GCWithoutSweep, Heap::IdleGC); | |
601 } | 600 } |
602 | 601 |
603 void ThreadState::scheduleIdleGC() | 602 void ThreadState::scheduleIdleGC() |
604 { | 603 { |
605 if (!isMainThread()) | 604 if (!isMainThread()) |
606 return; | 605 return; |
607 | 606 |
608 if (isSweepingInProgress()) { | 607 if (isSweepingInProgress()) { |
609 setGCState(SweepingAndIdleGCScheduled); | 608 setGCState(SweepingAndIdleGCScheduled); |
610 return; | 609 return; |
611 } | 610 } |
612 | 611 |
613 if (!m_hasPendingIdleTask) { | 612 if (!m_hasPendingIdleTask) { |
614 m_hasPendingIdleTask = true; | 613 m_hasPendingIdleTask = true; |
615 Scheduler::shared()->postIdleTask(FROM_HERE, WTF::bind<double>(&ThreadSt
ate::performIdleGC, this)); | 614 Scheduler::shared()->postNonNestableIdleTask(FROM_HERE, WTF::bind<double
>(&ThreadState::performIdleGC, this)); |
616 } | 615 } |
617 setGCState(IdleGCScheduled); | 616 setGCState(IdleGCScheduled); |
618 } | 617 } |
619 | 618 |
620 void ThreadState::schedulePreciseGC() | 619 void ThreadState::schedulePreciseGC() |
621 { | 620 { |
622 if (isSweepingInProgress()) { | 621 if (isSweepingInProgress()) { |
623 setGCState(SweepingAndPreciseGCScheduled); | 622 setGCState(SweepingAndPreciseGCScheduled); |
624 return; | 623 return; |
625 } | 624 } |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 json->beginArray(it->key.ascii().data()); | 1198 json->beginArray(it->key.ascii().data()); |
1200 for (size_t age = 0; age <= maxHeapObjectAge; ++age) | 1199 for (size_t age = 0; age <= maxHeapObjectAge; ++age) |
1201 json->pushInteger(it->value.ages[age]); | 1200 json->pushInteger(it->value.ages[age]); |
1202 json->endArray(); | 1201 json->endArray(); |
1203 } | 1202 } |
1204 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); | 1203 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); |
1205 } | 1204 } |
1206 #endif | 1205 #endif |
1207 | 1206 |
1208 } // namespace blink | 1207 } // namespace blink |
OLD | NEW |