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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 ASSERT(checkThread()); | 411 ASSERT(checkThread()); |
412 // Ignore pre-finalizers called during pre-finalizers or destructors. | 412 // Ignore pre-finalizers called during pre-finalizers or destructors. |
413 if (sweepForbidden()) | 413 if (sweepForbidden()) |
414 return; | 414 return; |
415 ASSERT(m_orderedPreFinalizers.contains(PreFinalizer(self, T::invokePreFi
nalizer))); | 415 ASSERT(m_orderedPreFinalizers.contains(PreFinalizer(self, T::invokePreFi
nalizer))); |
416 m_orderedPreFinalizers.remove(PreFinalizer(self, &T::invokePreFinalizer)
); | 416 m_orderedPreFinalizers.remove(PreFinalizer(self, &T::invokePreFinalizer)
); |
417 } | 417 } |
418 | 418 |
419 void shouldFlushHeapDoesNotContainCache() { m_shouldFlushHeapDoesNotContainC
ache = true; } | 419 void shouldFlushHeapDoesNotContainCache() { m_shouldFlushHeapDoesNotContainC
ache = true; } |
420 | 420 |
421 void registerTraceDOMWrappers(v8::Isolate* isolate, void (*traceDOMWrappers)
(v8::Isolate*, Visitor*)) | 421 void registerTraceDOMWrappers(v8::Isolate* isolate, |
| 422 void (*traceDOMWrappers)(v8::Isolate*, Visitor*), |
| 423 void (*invalidateDeadObjectsInWrappersMarkingDeque)(v8::Isolate*)) |
422 { | 424 { |
423 m_isolate = isolate; | 425 m_isolate = isolate; |
424 m_traceDOMWrappers = traceDOMWrappers; | 426 m_traceDOMWrappers = traceDOMWrappers; |
| 427 m_invalidateDeadObjectsInWrappersMarkingDeque = invalidateDeadObjectsInW
rappersMarkingDeque; |
425 } | 428 } |
426 | 429 |
427 // By entering a gc-forbidden scope, conservative GCs will not | 430 // By entering a gc-forbidden scope, conservative GCs will not |
428 // be allowed while handling an out-of-line allocation request. | 431 // be allowed while handling an out-of-line allocation request. |
429 // Intended used when constructing subclasses of GC mixins, where | 432 // Intended used when constructing subclasses of GC mixins, where |
430 // the object being constructed cannot be safely traced & marked | 433 // the object being constructed cannot be safely traced & marked |
431 // fully should a GC be allowed while its subclasses are being | 434 // fully should a GC be allowed while its subclasses are being |
432 // constructed. | 435 // constructed. |
433 void enterGCForbiddenScopeIfNeeded(GarbageCollectedMixinConstructorMarker* g
cMixinMarker) | 436 void enterGCForbiddenScopeIfNeeded(GarbageCollectedMixinConstructorMarker* g
cMixinMarker) |
434 { | 437 { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 | 520 |
518 void resetHeapCounters(); | 521 void resetHeapCounters(); |
519 void increaseAllocatedObjectSize(size_t); | 522 void increaseAllocatedObjectSize(size_t); |
520 void decreaseAllocatedObjectSize(size_t); | 523 void decreaseAllocatedObjectSize(size_t); |
521 void increaseMarkedObjectSize(size_t); | 524 void increaseMarkedObjectSize(size_t); |
522 | 525 |
523 void callThreadShutdownHooks(); | 526 void callThreadShutdownHooks(); |
524 | 527 |
525 v8::Isolate* isolate() const { return m_isolate; } | 528 v8::Isolate* isolate() const { return m_isolate; } |
526 | 529 |
| 530 void invalidateDeadObjectsInWrappersMarkingDeque() |
| 531 { |
| 532 if (m_invalidateDeadObjectsInWrappersMarkingDeque) { |
| 533 m_invalidateDeadObjectsInWrappersMarkingDeque(m_isolate); |
| 534 } |
| 535 } |
| 536 |
527 private: | 537 private: |
528 enum SnapshotType { | 538 enum SnapshotType { |
529 HeapSnapshot, | 539 HeapSnapshot, |
530 FreelistSnapshot | 540 FreelistSnapshot |
531 }; | 541 }; |
532 | 542 |
533 ThreadState(bool perThreadHeapEnabled); | 543 ThreadState(bool perThreadHeapEnabled); |
534 ~ThreadState(); | 544 ~ThreadState(); |
535 | 545 |
536 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); | 546 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 | 659 |
650 CallbackStack* m_threadLocalWeakCallbackStack; | 660 CallbackStack* m_threadLocalWeakCallbackStack; |
651 | 661 |
652 // Pre-finalizers are called in the reverse order in which they are | 662 // Pre-finalizers are called in the reverse order in which they are |
653 // registered by the constructors (including constructors of Mixin objects) | 663 // registered by the constructors (including constructors of Mixin objects) |
654 // for an object, by processing the m_orderedPreFinalizers back-to-front. | 664 // for an object, by processing the m_orderedPreFinalizers back-to-front. |
655 ListHashSet<PreFinalizer> m_orderedPreFinalizers; | 665 ListHashSet<PreFinalizer> m_orderedPreFinalizers; |
656 | 666 |
657 v8::Isolate* m_isolate; | 667 v8::Isolate* m_isolate; |
658 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); | 668 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); |
| 669 void (*m_invalidateDeadObjectsInWrappersMarkingDeque)(v8::Isolate*); |
659 | 670 |
660 #if defined(ADDRESS_SANITIZER) | 671 #if defined(ADDRESS_SANITIZER) |
661 void* m_asanFakeStack; | 672 void* m_asanFakeStack; |
662 #endif | 673 #endif |
663 | 674 |
664 // PersistentNodes that are stored in static references; | 675 // PersistentNodes that are stored in static references; |
665 // references that either have to be cleared upon the thread | 676 // references that either have to be cleared upon the thread |
666 // detaching from Oilpan and shutting down or references we | 677 // detaching from Oilpan and shutting down or references we |
667 // have to clear before initiating LSan's leak detection. | 678 // have to clear before initiating LSan's leak detection. |
668 HashMap<PersistentNode*, PersistentClearCallback> m_staticPersistents; | 679 HashMap<PersistentNode*, PersistentClearCallback> m_staticPersistents; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 | 712 |
702 template<> class ThreadStateFor<AnyThread> { | 713 template<> class ThreadStateFor<AnyThread> { |
703 STATIC_ONLY(ThreadStateFor); | 714 STATIC_ONLY(ThreadStateFor); |
704 public: | 715 public: |
705 static ThreadState* state() { return ThreadState::current(); } | 716 static ThreadState* state() { return ThreadState::current(); } |
706 }; | 717 }; |
707 | 718 |
708 } // namespace blink | 719 } // namespace blink |
709 | 720 |
710 #endif // ThreadState_h | 721 #endif // ThreadState_h |
OLD | NEW |