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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 void ThreadState::performIdleGC(double deadlineSeconds) | 584 void ThreadState::performIdleGC(double deadlineSeconds) |
585 { | 585 { |
586 ASSERT(isMainThread()); | 586 ASSERT(isMainThread()); |
587 | 587 |
588 m_hasPendingIdleTask = false; | 588 m_hasPendingIdleTask = false; |
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() && !Scheduler::shared
()->canExceedIdleDeadlineIfRequired()) { |
| 595 // If marking is estimated to take longer than the deadline and we can't |
| 596 // exceed the deadline, then reschedule for the next idle period. |
595 scheduleIdleGC(); | 597 scheduleIdleGC(); |
596 return; | 598 return; |
597 } | 599 } |
598 | 600 |
599 // FIXME: Make this precise once idle task is guaranteed to be not in nested
loop. | 601 // FIXME: Make this precise once idle task is guaranteed to be not in nested
loop. |
600 Heap::collectGarbage(HeapPointersOnStack, GCWithoutSweep, Heap::IdleGC); | 602 Heap::collectGarbage(HeapPointersOnStack, GCWithoutSweep, Heap::IdleGC); |
601 } | 603 } |
602 | 604 |
603 void ThreadState::scheduleIdleGC() | 605 void ThreadState::scheduleIdleGC() |
604 { | 606 { |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 json->beginArray(it->key.ascii().data()); | 1233 json->beginArray(it->key.ascii().data()); |
1232 for (size_t age = 0; age <= maxHeapObjectAge; ++age) | 1234 for (size_t age = 0; age <= maxHeapObjectAge; ++age) |
1233 json->pushInteger(it->value.ages[age]); | 1235 json->pushInteger(it->value.ages[age]); |
1234 json->endArray(); | 1236 json->endArray(); |
1235 } | 1237 } |
1236 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); | 1238 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); |
1237 } | 1239 } |
1238 #endif | 1240 #endif |
1239 | 1241 |
1240 } // namespace blink | 1242 } // namespace blink |
OLD | NEW |