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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // | 353 // |
354 // Each thread that has ThreadState attached must: | 354 // Each thread that has ThreadState attached must: |
355 // - periodically check if GC is requested from another thread by calling
a safePoint() method; | 355 // - periodically check if GC is requested from another thread by calling
a safePoint() method; |
356 // - use SafePointScope around long running loops that have no safePoint()
invocation inside, | 356 // - use SafePointScope around long running loops that have no safePoint()
invocation inside, |
357 // such loops must not touch any heap object; | 357 // such loops must not touch any heap object; |
358 // - register an Interruptor that can interrupt long running loops that ha
ve no calls to safePoint and | 358 // - register an Interruptor that can interrupt long running loops that ha
ve no calls to safePoint and |
359 // are not wrapped in a SafePointScope (e.g. Interruptor for JavaScript
code) | 359 // are not wrapped in a SafePointScope (e.g. Interruptor for JavaScript
code) |
360 // | 360 // |
361 | 361 |
362 // Request all other threads to stop. Must only be called if the current thr
ead is at safepoint. | 362 // Request all other threads to stop. Must only be called if the current thr
ead is at safepoint. |
363 static void stopThreads(); | 363 static bool stopThreads(); |
364 static void resumeThreads(); | 364 static void resumeThreads(); |
365 | 365 |
366 // Check if GC is requested by another thread and pause this thread if this
is the case. | 366 // Check if GC is requested by another thread and pause this thread if this
is the case. |
367 // Can only be called when current thread is in a consistent state. | 367 // Can only be called when current thread is in a consistent state. |
368 void safePoint(StackState); | 368 void safePoint(StackState); |
369 | 369 |
370 // Mark current thread as running inside safepoint. | 370 // Mark current thread as running inside safepoint. |
371 void enterSafePointWithoutPointers() { enterSafePoint(NoHeapPointersOnStack,
0); } | 371 void enterSafePointWithoutPointers() { enterSafePoint(NoHeapPointersOnStack,
0); } |
372 void enterSafePointWithPointers(void* scopeMarker) { enterSafePoint(HeapPoin
tersOnStack, scopeMarker); } | 372 void enterSafePointWithPointers(void* scopeMarker) { enterSafePoint(HeapPoin
tersOnStack, scopeMarker); } |
373 void leaveSafePoint(); | 373 void leaveSafePoint(); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 }; | 597 }; |
598 | 598 |
599 template<> class ThreadStateFor<AnyThread> { | 599 template<> class ThreadStateFor<AnyThread> { |
600 public: | 600 public: |
601 static ThreadState* state() { return ThreadState::current(); } | 601 static ThreadState* state() { return ThreadState::current(); } |
602 }; | 602 }; |
603 | 603 |
604 } | 604 } |
605 | 605 |
606 #endif // ThreadState_h | 606 #endif // ThreadState_h |
OLD | NEW |