| OLD | NEW |
| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 gc_mixin_marker_(nullptr), | 116 gc_mixin_marker_(nullptr), |
| 117 should_flush_heap_does_not_contain_cache_(false), | 117 should_flush_heap_does_not_contain_cache_(false), |
| 118 gc_state_(kNoGCScheduled), | 118 gc_state_(kNoGCScheduled), |
| 119 isolate_(nullptr), | 119 isolate_(nullptr), |
| 120 trace_dom_wrappers_(nullptr), | 120 trace_dom_wrappers_(nullptr), |
| 121 invalidate_dead_objects_in_wrappers_marking_deque_(nullptr), | 121 invalidate_dead_objects_in_wrappers_marking_deque_(nullptr), |
| 122 #if defined(ADDRESS_SANITIZER) | 122 #if defined(ADDRESS_SANITIZER) |
| 123 asan_fake_stack_(__asan_get_current_fake_stack()), | 123 asan_fake_stack_(__asan_get_current_fake_stack()), |
| 124 #endif | 124 #endif |
| 125 #if defined(LEAK_SANITIZER) | 125 #if defined(LEAK_SANITIZER) |
| 126 m_disabledStaticPersistentsRegistration(0), | 126 disabled_static_persistent_registration_(0), |
| 127 #endif | 127 #endif |
| 128 allocated_object_size_(0), | 128 allocated_object_size_(0), |
| 129 marked_object_size_(0), | 129 marked_object_size_(0), |
| 130 reported_memory_to_v8_(0) { | 130 reported_memory_to_v8_(0) { |
| 131 DCHECK(CheckThread()); | 131 DCHECK(CheckThread()); |
| 132 DCHECK(!**thread_specific_); | 132 DCHECK(!**thread_specific_); |
| 133 **thread_specific_ = this; | 133 **thread_specific_ = this; |
| 134 | 134 |
| 135 heap_ = WTF::WrapUnique(new ThreadHeap(this)); | 135 heap_ = WTF::WrapUnique(new ThreadHeap(this)); |
| 136 | 136 |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 safe_point_stack_copy_.resize(slot_count); | 1215 safe_point_stack_copy_.resize(slot_count); |
| 1216 for (size_t i = 0; i < slot_count; ++i) { | 1216 for (size_t i = 0; i < slot_count; ++i) { |
| 1217 safe_point_stack_copy_[i] = from[i]; | 1217 safe_point_stack_copy_[i] = from[i]; |
| 1218 } | 1218 } |
| 1219 } | 1219 } |
| 1220 | 1220 |
| 1221 void ThreadState::RegisterStaticPersistentNode( | 1221 void ThreadState::RegisterStaticPersistentNode( |
| 1222 PersistentNode* node, | 1222 PersistentNode* node, |
| 1223 PersistentClearCallback callback) { | 1223 PersistentClearCallback callback) { |
| 1224 #if defined(LEAK_SANITIZER) | 1224 #if defined(LEAK_SANITIZER) |
| 1225 if (m_disabledStaticPersistentsRegistration) | 1225 if (disabled_static_persistent_registration_) |
| 1226 return; | 1226 return; |
| 1227 #endif | 1227 #endif |
| 1228 | 1228 |
| 1229 DCHECK(!static_persistents_.Contains(node)); | 1229 DCHECK(!static_persistents_.Contains(node)); |
| 1230 static_persistents_.insert(node, callback); | 1230 static_persistents_.insert(node, callback); |
| 1231 } | 1231 } |
| 1232 | 1232 |
| 1233 void ThreadState::ReleaseStaticPersistentNodes() { | 1233 void ThreadState::ReleaseStaticPersistentNodes() { |
| 1234 HashMap<PersistentNode*, ThreadState::PersistentClearCallback> | 1234 HashMap<PersistentNode*, ThreadState::PersistentClearCallback> |
| 1235 static_persistents; | 1235 static_persistents; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1246 // Do not allow static persistents to be freed before | 1246 // Do not allow static persistents to be freed before |
| 1247 // they're all released in releaseStaticPersistentNodes(). | 1247 // they're all released in releaseStaticPersistentNodes(). |
| 1248 // | 1248 // |
| 1249 // There's no fundamental reason why this couldn't be supported, | 1249 // There's no fundamental reason why this couldn't be supported, |
| 1250 // but no known use for it. | 1250 // but no known use for it. |
| 1251 DCHECK(!static_persistents_.Contains(persistent_node)); | 1251 DCHECK(!static_persistents_.Contains(persistent_node)); |
| 1252 } | 1252 } |
| 1253 | 1253 |
| 1254 #if defined(LEAK_SANITIZER) | 1254 #if defined(LEAK_SANITIZER) |
| 1255 void ThreadState::enterStaticReferenceRegistrationDisabledScope() { | 1255 void ThreadState::enterStaticReferenceRegistrationDisabledScope() { |
| 1256 m_disabledStaticPersistentsRegistration++; | 1256 disabled_static_persistent_registration_++; |
| 1257 } | 1257 } |
| 1258 | 1258 |
| 1259 void ThreadState::leaveStaticReferenceRegistrationDisabledScope() { | 1259 void ThreadState::leaveStaticReferenceRegistrationDisabledScope() { |
| 1260 DCHECK(m_disabledStaticPersistentsRegistration); | 1260 DCHECK(disabled_static_persistent_registration_); |
| 1261 m_disabledStaticPersistentsRegistration--; | 1261 disabled_static_persistent_registration_--; |
| 1262 } | 1262 } |
| 1263 #endif | 1263 #endif |
| 1264 | 1264 |
| 1265 void ThreadState::InvokePreFinalizers() { | 1265 void ThreadState::InvokePreFinalizers() { |
| 1266 DCHECK(CheckThread()); | 1266 DCHECK(CheckThread()); |
| 1267 DCHECK(!SweepForbidden()); | 1267 DCHECK(!SweepForbidden()); |
| 1268 TRACE_EVENT0("blink_gc", "ThreadState::invokePreFinalizers"); | 1268 TRACE_EVENT0("blink_gc", "ThreadState::invokePreFinalizers"); |
| 1269 | 1269 |
| 1270 SweepForbiddenScope sweep_forbidden(this); | 1270 SweepForbiddenScope sweep_forbidden(this); |
| 1271 ScriptForbiddenIfMainThreadScope script_forbidden; | 1271 ScriptForbiddenIfMainThreadScope script_forbidden; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 CollectGarbage(BlinkGC::kNoHeapPointersOnStack, BlinkGC::kGCWithSweep, | 1559 CollectGarbage(BlinkGC::kNoHeapPointersOnStack, BlinkGC::kGCWithSweep, |
| 1560 BlinkGC::kForcedGC); | 1560 BlinkGC::kForcedGC); |
| 1561 size_t live_objects = Heap().HeapStats().MarkedObjectSize(); | 1561 size_t live_objects = Heap().HeapStats().MarkedObjectSize(); |
| 1562 if (live_objects == previous_live_objects) | 1562 if (live_objects == previous_live_objects) |
| 1563 break; | 1563 break; |
| 1564 previous_live_objects = live_objects; | 1564 previous_live_objects = live_objects; |
| 1565 } | 1565 } |
| 1566 } | 1566 } |
| 1567 | 1567 |
| 1568 } // namespace blink | 1568 } // namespace blink |
| OLD | NEW |