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

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: rebased Created 4 years, 7 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 void increaseMarkedObjectSize(size_t); 521 void increaseMarkedObjectSize(size_t);
520 522
521 void callThreadShutdownHooks(); 523 void callThreadShutdownHooks();
522 524
523 private: 525 private:
524 enum SnapshotType { 526 enum SnapshotType {
525 HeapSnapshot, 527 HeapSnapshot,
526 FreelistSnapshot 528 FreelistSnapshot
527 }; 529 };
528 530
529 ThreadState(); 531 ThreadState(bool perThreadHeapEnabled);
530 ~ThreadState(); 532 ~ThreadState();
531 533
532 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); 534 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope();
533 void clearSafePointScopeMarker() 535 void clearSafePointScopeMarker()
534 { 536 {
535 m_safePointStackCopy.clear(); 537 m_safePointStackCopy.clear();
536 m_safePointScopeMarker = nullptr; 538 m_safePointScopeMarker = nullptr;
537 } 539 }
538 540
539 // shouldSchedule{Precise,Idle}GC and shouldForceConservativeGC 541 // shouldSchedule{Precise,Idle}GC and shouldForceConservativeGC
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 bool m_sweepForbidden; 631 bool m_sweepForbidden;
630 size_t m_noAllocationCount; 632 size_t m_noAllocationCount;
631 size_t m_gcForbiddenCount; 633 size_t m_gcForbiddenCount;
632 double m_accumulatedSweepingTime; 634 double m_accumulatedSweepingTime;
633 635
634 BaseArena* m_arenas[BlinkGC::NumberOfArenas]; 636 BaseArena* m_arenas[BlinkGC::NumberOfArenas];
635 int m_vectorBackingArenaIndex; 637 int m_vectorBackingArenaIndex;
636 size_t m_arenaAges[BlinkGC::NumberOfArenas]; 638 size_t m_arenaAges[BlinkGC::NumberOfArenas];
637 size_t m_currentArenaAges; 639 size_t m_currentArenaAges;
638 640
641 bool m_perThreadHeapEnabled;
639 bool m_isTerminating; 642 bool m_isTerminating;
640 GarbageCollectedMixinConstructorMarker* m_gcMixinMarker; 643 GarbageCollectedMixinConstructorMarker* m_gcMixinMarker;
641 644
642 bool m_shouldFlushHeapDoesNotContainCache; 645 bool m_shouldFlushHeapDoesNotContainCache;
643 GCState m_gcState; 646 GCState m_gcState;
644 647
645 CallbackStack* m_threadLocalWeakCallbackStack; 648 CallbackStack* m_threadLocalWeakCallbackStack;
646 649
647 // Pre-finalizers are called in the reverse order in which they are 650 // Pre-finalizers are called in the reverse order in which they are
648 // registered by the constructors (including constructors of Mixin objects) 651 // registered by the constructors (including constructors of Mixin objects)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 699
697 template<> class ThreadStateFor<AnyThread> { 700 template<> class ThreadStateFor<AnyThread> {
698 STATIC_ONLY(ThreadStateFor); 701 STATIC_ONLY(ThreadStateFor);
699 public: 702 public:
700 static ThreadState* state() { return ThreadState::current(); } 703 static ThreadState* state() { return ThreadState::current(); }
701 }; 704 };
702 705
703 } // namespace blink 706 } // namespace blink
704 707
705 #endif // ThreadState_h 708 #endif // ThreadState_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapTest.cpp ('k') | third_party/WebKit/Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698