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

Side by Side Diff: src/global-handles.cc

Issue 11365146: Add GCTracer metrics for a scavenger GC for DOM wrappers (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Comments addressed Created 8 years 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/global-handles.h ('k') | src/heap.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 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 // group to NULL so it won't be processed again. 590 // group to NULL so it won't be processed again.
591 entry->Dispose(); 591 entry->Dispose();
592 object_groups_.at(i) = NULL; 592 object_groups_.at(i) = NULL;
593 } 593 }
594 object_groups_.Rewind(last); 594 object_groups_.Rewind(last);
595 return any_group_was_visited; 595 return any_group_was_visited;
596 } 596 }
597 597
598 598
599 bool GlobalHandles::PostGarbageCollectionProcessing( 599 bool GlobalHandles::PostGarbageCollectionProcessing(
600 GarbageCollector collector) { 600 GarbageCollector collector, GCTracer* tracer) {
601 // Process weak global handle callbacks. This must be done after the 601 // Process weak global handle callbacks. This must be done after the
602 // GC is completely done, because the callbacks may invoke arbitrary 602 // GC is completely done, because the callbacks may invoke arbitrary
603 // API functions. 603 // API functions.
604 ASSERT(isolate_->heap()->gc_state() == Heap::NOT_IN_GC); 604 ASSERT(isolate_->heap()->gc_state() == Heap::NOT_IN_GC);
605 const int initial_post_gc_processing_count = ++post_gc_processing_count_; 605 const int initial_post_gc_processing_count = ++post_gc_processing_count_;
606 bool next_gc_likely_to_collect_more = false; 606 bool next_gc_likely_to_collect_more = false;
607 if (collector == SCAVENGER) { 607 if (collector == SCAVENGER) {
608 for (int i = 0; i < new_space_nodes_.length(); ++i) { 608 for (int i = 0; i < new_space_nodes_.length(); ++i) {
609 Node* node = new_space_nodes_[i]; 609 Node* node = new_space_nodes_[i];
610 ASSERT(node->is_in_new_space_list()); 610 ASSERT(node->is_in_new_space_list());
(...skipping 29 matching lines...) Expand all
640 if (!it.node()->IsRetainer()) { 640 if (!it.node()->IsRetainer()) {
641 next_gc_likely_to_collect_more = true; 641 next_gc_likely_to_collect_more = true;
642 } 642 }
643 } 643 }
644 } 644 }
645 // Update the list of new space nodes. 645 // Update the list of new space nodes.
646 int last = 0; 646 int last = 0;
647 for (int i = 0; i < new_space_nodes_.length(); ++i) { 647 for (int i = 0; i < new_space_nodes_.length(); ++i) {
648 Node* node = new_space_nodes_[i]; 648 Node* node = new_space_nodes_[i];
649 ASSERT(node->is_in_new_space_list()); 649 ASSERT(node->is_in_new_space_list());
650 if (node->IsRetainer() && isolate_->heap()->InNewSpace(node->object())) { 650 if (node->IsRetainer()) {
651 new_space_nodes_[last++] = node; 651 if (isolate_->heap()->InNewSpace(node->object())) {
652 new_space_nodes_[last++] = node;
653 tracer->increment_nodes_copied_in_new_space();
654 } else {
655 node->set_in_new_space_list(false);
656 tracer->increment_nodes_promoted();
657 }
652 } else { 658 } else {
653 node->set_in_new_space_list(false); 659 node->set_in_new_space_list(false);
660 tracer->increment_nodes_died_in_new_space();
654 } 661 }
655 } 662 }
656 new_space_nodes_.Rewind(last); 663 new_space_nodes_.Rewind(last);
657 return next_gc_likely_to_collect_more; 664 return next_gc_likely_to_collect_more;
658 } 665 }
659 666
660 667
661 void GlobalHandles::IterateStrongRoots(ObjectVisitor* v) { 668 void GlobalHandles::IterateStrongRoots(ObjectVisitor* v) {
662 for (NodeIterator it(this); !it.done(); it.Advance()) { 669 for (NodeIterator it(this); !it.done(); it.Advance()) {
663 if (it.node()->IsStrongRetainer()) { 670 if (it.node()->IsStrongRetainer()) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 implicit_ref_groups_.Clear(); 798 implicit_ref_groups_.Clear();
792 } 799 }
793 800
794 801
795 void GlobalHandles::TearDown() { 802 void GlobalHandles::TearDown() {
796 // TODO(1428): invoke weak callbacks. 803 // TODO(1428): invoke weak callbacks.
797 } 804 }
798 805
799 806
800 } } // namespace v8::internal 807 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/global-handles.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698