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

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

Issue 1021393004: Completely clear the heap ages array. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 | « no previous file | no next file » | 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 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 for (auto& entry : m_preFinalizers) { 1099 for (auto& entry : m_preFinalizers) {
1100 if (entry.value(entry.key, visitor)) 1100 if (entry.value(entry.key, visitor))
1101 deadObjects.append(entry.key); 1101 deadObjects.append(entry.key);
1102 } 1102 }
1103 // FIXME: removeAll is inefficient. It can shrink repeatedly. 1103 // FIXME: removeAll is inefficient. It can shrink repeatedly.
1104 m_preFinalizers.removeAll(deadObjects); 1104 m_preFinalizers.removeAll(deadObjects);
1105 } 1105 }
1106 1106
1107 void ThreadState::clearHeapAges() 1107 void ThreadState::clearHeapAges()
1108 { 1108 {
1109 memset(m_heapAges, 0, sizeof(int) * NumberOfHeaps); 1109 memset(m_heapAges, 0, sizeof(size_t) * NumberOfHeaps);
1110 memset(m_likelyToBePromptlyFreed.get(), 0, sizeof(int) * likelyToBePromptlyF reedArraySize); 1110 memset(m_likelyToBePromptlyFreed.get(), 0, sizeof(int) * likelyToBePromptlyF reedArraySize);
1111 m_currentHeapAges = 0; 1111 m_currentHeapAges = 0;
1112 } 1112 }
1113 1113
1114 int ThreadState::heapIndexOfVectorHeapLeastRecentlyExpanded(int beginHeapIndex, int endHeapIndex) 1114 int ThreadState::heapIndexOfVectorHeapLeastRecentlyExpanded(int beginHeapIndex, int endHeapIndex)
1115 { 1115 {
1116 size_t minHeapAge = m_heapAges[beginHeapIndex]; 1116 size_t minHeapAge = m_heapAges[beginHeapIndex];
1117 int heapIndexWithMinHeapAge = beginHeapIndex; 1117 int heapIndexWithMinHeapAge = beginHeapIndex;
1118 for (int heapIndex = beginHeapIndex + 1; heapIndex <= endHeapIndex; heapInde x++) { 1118 for (int heapIndex = beginHeapIndex + 1; heapIndex <= endHeapIndex; heapInde x++) {
1119 if (m_heapAges[heapIndex] < minHeapAge) { 1119 if (m_heapAges[heapIndex] < minHeapAge) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 json->beginArray(it->key.ascii().data()); 1232 json->beginArray(it->key.ascii().data());
1233 for (size_t age = 0; age <= maxHeapObjectAge; ++age) 1233 for (size_t age = 0; age <= maxHeapObjectAge; ++age)
1234 json->pushInteger(it->value.ages[age]); 1234 json->pushInteger(it->value.ages[age]);
1235 json->endArray(); 1235 json->endArray();
1236 } 1236 }
1237 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release()); 1237 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release());
1238 } 1238 }
1239 #endif 1239 #endif
1240 1240
1241 } // namespace blink 1241 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698