| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 168 } |
| 169 | 169 |
| 170 void ThreadState::DetachCurrentThread() { | 170 void ThreadState::DetachCurrentThread() { |
| 171 ThreadState* state = Current(); | 171 ThreadState* state = Current(); |
| 172 state->RunTerminationGC(); | 172 state->RunTerminationGC(); |
| 173 delete state; | 173 delete state; |
| 174 } | 174 } |
| 175 | 175 |
| 176 void ThreadState::RemoveAllPages() { | 176 void ThreadState::RemoveAllPages() { |
| 177 DCHECK(CheckThread()); | 177 DCHECK(CheckThread()); |
| 178 for (int i = 0; i < BlinkGC::kNumberOfArenas; ++i) | 178 for (int i = 0; i < BlinkGC::kNumberOfArenas; ++i) { |
| 179 arenas_[i]->RemoveAllPages(); | 179 arenas_[i]->RemoveAllPages(); |
| 180 } |
| 180 } | 181 } |
| 181 | 182 |
| 182 void ThreadState::RunTerminationGC() { | 183 void ThreadState::RunTerminationGC() { |
| 183 if (IsMainThread()) { | 184 if (IsMainThread()) { |
| 184 RemoveAllPages(); | 185 RemoveAllPages(); |
| 185 return; | 186 return; |
| 186 } | 187 } |
| 187 DCHECK(CheckThread()); | 188 DCHECK(CheckThread()); |
| 188 | 189 |
| 189 // Finish sweeping. | 190 // Finish sweeping. |
| (...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1569 CollectGarbage(BlinkGC::kNoHeapPointersOnStack, BlinkGC::kGCWithSweep, | 1570 CollectGarbage(BlinkGC::kNoHeapPointersOnStack, BlinkGC::kGCWithSweep, |
| 1570 BlinkGC::kForcedGC); | 1571 BlinkGC::kForcedGC); |
| 1571 size_t live_objects = Heap().HeapStats().MarkedObjectSize(); | 1572 size_t live_objects = Heap().HeapStats().MarkedObjectSize(); |
| 1572 if (live_objects == previous_live_objects) | 1573 if (live_objects == previous_live_objects) |
| 1573 break; | 1574 break; |
| 1574 previous_live_objects = live_objects; | 1575 previous_live_objects = live_objects; |
| 1575 } | 1576 } |
| 1576 } | 1577 } |
| 1577 | 1578 |
| 1578 } // namespace blink | 1579 } // namespace blink |
| OLD | NEW |