| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // Finish sweeping. | 234 // Finish sweeping. |
| 235 completeSweep(); | 235 completeSweep(); |
| 236 | 236 |
| 237 // From here on ignore all conservatively discovered | 237 // From here on ignore all conservatively discovered |
| 238 // pointers into the heap owned by this thread. | 238 // pointers into the heap owned by this thread. |
| 239 m_isTerminating = true; | 239 m_isTerminating = true; |
| 240 | 240 |
| 241 // Set the terminate flag on all heap pages of this thread. This is used
to | 241 // Set the terminate flag on all heap pages of this thread. This is used
to |
| 242 // ensure we don't trace pages on other threads that are not part of the | 242 // ensure we don't trace pages on other threads that are not part of the |
| 243 // thread local GC. | 243 // thread local GC. |
| 244 prepareHeapForTermination(); | 244 prepareForThreadStateTermination(); |
| 245 |
| 246 ThreadState::crossThreadPersistentRegion().prepareForThreadStateTerminat
ion(this); |
| 245 | 247 |
| 246 // Do thread local GC's as long as the count of thread local Persistents | 248 // Do thread local GC's as long as the count of thread local Persistents |
| 247 // changes and is above zero. | 249 // changes and is above zero. |
| 248 int oldCount = -1; | 250 int oldCount = -1; |
| 249 int currentCount = persistentRegion()->numberOfPersistents(); | 251 int currentCount = persistentRegion()->numberOfPersistents(); |
| 250 ASSERT(currentCount >= 0); | 252 ASSERT(currentCount >= 0); |
| 251 while (currentCount != oldCount) { | 253 while (currentCount != oldCount) { |
| 252 Heap::collectGarbageForTerminatingThread(this); | 254 Heap::collectGarbageForTerminatingThread(this); |
| 253 oldCount = currentCount; | 255 oldCount = currentCount; |
| 254 currentCount = persistentRegion()->numberOfPersistents(); | 256 currentCount = persistentRegion()->numberOfPersistents(); |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 break; | 1148 break; |
| 1147 case SweepingAndIdleGCScheduled: | 1149 case SweepingAndIdleGCScheduled: |
| 1148 setGCState(NoGCScheduled); | 1150 setGCState(NoGCScheduled); |
| 1149 scheduleIdleGC(); | 1151 scheduleIdleGC(); |
| 1150 break; | 1152 break; |
| 1151 default: | 1153 default: |
| 1152 ASSERT_NOT_REACHED(); | 1154 ASSERT_NOT_REACHED(); |
| 1153 } | 1155 } |
| 1154 } | 1156 } |
| 1155 | 1157 |
| 1156 void ThreadState::prepareHeapForTermination() | 1158 void ThreadState::prepareForThreadStateTermination() |
| 1157 { | 1159 { |
| 1158 ASSERT(checkThread()); | 1160 ASSERT(checkThread()); |
| 1159 for (int i = 0; i < NumberOfHeaps; ++i) | 1161 for (int i = 0; i < NumberOfHeaps; ++i) |
| 1160 m_heaps[i]->prepareHeapForTermination(); | 1162 m_heaps[i]->prepareHeapForTermination(); |
| 1161 } | 1163 } |
| 1162 | 1164 |
| 1163 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 1165 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
| 1164 BasePage* ThreadState::findPageFromAddress(Address address) | 1166 BasePage* ThreadState::findPageFromAddress(Address address) |
| 1165 { | 1167 { |
| 1166 for (int i = 0; i < NumberOfHeaps; ++i) { | 1168 for (int i = 0; i < NumberOfHeaps; ++i) { |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1529 json->beginArray(it->key.ascii().data()); | 1531 json->beginArray(it->key.ascii().data()); |
| 1530 for (size_t age = 0; age <= maxHeapObjectAge; ++age) | 1532 for (size_t age = 0; age <= maxHeapObjectAge; ++age) |
| 1531 json->pushInteger(it->value.ages[age]); | 1533 json->pushInteger(it->value.ages[age]); |
| 1532 json->endArray(); | 1534 json->endArray(); |
| 1533 } | 1535 } |
| 1534 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); | 1536 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); |
| 1535 } | 1537 } |
| 1536 #endif | 1538 #endif |
| 1537 | 1539 |
| 1538 } // namespace blink | 1540 } // namespace blink |
| OLD | NEW |