Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: third_party/WebKit/Source/platform/heap/ThreadState.h

Issue 1910753002: Add enablePerThreadHeap flag to ThreadState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 ASSERT(m_state->m_sweepForbidden); 166 ASSERT(m_state->m_sweepForbidden);
167 m_state->m_sweepForbidden = false; 167 m_state->m_sweepForbidden = false;
168 } 168 }
169 private: 169 private:
170 ThreadState* m_state; 170 ThreadState* m_state;
171 }; 171 };
172 172
173 void lockThreadAttachMutex(); 173 void lockThreadAttachMutex();
174 void unlockThreadAttachMutex(); 174 void unlockThreadAttachMutex();
175 175
176 bool perThreadHeapEnabled() const { return m_perThreadHeapEnabled; }
177
176 bool isTerminating() { return m_isTerminating; } 178 bool isTerminating() { return m_isTerminating; }
177 179
178 static void attachMainThread(); 180 static void attachMainThread();
179 static void detachMainThread(); 181 static void detachMainThread();
180 void cleanupMainThread(); 182 void cleanupMainThread();
181 183
182 // Associate ThreadState object with the current thread. After this 184 // Associate ThreadState object with the current thread. After this
183 // call thread can start using the garbage collected heap infrastructure. 185 // call thread can start using the garbage collected heap infrastructure.
184 // It also has to periodically check for safepoints. 186 // It also has to periodically check for safepoints.
185 static void attachCurrentThread(); 187 static void attachCurrentThread(bool perThreadHeapEnabled);
186 188
187 // Disassociate attached ThreadState from the current thread. The thread 189 // Disassociate attached ThreadState from the current thread. The thread
188 // can no longer use the garbage collected heap after this call. 190 // can no longer use the garbage collected heap after this call.
189 static void detachCurrentThread(); 191 static void detachCurrentThread();
190 192
191 static ThreadState* current() 193 static ThreadState* current()
192 { 194 {
193 #if defined(__GLIBC__) || OS(ANDROID) || OS(FREEBSD) 195 #if defined(__GLIBC__) || OS(ANDROID) || OS(FREEBSD)
194 // TLS lookup is fast in these platforms. 196 // TLS lookup is fast in these platforms.
195 return **s_threadSpecific; 197 return **s_threadSpecific;
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 void increaseMarkedObjectSize(size_t); 522 void increaseMarkedObjectSize(size_t);
521 523
522 void callThreadShutdownHooks(); 524 void callThreadShutdownHooks();
523 525
524 private: 526 private:
525 enum SnapshotType { 527 enum SnapshotType {
526 HeapSnapshot, 528 HeapSnapshot,
527 FreelistSnapshot 529 FreelistSnapshot
528 }; 530 };
529 531
530 ThreadState(); 532 ThreadState(bool perThreadHeapEnabled);
531 ~ThreadState(); 533 ~ThreadState();
532 534
533 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); 535 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope();
534 void clearSafePointScopeMarker() 536 void clearSafePointScopeMarker()
535 { 537 {
536 m_safePointStackCopy.clear(); 538 m_safePointStackCopy.clear();
537 m_safePointScopeMarker = nullptr; 539 m_safePointScopeMarker = nullptr;
538 } 540 }
539 541
540 // shouldSchedule{Precise,Idle}GC and shouldForceConservativeGC 542 // shouldSchedule{Precise,Idle}GC and shouldForceConservativeGC
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 bool m_sweepForbidden; 632 bool m_sweepForbidden;
631 size_t m_noAllocationCount; 633 size_t m_noAllocationCount;
632 size_t m_gcForbiddenCount; 634 size_t m_gcForbiddenCount;
633 double m_accumulatedSweepingTime; 635 double m_accumulatedSweepingTime;
634 636
635 BaseArena* m_arenas[BlinkGC::NumberOfArenas]; 637 BaseArena* m_arenas[BlinkGC::NumberOfArenas];
636 int m_vectorBackingArenaIndex; 638 int m_vectorBackingArenaIndex;
637 size_t m_arenaAges[BlinkGC::NumberOfArenas]; 639 size_t m_arenaAges[BlinkGC::NumberOfArenas];
638 size_t m_currentArenaAges; 640 size_t m_currentArenaAges;
639 641
642 bool m_perThreadHeapEnabled;
640 bool m_isTerminating; 643 bool m_isTerminating;
641 GarbageCollectedMixinConstructorMarker* m_gcMixinMarker; 644 GarbageCollectedMixinConstructorMarker* m_gcMixinMarker;
642 645
643 bool m_shouldFlushHeapDoesNotContainCache; 646 bool m_shouldFlushHeapDoesNotContainCache;
644 GCState m_gcState; 647 GCState m_gcState;
645 648
646 CallbackStack* m_threadLocalWeakCallbackStack; 649 CallbackStack* m_threadLocalWeakCallbackStack;
647 650
648 // Pre-finalizers are called in the reverse order in which they are 651 // Pre-finalizers are called in the reverse order in which they are
649 // registered by the constructors (including constructors of Mixin objects) 652 // registered by the constructors (including constructors of Mixin objects)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 702
700 template<> class ThreadStateFor<AnyThread> { 703 template<> class ThreadStateFor<AnyThread> {
701 STATIC_ONLY(ThreadStateFor); 704 STATIC_ONLY(ThreadStateFor);
702 public: 705 public:
703 static ThreadState* state() { return ThreadState::current(); } 706 static ThreadState* state() { return ThreadState::current(); }
704 }; 707 };
705 708
706 } // namespace blink 709 } // namespace blink
707 710
708 #endif // ThreadState_h 711 #endif // ThreadState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698