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

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

Issue 1493393002: Revert "Use WeakCells in the optimized code map rather than traversing in pause." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/heap/objects-visiting.h ('k') | src/objects.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 #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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 shared->ResetForNewContext(heap->global_ic_age()); 435 shared->ResetForNewContext(heap->global_ic_age());
436 } 436 }
437 if (FLAG_cleanup_code_caches_at_gc) { 437 if (FLAG_cleanup_code_caches_at_gc) {
438 shared->ClearTypeFeedbackInfoAtGCTime(); 438 shared->ClearTypeFeedbackInfoAtGCTime();
439 } 439 }
440 if (FLAG_flush_optimized_code_cache) { 440 if (FLAG_flush_optimized_code_cache) {
441 if (!shared->OptimizedCodeMapIsCleared()) { 441 if (!shared->OptimizedCodeMapIsCleared()) {
442 // Always flush the optimized code map if requested by flag. 442 // Always flush the optimized code map if requested by flag.
443 shared->ClearOptimizedCodeMap(); 443 shared->ClearOptimizedCodeMap();
444 } 444 }
445 } else {
446 if (!shared->OptimizedCodeMapIsCleared()) {
447 // Treat some references within the code map weakly by marking the
448 // code map itself but not pushing it onto the marking deque. The
449 // map will be processed after marking.
450 FixedArray* code_map = shared->optimized_code_map();
451 MarkOptimizedCodeMap(heap, code_map);
452 }
445 } 453 }
446 MarkCompactCollector* collector = heap->mark_compact_collector(); 454 MarkCompactCollector* collector = heap->mark_compact_collector();
447 if (collector->is_code_flushing_enabled()) { 455 if (collector->is_code_flushing_enabled()) {
448 if (IsFlushable(heap, shared)) { 456 if (IsFlushable(heap, shared)) {
449 // This function's code looks flushable. But we have to postpone 457 // This function's code looks flushable. But we have to postpone
450 // the decision until we see all functions that point to the same 458 // the decision until we see all functions that point to the same
451 // SharedFunctionInfo because some of them might be optimized. 459 // SharedFunctionInfo because some of them might be optimized.
452 // That would also make the non-optimized version of the code 460 // That would also make the non-optimized version of the code
453 // non-flushable, because it is required for bailing out from 461 // non-flushable, because it is required for bailing out from
454 // optimized code. 462 // optimized code.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 } 582 }
575 583
576 int num_transitions = TransitionArray::NumberOfTransitions(transitions); 584 int num_transitions = TransitionArray::NumberOfTransitions(transitions);
577 for (int i = 0; i < num_transitions; ++i) { 585 for (int i = 0; i < num_transitions; ++i) {
578 StaticVisitor::VisitPointer(heap, transitions, transitions->GetKeySlot(i)); 586 StaticVisitor::VisitPointer(heap, transitions, transitions->GetKeySlot(i));
579 } 587 }
580 } 588 }
581 589
582 590
583 template <typename StaticVisitor> 591 template <typename StaticVisitor>
592 void StaticMarkingVisitor<StaticVisitor>::MarkOptimizedCodeMap(
593 Heap* heap, FixedArray* code_map) {
594 if (!StaticVisitor::MarkObjectWithoutPush(heap, code_map)) return;
595
596 // Mark the context-independent entry in the optimized code map. Depending on
597 // the age of the code object, we treat it as a strong or a weak reference.
598 Object* shared_object = code_map->get(SharedFunctionInfo::kSharedCodeIndex);
599 if (FLAG_turbo_preserve_shared_code && shared_object->IsCode() &&
600 FLAG_age_code && !Code::cast(shared_object)->IsOld()) {
601 StaticVisitor::VisitPointer(
602 heap, code_map,
603 code_map->RawFieldOfElementAt(SharedFunctionInfo::kSharedCodeIndex));
604 }
605 }
606
607
608 template <typename StaticVisitor>
584 void StaticMarkingVisitor<StaticVisitor>::MarkInlinedFunctionsCode(Heap* heap, 609 void StaticMarkingVisitor<StaticVisitor>::MarkInlinedFunctionsCode(Heap* heap,
585 Code* code) { 610 Code* code) {
586 // For optimized functions we should retain both non-optimized version 611 // For optimized functions we should retain both non-optimized version
587 // of its code and non-optimized version of all inlined functions. 612 // of its code and non-optimized version of all inlined functions.
588 // This is required to support bailing out from inlined code. 613 // This is required to support bailing out from inlined code.
589 if (code->deoptimization_data() != heap->empty_fixed_array()) { 614 if (code->deoptimization_data() != heap->empty_fixed_array()) {
590 DeoptimizationInputData* const data = 615 DeoptimizationInputData* const data =
591 DeoptimizationInputData::cast(code->deoptimization_data()); 616 DeoptimizationInputData::cast(code->deoptimization_data());
592 FixedArray* const literals = data->LiteralArray(); 617 FixedArray* const literals = data->LiteralArray();
593 int const inlined_count = data->InlinedFunctionCount()->value(); 618 int const inlined_count = data->InlinedFunctionCount()->value();
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, 773 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode,
749 void> JSFunctionWeakCodeBodyVisitor; 774 void> JSFunctionWeakCodeBodyVisitor;
750 JSFunctionWeakCodeBodyVisitor::Visit(map, object); 775 JSFunctionWeakCodeBodyVisitor::Visit(map, object);
751 } 776 }
752 777
753 778
754 } // namespace internal 779 } // namespace internal
755 } // namespace v8 780 } // namespace v8
756 781
757 #endif // V8_OBJECTS_VISITING_INL_H_ 782 #endif // V8_OBJECTS_VISITING_INL_H_
OLDNEW
« no previous file with comments | « src/heap/objects-visiting.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698