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

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

Issue 2703713003: Remove SafePointBarrier (Closed)
Patch Set: temp Created 3 years, 10 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 class Isolate; 50 class Isolate;
51 }; 51 };
52 52
53 namespace blink { 53 namespace blink {
54 54
55 class BasePage; 55 class BasePage;
56 class GarbageCollectedMixinConstructorMarker; 56 class GarbageCollectedMixinConstructorMarker;
57 class PersistentNode; 57 class PersistentNode;
58 class PersistentRegion; 58 class PersistentRegion;
59 class BaseArena; 59 class BaseArena;
60 class SafePointBarrier;
61 class ThreadHeap; 60 class ThreadHeap;
62 class ThreadState; 61 class ThreadState;
63 class Visitor; 62 class Visitor;
64 63
65 // Declare that a class has a pre-finalizer. The pre-finalizer is called 64 // Declare that a class has a pre-finalizer. The pre-finalizer is called
66 // before any object gets swept, so it is safe to touch on-heap objects 65 // before any object gets swept, so it is safe to touch on-heap objects
67 // that may be collected in the same GC cycle. If you cannot avoid touching 66 // that may be collected in the same GC cycle. If you cannot avoid touching
68 // on-heap objects in a destructor (which is not allowed), you can consider 67 // on-heap objects in a destructor (which is not allowed), you can consider
69 // using the pre-finalizer. The only restriction is that the pre-finalizer 68 // using the pre-finalizer. The only restriction is that the pre-finalizer
70 // must not resurrect dead objects (e.g., store unmarked objects into 69 // must not resurrect dead objects (e.g., store unmarked objects into
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 // 320 //
322 // Check if GC is requested by another thread and pause this thread if this is 321 // Check if GC is requested by another thread and pause this thread if this is
323 // the case. Can only be called when current thread is in a consistent state. 322 // the case. Can only be called when current thread is in a consistent state.
324 void safePoint(BlinkGC::StackState); 323 void safePoint(BlinkGC::StackState);
325 324
326 // Mark current thread as running inside safepoint. 325 // Mark current thread as running inside safepoint.
327 void enterSafePoint(BlinkGC::StackState, void*); 326 void enterSafePoint(BlinkGC::StackState, void*);
328 void leaveSafePoint(); 327 void leaveSafePoint();
329 328
330 void recordStackEnd(intptr_t* endOfStack) { m_endOfStack = endOfStack; } 329 void recordStackEnd(intptr_t* endOfStack) { m_endOfStack = endOfStack; }
330 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope();
331 331
332 // Get one of the heap structures for this thread. 332 // Get one of the heap structures for this thread.
333 // The thread heap is split into multiple heap parts based on object types 333 // The thread heap is split into multiple heap parts based on object types
334 // and object sizes. 334 // and object sizes.
335 BaseArena* arena(int arenaIndex) const { 335 BaseArena* arena(int arenaIndex) const {
336 ASSERT(0 <= arenaIndex); 336 ASSERT(0 <= arenaIndex);
337 ASSERT(arenaIndex < BlinkGC::NumberOfArenas); 337 ASSERT(arenaIndex < BlinkGC::NumberOfArenas);
338 return m_arenas[arenaIndex]; 338 return m_arenas[arenaIndex];
339 } 339 }
340 340
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 530 }
531 531
532 private: 532 private:
533 template <typename T> 533 template <typename T>
534 friend class PrefinalizerRegistration; 534 friend class PrefinalizerRegistration;
535 enum SnapshotType { HeapSnapshot, FreelistSnapshot }; 535 enum SnapshotType { HeapSnapshot, FreelistSnapshot };
536 536
537 ThreadState(); 537 ThreadState();
538 ~ThreadState(); 538 ~ThreadState();
539 539
540 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope();
541 void clearSafePointScopeMarker() { 540 void clearSafePointScopeMarker() {
542 m_safePointStackCopy.clear(); 541 m_safePointStackCopy.clear();
543 m_safePointScopeMarker = nullptr; 542 m_safePointScopeMarker = nullptr;
544 } 543 }
545 544
546 // shouldSchedule{Precise,Idle}GC and shouldForceConservativeGC 545 // shouldSchedule{Precise,Idle}GC and shouldForceConservativeGC
547 // implement the heuristics that are used to determine when to collect 546 // implement the heuristics that are used to determine when to collect
548 // garbage. 547 // garbage.
549 // If shouldForceConservativeGC returns true, we force the garbage 548 // If shouldForceConservativeGC returns true, we force the garbage
550 // collection immediately. Otherwise, if should*GC returns true, we 549 // collection immediately. Otherwise, if should*GC returns true, we
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 593
595 void invokePreFinalizers(); 594 void invokePreFinalizers();
596 595
597 void takeSnapshot(SnapshotType); 596 void takeSnapshot(SnapshotType);
598 void clearArenaAges(); 597 void clearArenaAges();
599 int arenaIndexOfVectorArenaLeastRecentlyExpanded(int beginArenaIndex, 598 int arenaIndexOfVectorArenaLeastRecentlyExpanded(int beginArenaIndex,
600 int endArenaIndex); 599 int endArenaIndex);
601 600
602 void reportMemoryToV8(); 601 void reportMemoryToV8();
603 602
604 friend class SafePointBarrier;
605 friend class SafePointScope; 603 friend class SafePointScope;
606 604
607 static WTF::ThreadSpecific<ThreadState*>* s_threadSpecific; 605 static WTF::ThreadSpecific<ThreadState*>* s_threadSpecific;
608 606
609 // We can't create a static member of type ThreadState here 607 // We can't create a static member of type ThreadState here
610 // because it will introduce global constructor and destructor. 608 // because it will introduce global constructor and destructor.
611 // We would like to manage lifetime of the ThreadState attached 609 // We would like to manage lifetime of the ThreadState attached
612 // to the main thread explicitly instead and still use normal 610 // to the main thread explicitly instead and still use normal
613 // constructor and destructor for the ThreadState class. 611 // constructor and destructor for the ThreadState class.
614 // For this we reserve static storage for the main ThreadState 612 // For this we reserve static storage for the main ThreadState
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 class ThreadStateFor<AnyThread> { 700 class ThreadStateFor<AnyThread> {
703 STATIC_ONLY(ThreadStateFor); 701 STATIC_ONLY(ThreadStateFor);
704 702
705 public: 703 public:
706 static ThreadState* state() { return ThreadState::current(); } 704 static ThreadState* state() { return ThreadState::current(); }
707 }; 705 };
708 706
709 } // namespace blink 707 } // namespace blink
710 708
711 #endif // ThreadState_h 709 #endif // ThreadState_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/SafePoint.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