| 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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 | 621 |
| 622 void ThreadState::scheduleGCIfNeeded() | 622 void ThreadState::scheduleGCIfNeeded() |
| 623 { | 623 { |
| 624 checkThread(); | 624 checkThread(); |
| 625 // Allocation is allowed during sweeping, but those allocations should not | 625 // Allocation is allowed during sweeping, but those allocations should not |
| 626 // trigger nested GCs. | 626 // trigger nested GCs. |
| 627 if (isSweepingInProgress()) | 627 if (isSweepingInProgress()) |
| 628 return; | 628 return; |
| 629 ASSERT(!sweepForbidden()); | 629 ASSERT(!sweepForbidden()); |
| 630 | 630 |
| 631 #if ENABLE(GC_PROFILING) |
| 632 // These values are divided by 1024 to avoid overflow in practical cases (TR
ACE_COUNTER values are 32-bit ints). |
| 633 // They are capped to INT_MAX just in case. |
| 634 TRACE_COUNTER1("blink_gc", "Heap::estimatedLiveObjectSizeKB", std::min(Heap:
:estimatedLiveObjectSize() / 1024, static_cast<size_t>(INT_MAX))); |
| 635 TRACE_COUNTER1("blink_gc", "Heap::allocatedObjectSizeKB", std::min(Heap::all
ocatedObjectSize() / 1024, static_cast<size_t>(INT_MAX))); |
| 636 TRACE_COUNTER1("blink_gc", "Heap::markedObjectSizeKB", std::min(Heap::marked
ObjectSize() / 1024, static_cast<size_t>(INT_MAX))); |
| 637 TRACE_COUNTER1("blink_gc", "Partitions::totalSizeOfCommittedPagesKB", std::m
in(WTF::Partitions::totalSizeOfCommittedPages() / 1024, static_cast<size_t>(INT_
MAX))); |
| 638 #endif |
| 639 |
| 631 if (shouldForceConservativeGC()) { | 640 if (shouldForceConservativeGC()) { |
| 632 Heap::collectGarbage(HeapPointersOnStack, GCWithoutSweep, Heap::Conserva
tiveGC); | 641 Heap::collectGarbage(HeapPointersOnStack, GCWithoutSweep, Heap::Conserva
tiveGC); |
| 633 return; | 642 return; |
| 634 } | 643 } |
| 635 if (shouldSchedulePreciseGC()) | 644 if (shouldSchedulePreciseGC()) |
| 636 schedulePreciseGC(); | 645 schedulePreciseGC(); |
| 637 else if (shouldScheduleIdleGC()) | 646 else if (shouldScheduleIdleGC()) |
| 638 scheduleIdleGC(); | 647 scheduleIdleGC(); |
| 639 } | 648 } |
| 640 | 649 |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1472 json->beginArray(it->key.ascii().data()); | 1481 json->beginArray(it->key.ascii().data()); |
| 1473 for (size_t age = 0; age <= maxHeapObjectAge; ++age) | 1482 for (size_t age = 0; age <= maxHeapObjectAge; ++age) |
| 1474 json->pushInteger(it->value.ages[age]); | 1483 json->pushInteger(it->value.ages[age]); |
| 1475 json->endArray(); | 1484 json->endArray(); |
| 1476 } | 1485 } |
| 1477 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); | 1486 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); |
| 1478 } | 1487 } |
| 1479 #endif | 1488 #endif |
| 1480 | 1489 |
| 1481 } // namespace blink | 1490 } // namespace blink |
| OLD | NEW |