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

Side by Side Diff: src/objects-visiting-inl.h

Issue 17061004: Deprecate old code aging mechanism. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment by Daniel Clifford. Created 7 years, 6 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 | « src/objects-inl.h ('k') | 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 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 599
600 template<typename StaticVisitor> 600 template<typename StaticVisitor>
601 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable( 601 bool StaticMarkingVisitor<StaticVisitor>::IsFlushable(
602 Heap* heap, JSFunction* function) { 602 Heap* heap, JSFunction* function) {
603 SharedFunctionInfo* shared_info = function->shared(); 603 SharedFunctionInfo* shared_info = function->shared();
604 604
605 // Code is either on stack, in compilation cache or referenced 605 // Code is either on stack, in compilation cache or referenced
606 // by optimized version of function. 606 // by optimized version of function.
607 MarkBit code_mark = Marking::MarkBitFrom(function->code()); 607 MarkBit code_mark = Marking::MarkBitFrom(function->code());
608 if (code_mark.Get()) { 608 if (code_mark.Get()) {
609 if (!FLAG_age_code) {
610 if (!Marking::MarkBitFrom(shared_info).Get()) {
611 shared_info->set_code_age(0);
612 }
613 }
614 return false; 609 return false;
615 } 610 }
616 611
617 // The function must have a valid context and not be a builtin. 612 // The function must have a valid context and not be a builtin.
618 if (!IsValidNonBuiltinContext(function->unchecked_context())) { 613 if (!IsValidNonBuiltinContext(function->unchecked_context())) {
619 return false; 614 return false;
620 } 615 }
621 616
622 // We do not (yet) flush code for optimized functions. 617 // We do not (yet) flush code for optimized functions.
623 if (function->code() != shared_info->code()) { 618 if (function->code() != shared_info->code()) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 if (shared_info->is_toplevel()) { 670 if (shared_info->is_toplevel()) {
676 return false; 671 return false;
677 } 672 }
678 673
679 // If this is a function initialized with %SetCode then the one-to-one 674 // If this is a function initialized with %SetCode then the one-to-one
680 // relation between SharedFunctionInfo and Code is broken. 675 // relation between SharedFunctionInfo and Code is broken.
681 if (shared_info->dont_flush()) { 676 if (shared_info->dont_flush()) {
682 return false; 677 return false;
683 } 678 }
684 679
685 if (FLAG_age_code) { 680 // Check age of code. If code aging is disabled we never flush.
686 return shared_info->code()->IsOld(); 681 if (!FLAG_age_code || !shared_info->code()->IsOld()) {
687 } else { 682 return false;
688 // How many collections newly compiled code object will survive before being 683 }
689 // flushed.
690 static const int kCodeAgeThreshold = 5;
691 684
692 // Age this shared function info. 685 return true;
693 if (shared_info->code_age() < kCodeAgeThreshold) {
694 shared_info->set_code_age(shared_info->code_age() + 1);
695 return false;
696 }
697 return true;
698 }
699 } 686 }
700 687
701 688
702 template<typename StaticVisitor> 689 template<typename StaticVisitor>
703 void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfoStrongCode( 690 void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfoStrongCode(
704 Heap* heap, HeapObject* object) { 691 Heap* heap, HeapObject* object) {
705 StaticVisitor::BeforeVisitingSharedFunctionInfo(object); 692 StaticVisitor::BeforeVisitingSharedFunctionInfo(object);
706 Object** start_slot = 693 Object** start_slot =
707 HeapObject::RawField(object, 694 HeapObject::RawField(object,
708 SharedFunctionInfo::BodyDescriptor::kStartOffset); 695 SharedFunctionInfo::BodyDescriptor::kStartOffset);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 RelocIterator it(this, mode_mask); 817 RelocIterator it(this, mode_mask);
831 for (; !it.done(); it.next()) { 818 for (; !it.done(); it.next()) {
832 it.rinfo()->template Visit<StaticVisitor>(heap); 819 it.rinfo()->template Visit<StaticVisitor>(heap);
833 } 820 }
834 } 821 }
835 822
836 823
837 } } // namespace v8::internal 824 } } // namespace v8::internal
838 825
839 #endif // V8_OBJECTS_VISITING_INL_H_ 826 #endif // V8_OBJECTS_VISITING_INL_H_
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698