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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 void shouldFlushHeapDoesNotContainCache() { m_shouldFlushHeapDoesNotContainC
ache = true; } | 547 void shouldFlushHeapDoesNotContainCache() { m_shouldFlushHeapDoesNotContainC
ache = true; } |
548 | 548 |
549 void registerTraceDOMWrappers(v8::Isolate* isolate, void (*traceDOMWrappers)
(v8::Isolate*, Visitor*)) | 549 void registerTraceDOMWrappers(v8::Isolate* isolate, void (*traceDOMWrappers)
(v8::Isolate*, Visitor*)) |
550 { | 550 { |
551 m_isolate = isolate; | 551 m_isolate = isolate; |
552 m_traceDOMWrappers = traceDOMWrappers; | 552 m_traceDOMWrappers = traceDOMWrappers; |
553 } | 553 } |
554 | 554 |
555 double collectionRate() const { return m_collectionRate; } | 555 double collectionRate() const { return m_collectionRate; } |
556 | 556 |
| 557 // By entering a gc-forbidden scope, conservative GCs will not |
| 558 // be allowed while handling an out-of-line allocation request. |
| 559 // Intended used when constructing subclasses of GC mixins, where |
| 560 // the object being constructed cannot be safely traced & marked |
| 561 // fully should a GC be allowed while its subclasses are being |
| 562 // constructed. |
| 563 void enterGCForbiddenScope(unsigned delta) |
| 564 { |
| 565 m_gcForbiddenCount += delta; |
| 566 } |
| 567 |
| 568 #if ENABLE(ASSERT) |
| 569 bool isGCForbidden() const { return m_gcForbiddenCount; } |
| 570 #endif |
| 571 |
557 private: | 572 private: |
558 ThreadState(); | 573 ThreadState(); |
559 ~ThreadState(); | 574 ~ThreadState(); |
560 | 575 |
561 void enterSafePoint(StackState, void*); | 576 void enterSafePoint(StackState, void*); |
562 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); | 577 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); |
563 void clearSafePointScopeMarker() | 578 void clearSafePointScopeMarker() |
564 { | 579 { |
565 m_safePointStackCopy.clear(); | 580 m_safePointStackCopy.clear(); |
566 m_safePointScopeMarker = nullptr; | 581 m_safePointScopeMarker = nullptr; |
(...skipping 21 matching lines...) Expand all Loading... |
588 void cleanup(); | 603 void cleanup(); |
589 void cleanupPages(); | 604 void cleanupPages(); |
590 | 605 |
591 void unregisterPreFinalizerInternal(void*); | 606 void unregisterPreFinalizerInternal(void*); |
592 void invokePreFinalizers(Visitor&); | 607 void invokePreFinalizers(Visitor&); |
593 | 608 |
594 #if ENABLE(GC_PROFILING) | 609 #if ENABLE(GC_PROFILING) |
595 void snapshotFreeList(); | 610 void snapshotFreeList(); |
596 #endif | 611 #endif |
597 | 612 |
598 // By entering a gc-forbidden scope, conservative GCs will not | 613 template<typename U> friend class GarbageCollectedMixinConstructorMarker; |
599 // be allowed while handling an out-of-line allocation request. | |
600 // Intended used when constructing subclasses of GC mixins, where | |
601 // the object being constructed cannot be safely traced & marked | |
602 // fully should a GC be allowed while its subclasses are being | |
603 // constructed. | |
604 template<typename U, typename V> friend class AllocateObjectTrait; | |
605 void enterGCForbiddenScope() { m_gcForbiddenCount++; } | |
606 void leaveGCForbiddenScope() | 614 void leaveGCForbiddenScope() |
607 { | 615 { |
608 ASSERT(m_gcForbiddenCount > 0); | 616 ASSERT(m_gcForbiddenCount > 0); |
609 m_gcForbiddenCount--; | 617 m_gcForbiddenCount--; |
610 } | 618 } |
611 | 619 |
612 friend class SafePointAwareMutexLocker; | 620 friend class SafePointAwareMutexLocker; |
613 friend class SafePointBarrier; | 621 friend class SafePointBarrier; |
614 friend class SafePointScope; | 622 friend class SafePointScope; |
615 | 623 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 }; | 688 }; |
681 | 689 |
682 template<> class ThreadStateFor<AnyThread> { | 690 template<> class ThreadStateFor<AnyThread> { |
683 public: | 691 public: |
684 static ThreadState* state() { return ThreadState::current(); } | 692 static ThreadState* state() { return ThreadState::current(); } |
685 }; | 693 }; |
686 | 694 |
687 } // namespace blink | 695 } // namespace blink |
688 | 696 |
689 #endif // ThreadState_h | 697 #endif // ThreadState_h |
OLD | NEW |