OLD | NEW |
---|---|
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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
545 ASSERT(node->is_in_new_space_list()); | 545 ASSERT(node->is_in_new_space_list()); |
546 if ((node->is_independent() || node->is_partially_dependent()) && | 546 if ((node->is_independent() || node->is_partially_dependent()) && |
547 node->IsWeakRetainer()) { | 547 node->IsWeakRetainer()) { |
548 v->VisitPointer(node->location()); | 548 v->VisitPointer(node->location()); |
549 } | 549 } |
550 } | 550 } |
551 } | 551 } |
552 | 552 |
553 | 553 |
554 bool GlobalHandles::PostGarbageCollectionProcessing( | 554 bool GlobalHandles::PostGarbageCollectionProcessing( |
555 GarbageCollector collector) { | 555 GarbageCollector collector, GCTracer* tracer) { |
Michael Starzinger
2012/11/16 13:45:51
I am kind of hesitant to let the GCTracer "escape"
haraken
2012/11/19 07:45:43
I think yes. What I am interested in is how many g
| |
556 // Process weak global handle callbacks. This must be done after the | 556 // Process weak global handle callbacks. This must be done after the |
557 // GC is completely done, because the callbacks may invoke arbitrary | 557 // GC is completely done, because the callbacks may invoke arbitrary |
558 // API functions. | 558 // API functions. |
559 ASSERT(isolate_->heap()->gc_state() == Heap::NOT_IN_GC); | 559 ASSERT(isolate_->heap()->gc_state() == Heap::NOT_IN_GC); |
560 const int initial_post_gc_processing_count = ++post_gc_processing_count_; | 560 const int initial_post_gc_processing_count = ++post_gc_processing_count_; |
561 bool next_gc_likely_to_collect_more = false; | 561 bool next_gc_likely_to_collect_more = false; |
562 if (collector == SCAVENGER) { | 562 if (collector == SCAVENGER) { |
563 for (int i = 0; i < new_space_nodes_.length(); ++i) { | 563 for (int i = 0; i < new_space_nodes_.length(); ++i) { |
564 Node* node = new_space_nodes_[i]; | 564 Node* node = new_space_nodes_[i]; |
565 ASSERT(node->is_in_new_space_list()); | 565 ASSERT(node->is_in_new_space_list()); |
(...skipping 29 matching lines...) Expand all Loading... | |
595 if (!it.node()->IsRetainer()) { | 595 if (!it.node()->IsRetainer()) { |
596 next_gc_likely_to_collect_more = true; | 596 next_gc_likely_to_collect_more = true; |
597 } | 597 } |
598 } | 598 } |
599 } | 599 } |
600 // Update the list of new space nodes. | 600 // Update the list of new space nodes. |
601 int last = 0; | 601 int last = 0; |
602 for (int i = 0; i < new_space_nodes_.length(); ++i) { | 602 for (int i = 0; i < new_space_nodes_.length(); ++i) { |
603 Node* node = new_space_nodes_[i]; | 603 Node* node = new_space_nodes_[i]; |
604 ASSERT(node->is_in_new_space_list()); | 604 ASSERT(node->is_in_new_space_list()); |
605 if (node->IsRetainer() && isolate_->heap()->InNewSpace(node->object())) { | 605 if (node->IsRetainer()) { |
606 new_space_nodes_[last++] = node; | 606 if (isolate_->heap()->InNewSpace(node->object())) { |
607 new_space_nodes_[last++] = node; | |
608 tracer->increment_copied_nodes_in_new_space(); | |
609 } else { | |
610 node->set_in_new_space_list(false); | |
611 tracer->increment_promoted_nodes(); | |
612 } | |
607 } else { | 613 } else { |
608 node->set_in_new_space_list(false); | 614 node->set_in_new_space_list(false); |
615 tracer->increment_died_nodes_in_new_space(); | |
609 } | 616 } |
610 } | 617 } |
611 new_space_nodes_.Rewind(last); | 618 new_space_nodes_.Rewind(last); |
612 return next_gc_likely_to_collect_more; | 619 return next_gc_likely_to_collect_more; |
613 } | 620 } |
614 | 621 |
615 | 622 |
616 void GlobalHandles::IterateStrongRoots(ObjectVisitor* v) { | 623 void GlobalHandles::IterateStrongRoots(ObjectVisitor* v) { |
617 for (NodeIterator it(this); !it.done(); it.Advance()) { | 624 for (NodeIterator it(this); !it.done(); it.Advance()) { |
618 if (it.node()->IsStrongRetainer()) { | 625 if (it.node()->IsStrongRetainer()) { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
746 implicit_ref_groups_.Clear(); | 753 implicit_ref_groups_.Clear(); |
747 } | 754 } |
748 | 755 |
749 | 756 |
750 void GlobalHandles::TearDown() { | 757 void GlobalHandles::TearDown() { |
751 // TODO(1428): invoke weak callbacks. | 758 // TODO(1428): invoke weak callbacks. |
752 } | 759 } |
753 | 760 |
754 | 761 |
755 } } // namespace v8::internal | 762 } } // namespace v8::internal |
OLD | NEW |