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

Side by Side Diff: src/debug/debug.cc

Issue 2310143002: [heap] Introduce enum of garbage collection reasons. (Closed)
Patch Set: rebase Created 4 years, 3 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
« no previous file with comments | « src/api.cc ('k') | src/extensions/statistics-extension.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/debug/debug.h" 5 #include "src/debug/debug.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 // for which no JSFunction exists. 1275 // for which no JSFunction exists.
1276 { 1276 {
1277 SharedFunctionInfo::Iterator iterator(isolate_); 1277 SharedFunctionInfo::Iterator iterator(isolate_);
1278 while (SharedFunctionInfo* shared = iterator.Next()) { 1278 while (SharedFunctionInfo* shared = iterator.Next()) {
1279 shared->ClearCodeFromOptimizedCodeMap(); 1279 shared->ClearCodeFromOptimizedCodeMap();
1280 } 1280 }
1281 } 1281 }
1282 1282
1283 // Make sure we abort incremental marking. 1283 // Make sure we abort incremental marking.
1284 isolate_->heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask, 1284 isolate_->heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask,
1285 "prepare for break points"); 1285 GarbageCollectionReason::kDebugger);
1286 1286
1287 DCHECK(shared->is_compiled()); 1287 DCHECK(shared->is_compiled());
1288 bool baseline_exists = shared->HasBaselineCode(); 1288 bool baseline_exists = shared->HasBaselineCode();
1289 1289
1290 { 1290 {
1291 // TODO(yangguo): with bytecode, we still walk the heap to find all 1291 // TODO(yangguo): with bytecode, we still walk the heap to find all
1292 // optimized code for the function to deoptimize. We can probably be 1292 // optimized code for the function to deoptimize. We can probably be
1293 // smarter here and avoid the heap walk. 1293 // smarter here and avoid the heap walk.
1294 HeapIterator iterator(isolate_->heap()); 1294 HeapIterator iterator(isolate_->heap());
1295 HeapObject* obj; 1295 HeapObject* obj;
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 1592
1593 1593
1594 void Debug::ClearMirrorCache() { 1594 void Debug::ClearMirrorCache() {
1595 PostponeInterruptsScope postpone(isolate_); 1595 PostponeInterruptsScope postpone(isolate_);
1596 HandleScope scope(isolate_); 1596 HandleScope scope(isolate_);
1597 CallFunction("ClearMirrorCache", 0, NULL); 1597 CallFunction("ClearMirrorCache", 0, NULL);
1598 } 1598 }
1599 1599
1600 1600
1601 Handle<FixedArray> Debug::GetLoadedScripts() { 1601 Handle<FixedArray> Debug::GetLoadedScripts() {
1602 isolate_->heap()->CollectAllGarbage(); 1602 isolate_->heap()->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask,
1603 GarbageCollectionReason::kDebugger);
1603 Factory* factory = isolate_->factory(); 1604 Factory* factory = isolate_->factory();
1604 if (!factory->script_list()->IsWeakFixedArray()) { 1605 if (!factory->script_list()->IsWeakFixedArray()) {
1605 return factory->empty_fixed_array(); 1606 return factory->empty_fixed_array();
1606 } 1607 }
1607 Handle<WeakFixedArray> array = 1608 Handle<WeakFixedArray> array =
1608 Handle<WeakFixedArray>::cast(factory->script_list()); 1609 Handle<WeakFixedArray>::cast(factory->script_list());
1609 Handle<FixedArray> results = factory->NewFixedArray(array->Length()); 1610 Handle<FixedArray> results = factory->NewFixedArray(array->Length());
1610 int length = 0; 1611 int length = 0;
1611 { 1612 {
1612 Script::Iterator iterator(isolate_); 1613 Script::Iterator iterator(isolate_);
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
2566 } 2567 }
2567 2568
2568 2569
2569 void LockingCommandMessageQueue::Clear() { 2570 void LockingCommandMessageQueue::Clear() {
2570 base::LockGuard<base::Mutex> lock_guard(&mutex_); 2571 base::LockGuard<base::Mutex> lock_guard(&mutex_);
2571 queue_.Clear(); 2572 queue_.Clear();
2572 } 2573 }
2573 2574
2574 } // namespace internal 2575 } // namespace internal
2575 } // namespace v8 2576 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/extensions/statistics-extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698