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

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

Issue 2389963007: Revert of [heap] Simplify marking of JSFunction and SFI (Closed)
Patch Set: Created 4 years, 2 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/heap/objects-visiting.h ('k') | src/objects.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 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 #ifndef V8_OBJECTS_VISITING_INL_H_ 5 #ifndef V8_OBJECTS_VISITING_INL_H_
6 #define V8_OBJECTS_VISITING_INL_H_ 6 #define V8_OBJECTS_VISITING_INL_H_
7 7
8 #include "src/heap/array-buffer-tracker.h" 8 #include "src/heap/array-buffer-tracker.h"
9 #include "src/heap/objects-visiting.h" 9 #include "src/heap/objects-visiting.h"
10 #include "src/ic/ic-state.h" 10 #include "src/ic/ic-state.h"
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 if (collector->is_code_flushing_enabled()) { 442 if (collector->is_code_flushing_enabled()) {
443 if (IsFlushable(heap, shared)) { 443 if (IsFlushable(heap, shared)) {
444 // This function's code looks flushable. But we have to postpone 444 // This function's code looks flushable. But we have to postpone
445 // the decision until we see all functions that point to the same 445 // the decision until we see all functions that point to the same
446 // SharedFunctionInfo because some of them might be optimized. 446 // SharedFunctionInfo because some of them might be optimized.
447 // That would also make the non-optimized version of the code 447 // That would also make the non-optimized version of the code
448 // non-flushable, because it is required for bailing out from 448 // non-flushable, because it is required for bailing out from
449 // optimized code. 449 // optimized code.
450 collector->code_flusher()->AddCandidate(shared); 450 collector->code_flusher()->AddCandidate(shared);
451 // Treat the reference to the code object weakly. 451 // Treat the reference to the code object weakly.
452 VisitSharedFunctionInfoWeakCode(map, object); 452 VisitSharedFunctionInfoWeakCode(heap, object);
453 return; 453 return;
454 } 454 }
455 } 455 }
456 VisitSharedFunctionInfoStrongCode(map, object); 456 VisitSharedFunctionInfoStrongCode(heap, object);
457 } 457 }
458 458
459 459
460 template <typename StaticVisitor> 460 template <typename StaticVisitor>
461 void StaticMarkingVisitor<StaticVisitor>::VisitJSFunction(Map* map, 461 void StaticMarkingVisitor<StaticVisitor>::VisitJSFunction(Map* map,
462 HeapObject* object) { 462 HeapObject* object) {
463 Heap* heap = map->GetHeap(); 463 Heap* heap = map->GetHeap();
464 JSFunction* function = JSFunction::cast(object); 464 JSFunction* function = JSFunction::cast(object);
465 if (FLAG_cleanup_code_caches_at_gc) { 465 if (FLAG_cleanup_code_caches_at_gc) {
466 function->ClearTypeFeedbackInfoAtGCTime(); 466 function->ClearTypeFeedbackInfoAtGCTime();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 } 614 }
615 615
616 // Check age of code. If code aging is disabled we never flush. 616 // Check age of code. If code aging is disabled we never flush.
617 if (!FLAG_age_code || !shared_info->code()->IsOld()) { 617 if (!FLAG_age_code || !shared_info->code()->IsOld()) {
618 return false; 618 return false;
619 } 619 }
620 620
621 return true; 621 return true;
622 } 622 }
623 623
624
624 template <typename StaticVisitor> 625 template <typename StaticVisitor>
625 void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfoStrongCode( 626 void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfoStrongCode(
626 Map* map, HeapObject* object) { 627 Heap* heap, HeapObject* object) {
627 FixedBodyVisitor<StaticVisitor, SharedFunctionInfo::BodyDescriptor, 628 Object** start_slot = HeapObject::RawField(
628 void>::Visit(map, object); 629 object, SharedFunctionInfo::BodyDescriptor::kStartOffset);
630 Object** end_slot = HeapObject::RawField(
631 object, SharedFunctionInfo::BodyDescriptor::kEndOffset);
632 StaticVisitor::VisitPointers(heap, object, start_slot, end_slot);
629 } 633 }
630 634
635
631 template <typename StaticVisitor> 636 template <typename StaticVisitor>
632 void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfoWeakCode( 637 void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfoWeakCode(
633 Map* map, HeapObject* object) { 638 Heap* heap, HeapObject* object) {
639 Object** name_slot =
640 HeapObject::RawField(object, SharedFunctionInfo::kNameOffset);
641 StaticVisitor::VisitPointer(heap, object, name_slot);
642
634 // Skip visiting kCodeOffset as it is treated weakly here. 643 // Skip visiting kCodeOffset as it is treated weakly here.
635 STATIC_ASSERT(SharedFunctionInfo::kCodeOffset < 644 STATIC_ASSERT(SharedFunctionInfo::kNameOffset + kPointerSize ==
636 SharedFunctionInfo::BodyDescriptorWeakCode::kStartOffset); 645 SharedFunctionInfo::kCodeOffset);
637 FixedBodyVisitor<StaticVisitor, SharedFunctionInfo::BodyDescriptorWeakCode, 646 STATIC_ASSERT(SharedFunctionInfo::kCodeOffset + kPointerSize ==
638 void>::Visit(map, object); 647 SharedFunctionInfo::kOptimizedCodeMapOffset);
648
649 Object** start_slot =
650 HeapObject::RawField(object, SharedFunctionInfo::kOptimizedCodeMapOffset);
651 Object** end_slot = HeapObject::RawField(
652 object, SharedFunctionInfo::BodyDescriptor::kEndOffset);
653 StaticVisitor::VisitPointers(heap, object, start_slot, end_slot);
639 } 654 }
640 655
656
641 template <typename StaticVisitor> 657 template <typename StaticVisitor>
642 void StaticMarkingVisitor<StaticVisitor>::VisitJSFunctionStrongCode( 658 void StaticMarkingVisitor<StaticVisitor>::VisitJSFunctionStrongCode(
643 Map* map, HeapObject* object) { 659 Map* map, HeapObject* object) {
644 typedef FlexibleBodyVisitor<StaticVisitor, 660 typedef FlexibleBodyVisitor<StaticVisitor,
645 JSFunction::BodyDescriptorStrongCode, 661 JSFunction::BodyDescriptorStrongCode,
646 void> JSFunctionStrongCodeBodyVisitor; 662 void> JSFunctionStrongCodeBodyVisitor;
647 JSFunctionStrongCodeBodyVisitor::Visit(map, object); 663 JSFunctionStrongCodeBodyVisitor::Visit(map, object);
648 } 664 }
649 665
650 666
651 template <typename StaticVisitor> 667 template <typename StaticVisitor>
652 void StaticMarkingVisitor<StaticVisitor>::VisitJSFunctionWeakCode( 668 void StaticMarkingVisitor<StaticVisitor>::VisitJSFunctionWeakCode(
653 Map* map, HeapObject* object) { 669 Map* map, HeapObject* object) {
654 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, 670 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode,
655 void> JSFunctionWeakCodeBodyVisitor; 671 void> JSFunctionWeakCodeBodyVisitor;
656 JSFunctionWeakCodeBodyVisitor::Visit(map, object); 672 JSFunctionWeakCodeBodyVisitor::Visit(map, object);
657 } 673 }
658 674
659 675
660 } // namespace internal 676 } // namespace internal
661 } // namespace v8 677 } // namespace v8
662 678
663 #endif // V8_OBJECTS_VISITING_INL_H_ 679 #endif // V8_OBJECTS_VISITING_INL_H_
OLDNEW
« no previous file with comments | « src/heap/objects-visiting.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698