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

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

Issue 464253002: Revert of Revert "Revert of [oilpan]: Change marking to do precise roots first and conservative (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/heap/HeapTest.cpp ('k') | Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // Initialize threading infrastructure. Should be called from the main 238 // Initialize threading infrastructure. Should be called from the main
239 // thread. 239 // thread.
240 static void init(); 240 static void init();
241 static void shutdown(); 241 static void shutdown();
242 static void shutdownHeapIfNecessary(); 242 static void shutdownHeapIfNecessary();
243 bool isTerminating() { return m_isTerminating; } 243 bool isTerminating() { return m_isTerminating; }
244 244
245 static void attachMainThread(); 245 static void attachMainThread();
246 static void detachMainThread(); 246 static void detachMainThread();
247 247
248 // Trace all persistent roots, called when marking the managed heap objects. 248 // Trace all GC roots, called when marking the managed heap objects.
249 static void visitPersistentRoots(Visitor*); 249 static void visitRoots(Visitor*);
250
251 // Trace all objects found on the stack, used when doing conservative GCs.
252 static void visitStackRoots(Visitor*);
253 250
254 // Associate ThreadState object with the current thread. After this 251 // Associate ThreadState object with the current thread. After this
255 // call thread can start using the garbage collected heap infrastructure. 252 // call thread can start using the garbage collected heap infrastructure.
256 // It also has to periodically check for safepoints. 253 // It also has to periodically check for safepoints.
257 static void attach(); 254 static void attach();
258 255
259 // Disassociate attached ThreadState from the current thread. The thread 256 // Disassociate attached ThreadState from the current thread. The thread
260 // can no longer use the garbage collected heap after this call. 257 // can no longer use the garbage collected heap after this call.
261 static void detach(); 258 static void detach();
262 259
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 #endif 503 #endif
507 504
508 void pushWeakObjectPointerCallback(void*, WeakPointerCallback); 505 void pushWeakObjectPointerCallback(void*, WeakPointerCallback);
509 bool popAndInvokeWeakPointerCallback(Visitor*); 506 bool popAndInvokeWeakPointerCallback(Visitor*);
510 507
511 void getStats(HeapStats&); 508 void getStats(HeapStats&);
512 HeapStats& stats() { return m_stats; } 509 HeapStats& stats() { return m_stats; }
513 HeapStats& statsAfterLastGC() { return m_statsAfterLastGC; } 510 HeapStats& statsAfterLastGC() { return m_statsAfterLastGC; }
514 511
515 void setupHeapsForTermination(); 512 void setupHeapsForTermination();
513 void visitLocalRoots(Visitor*);
516 514
517 private: 515 private:
518 explicit ThreadState(); 516 explicit ThreadState();
519 ~ThreadState(); 517 ~ThreadState();
520 518
521 friend class SafePointBarrier; 519 friend class SafePointBarrier;
522 friend class SafePointAwareMutexLocker; 520 friend class SafePointAwareMutexLocker;
523 521
524 void enterSafePoint(StackState, void*); 522 void enterSafePoint(StackState, void*);
525 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); 523 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope();
(...skipping 30 matching lines...) Expand all
556 554
557 // We can't create a static member of type ThreadState here 555 // We can't create a static member of type ThreadState here
558 // because it will introduce global constructor and destructor. 556 // because it will introduce global constructor and destructor.
559 // We would like to manage lifetime of the ThreadState attached 557 // We would like to manage lifetime of the ThreadState attached
560 // to the main thread explicitly instead and still use normal 558 // to the main thread explicitly instead and still use normal
561 // constructor and destructor for the ThreadState class. 559 // constructor and destructor for the ThreadState class.
562 // For this we reserve static storage for the main ThreadState 560 // For this we reserve static storage for the main ThreadState
563 // and lazily construct ThreadState in it using placement new. 561 // and lazily construct ThreadState in it using placement new.
564 static uint8_t s_mainThreadStateStorage[]; 562 static uint8_t s_mainThreadStateStorage[];
565 563
564 void trace(Visitor*);
565
566 ThreadIdentifier m_thread; 566 ThreadIdentifier m_thread;
567 OwnPtr<PersistentNode> m_persistents; 567 OwnPtr<PersistentNode> m_persistents;
568 StackState m_stackState; 568 StackState m_stackState;
569 intptr_t* m_startOfStack; 569 intptr_t* m_startOfStack;
570 intptr_t* m_endOfStack; 570 intptr_t* m_endOfStack;
571 void* m_safePointScopeMarker; 571 void* m_safePointScopeMarker;
572 Vector<Address> m_safePointStackCopy; 572 Vector<Address> m_safePointStackCopy;
573 bool m_atSafePoint; 573 bool m_atSafePoint;
574 Vector<Interruptor*> m_interruptors; 574 Vector<Interruptor*> m_interruptors;
575 bool m_gcRequested; 575 bool m_gcRequested;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 // HeapPage header. We use some of the bits to determine 712 // HeapPage header. We use some of the bits to determine
713 // whether the page is part of a terminting thread or 713 // whether the page is part of a terminting thread or
714 // if the page is traced after being terminated (orphaned). 714 // if the page is traced after being terminated (orphaned).
715 uintptr_t m_terminating : 1; 715 uintptr_t m_terminating : 1;
716 uintptr_t m_tracedAfterOrphaned : 1; 716 uintptr_t m_tracedAfterOrphaned : 1;
717 }; 717 };
718 718
719 } 719 }
720 720
721 #endif // ThreadState_h 721 #endif // ThreadState_h
OLDNEW
« no previous file with comments | « Source/platform/heap/HeapTest.cpp ('k') | Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698