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