| 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 20 matching lines...) Expand all Loading... |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "platform/heap/ThreadState.h" | 32 #include "platform/heap/ThreadState.h" |
| 33 | 33 |
| 34 #include "platform/ScriptForbiddenScope.h" | 34 #include "platform/ScriptForbiddenScope.h" |
| 35 #include "platform/TraceEvent.h" | 35 #include "platform/TraceEvent.h" |
| 36 #include "platform/heap/AddressSanitizer.h" | 36 #include "platform/heap/AddressSanitizer.h" |
| 37 #include "platform/heap/CallbackStack.h" | 37 #include "platform/heap/CallbackStack.h" |
| 38 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
| 39 #include "platform/heap/Heap.h" | 39 #include "platform/heap/Heap.h" |
| 40 #include "platform/heap/SafePoint.h" | 40 #include "platform/heap/SafePoint.h" |
| 41 #include "platform/scheduler/Scheduler.h" | |
| 42 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
| 42 #include "public/platform/WebScheduler.h" |
| 43 #include "public/platform/WebThread.h" | 43 #include "public/platform/WebThread.h" |
| 44 #include "public/platform/WebTraceLocation.h" | 44 #include "public/platform/WebTraceLocation.h" |
| 45 #include "wtf/ThreadingPrimitives.h" | 45 #include "wtf/ThreadingPrimitives.h" |
| 46 #if ENABLE(GC_PROFILING) | 46 #if ENABLE(GC_PROFILING) |
| 47 #include "platform/TracedValue.h" | 47 #include "platform/TracedValue.h" |
| 48 #include "wtf/text/StringHash.h" | 48 #include "wtf/text/StringHash.h" |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 #if OS(WIN) | 51 #if OS(WIN) |
| 52 #include <stddef.h> | 52 #include <stddef.h> |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 } | 594 } |
| 595 | 595 |
| 596 void ThreadState::performIdleGC(double deadlineSeconds) | 596 void ThreadState::performIdleGC(double deadlineSeconds) |
| 597 { | 597 { |
| 598 ASSERT(isMainThread()); | 598 ASSERT(isMainThread()); |
| 599 | 599 |
| 600 if (gcState() != IdleGCScheduled) | 600 if (gcState() != IdleGCScheduled) |
| 601 return; | 601 return; |
| 602 | 602 |
| 603 double idleDeltaInSeconds = deadlineSeconds - Platform::current()->monotonic
allyIncreasingTime(); | 603 double idleDeltaInSeconds = deadlineSeconds - Platform::current()->monotonic
allyIncreasingTime(); |
| 604 if (idleDeltaInSeconds <= Heap::estimatedMarkingTime() && !Scheduler::shared
()->canExceedIdleDeadlineIfRequired()) { | 604 if (idleDeltaInSeconds <= Heap::estimatedMarkingTime() && !Platform::current
()->currentThread()->scheduler()->canExceedIdleDeadlineIfRequired()) { |
| 605 // If marking is estimated to take longer than the deadline and we can't | 605 // If marking is estimated to take longer than the deadline and we can't |
| 606 // exceed the deadline, then reschedule for the next idle period. | 606 // exceed the deadline, then reschedule for the next idle period. |
| 607 scheduleIdleGC(); | 607 scheduleIdleGC(); |
| 608 return; | 608 return; |
| 609 } | 609 } |
| 610 | 610 |
| 611 Heap::collectGarbage(NoHeapPointersOnStack, GCWithoutSweep, Heap::IdleGC); | 611 Heap::collectGarbage(NoHeapPointersOnStack, GCWithoutSweep, Heap::IdleGC); |
| 612 } | 612 } |
| 613 | 613 |
| 614 void ThreadState::performIdleLazySweep(double deadlineSeconds) | 614 void ThreadState::performIdleLazySweep(double deadlineSeconds) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 { | 657 { |
| 658 // Idle GC is supported only in the main thread. | 658 // Idle GC is supported only in the main thread. |
| 659 if (!isMainThread()) | 659 if (!isMainThread()) |
| 660 return; | 660 return; |
| 661 | 661 |
| 662 if (isSweepingInProgress()) { | 662 if (isSweepingInProgress()) { |
| 663 setGCState(SweepingAndIdleGCScheduled); | 663 setGCState(SweepingAndIdleGCScheduled); |
| 664 return; | 664 return; |
| 665 } | 665 } |
| 666 | 666 |
| 667 Scheduler::shared()->postNonNestableIdleTask(FROM_HERE, WTF::bind<double>(&T
hreadState::performIdleGC, this)); | 667 Platform::current()->currentThread()->scheduler()->postNonNestableIdleTask(F
ROM_HERE, WTF::bind<double>(&ThreadState::performIdleGC, this)); |
| 668 setGCState(IdleGCScheduled); | 668 setGCState(IdleGCScheduled); |
| 669 } | 669 } |
| 670 | 670 |
| 671 void ThreadState::scheduleIdleLazySweep() | 671 void ThreadState::scheduleIdleLazySweep() |
| 672 { | 672 { |
| 673 // Idle complete sweep is supported only in the main thread. | 673 // Idle complete sweep is supported only in the main thread. |
| 674 if (!isMainThread()) | 674 if (!isMainThread()) |
| 675 return; | 675 return; |
| 676 | 676 |
| 677 // TODO(haraken): Remove this. Lazy sweeping is not yet enabled in non-oilpa
n builds. | 677 // TODO(haraken): Remove this. Lazy sweeping is not yet enabled in non-oilpa
n builds. |
| (...skipping 614 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 |