| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 bool isSweepingInProgress() const { | 223 bool isSweepingInProgress() const { |
| 224 return gcState() == Sweeping || | 224 return gcState() == Sweeping || |
| 225 gcState() == SweepingAndPreciseGCScheduled || | 225 gcState() == SweepingAndPreciseGCScheduled || |
| 226 gcState() == SweepingAndIdleGCScheduled; | 226 gcState() == SweepingAndIdleGCScheduled; |
| 227 } | 227 } |
| 228 | 228 |
| 229 // A GC runs in the following sequence. | 229 // A GC runs in the following sequence. |
| 230 // | 230 // |
| 231 // 1) preGC() is called. | 231 // 1) preGC() is called. |
| 232 // 2) ThreadHeap::collectGarbage() is called. This marks live objects. | 232 // 2) ThreadHeap::collectGarbage() is called. This marks live objects. |
| 233 // 3) postGC() is called. This does thread-local weak processing, | 233 // 3) postGC() is called. This does thread-local weak processing. |
| 234 // pre-finalization, eager sweeping and heap compaction. | 234 // 4) preSweep() is called. This does pre-finalization, eager sweeping and |
| 235 // heap compaction. |
| 235 // 4) Lazy sweeping sweeps heaps incrementally. completeSweep() may be called | 236 // 4) Lazy sweeping sweeps heaps incrementally. completeSweep() may be called |
| 236 // to complete the sweeping. | 237 // to complete the sweeping. |
| 237 // 5) postSweep() is called. | 238 // 5) postSweep() is called. |
| 238 // | 239 // |
| 239 // Notes: | 240 // Notes: |
| 240 // - The world is stopped between 1) and 3). | 241 // - The world is stopped between 1) and 3). |
| 241 // - isInGC() returns true between 1) and 3). | 242 // - isInGC() returns true between 1) and 3). |
| 242 // - isSweepingInProgress() returns true while any sweeping operation is | 243 // - isSweepingInProgress() returns true while any sweeping operation is |
| 243 // running. | 244 // running. |
| 244 void makeConsistentForGC(); | 245 void makeConsistentForGC(); |
| 245 void preGC(); | 246 void preGC(); |
| 246 void postGC(BlinkGC::GCType); | 247 void postGC(BlinkGC::GCType); |
| 247 void completeSweep(); | 248 void completeSweep(); |
| 249 void preSweep(BlinkGC::GCType); |
| 248 void postSweep(); | 250 void postSweep(); |
| 249 // makeConsistentForMutator() drops marks from marked objects and rebuild | 251 // makeConsistentForMutator() drops marks from marked objects and rebuild |
| 250 // free lists. This is called after taking a snapshot and before resuming | 252 // free lists. This is called after taking a snapshot and before resuming |
| 251 // the executions of mutators. | 253 // the executions of mutators. |
| 252 void makeConsistentForMutator(); | 254 void makeConsistentForMutator(); |
| 253 | 255 |
| 254 void compact(); | 256 void compact(); |
| 255 | 257 |
| 256 // Support for disallowing allocation. Mainly used for sanity | 258 // Support for disallowing allocation. Mainly used for sanity |
| 257 // checks asserts. | 259 // checks asserts. |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 class ThreadStateFor<AnyThread> { | 738 class ThreadStateFor<AnyThread> { |
| 737 STATIC_ONLY(ThreadStateFor); | 739 STATIC_ONLY(ThreadStateFor); |
| 738 | 740 |
| 739 public: | 741 public: |
| 740 static ThreadState* state() { return ThreadState::current(); } | 742 static ThreadState* state() { return ThreadState::current(); } |
| 741 }; | 743 }; |
| 742 | 744 |
| 743 } // namespace blink | 745 } // namespace blink |
| 744 | 746 |
| 745 #endif // ThreadState_h | 747 #endif // ThreadState_h |
| OLD | NEW |