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

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

Issue 1166623002: Oilpan: Remove a visitor parameter from isHeapObjectAlive (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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/ThreadState.h ('k') | Source/platform/heap/TraceTraits.h » ('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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 897
898 { 898 {
899 if (isMainThread()) 899 if (isMainThread())
900 ScriptForbiddenScope::enter(); 900 ScriptForbiddenScope::enter();
901 901
902 SweepForbiddenScope forbiddenScope(this); 902 SweepForbiddenScope forbiddenScope(this);
903 { 903 {
904 // Disallow allocation during weak processing. 904 // Disallow allocation during weak processing.
905 NoAllocationScope noAllocationScope(this); 905 NoAllocationScope noAllocationScope(this);
906 { 906 {
907 // Perform thread-specific weak processing.
907 TRACE_EVENT0("blink_gc", "ThreadState::threadLocalWeakProcessing "); 908 TRACE_EVENT0("blink_gc", "ThreadState::threadLocalWeakProcessing ");
908 // Perform thread-specific weak processing. 909 // TODO(haraken): It is wrong to unconditionally use
910 // s_markingVisitor, which is for GlobalMarking.
911 // ThreadTerminationGC should use a visitor for
912 // ThreadLocalMarking. However, a better fix is just to remove
913 // the visitor parameter. The only user of the visitor parameter
914 // is HashTable::process.
909 while (popAndInvokeThreadLocalWeakCallback(Heap::s_markingVisito r)) { } 915 while (popAndInvokeThreadLocalWeakCallback(Heap::s_markingVisito r)) { }
910 } 916 }
911 { 917 {
912 TRACE_EVENT0("blink_gc", "ThreadState::invokePreFinalizers"); 918 TRACE_EVENT0("blink_gc", "ThreadState::invokePreFinalizers");
913 invokePreFinalizers(*Heap::s_markingVisitor); 919 invokePreFinalizers();
914 } 920 }
915 } 921 }
916 922
917 if (isMainThread()) 923 if (isMainThread())
918 ScriptForbiddenScope::exit(); 924 ScriptForbiddenScope::exit();
919 } 925 }
920 926
921 #if defined(ADDRESS_SANITIZER) 927 #if defined(ADDRESS_SANITIZER)
922 poisonEagerHeap(SetPoison); 928 poisonEagerHeap(SetPoison);
923 #endif 929 #endif
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 void ThreadState::unregisterPreFinalizerInternal(void* target) 1236 void ThreadState::unregisterPreFinalizerInternal(void* target)
1231 { 1237 {
1232 checkThread(); 1238 checkThread();
1233 if (sweepForbidden()) 1239 if (sweepForbidden())
1234 return; 1240 return;
1235 auto it = m_preFinalizers.find(target); 1241 auto it = m_preFinalizers.find(target);
1236 ASSERT(it != m_preFinalizers.end()); 1242 ASSERT(it != m_preFinalizers.end());
1237 m_preFinalizers.remove(it); 1243 m_preFinalizers.remove(it);
1238 } 1244 }
1239 1245
1240 void ThreadState::invokePreFinalizers(Visitor& visitor) 1246 void ThreadState::invokePreFinalizers()
1241 { 1247 {
1242 checkThread(); 1248 checkThread();
1243 Vector<void*> deadObjects; 1249 Vector<void*> deadObjects;
1244 for (auto& entry : m_preFinalizers) { 1250 for (auto& entry : m_preFinalizers) {
1245 if (entry.value(entry.key, visitor)) 1251 if (entry.value(entry.key))
1246 deadObjects.append(entry.key); 1252 deadObjects.append(entry.key);
1247 } 1253 }
1248 // FIXME: removeAll is inefficient. It can shrink repeatedly. 1254 // FIXME: removeAll is inefficient. It can shrink repeatedly.
1249 m_preFinalizers.removeAll(deadObjects); 1255 m_preFinalizers.removeAll(deadObjects);
1250 } 1256 }
1251 1257
1252 void ThreadState::clearHeapAges() 1258 void ThreadState::clearHeapAges()
1253 { 1259 {
1254 memset(m_heapAges, 0, sizeof(size_t) * NumberOfHeaps); 1260 memset(m_heapAges, 0, sizeof(size_t) * NumberOfHeaps);
1255 memset(m_likelyToBePromptlyFreed.get(), 0, sizeof(int) * likelyToBePromptlyF reedArraySize); 1261 memset(m_likelyToBePromptlyFreed.get(), 0, sizeof(int) * likelyToBePromptlyF reedArraySize);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 json->beginArray(it->key.ascii().data()); 1383 json->beginArray(it->key.ascii().data());
1378 for (size_t age = 0; age <= maxHeapObjectAge; ++age) 1384 for (size_t age = 0; age <= maxHeapObjectAge; ++age)
1379 json->pushInteger(it->value.ages[age]); 1385 json->pushInteger(it->value.ages[age]);
1380 json->endArray(); 1386 json->endArray();
1381 } 1387 }
1382 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release()); 1388 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release());
1383 } 1389 }
1384 #endif 1390 #endif
1385 1391
1386 } // namespace blink 1392 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/heap/ThreadState.h ('k') | Source/platform/heap/TraceTraits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698