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

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

Issue 1415683011: [heap] Fix corner case in optimized code map processing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 5 years, 1 month 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 | « no previous file | test/cctest/test-heap.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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 421
422 422
423 template <typename StaticVisitor> 423 template <typename StaticVisitor>
424 void StaticMarkingVisitor<StaticVisitor>::VisitCode(Map* map, 424 void StaticMarkingVisitor<StaticVisitor>::VisitCode(Map* map,
425 HeapObject* object) { 425 HeapObject* object) {
426 Heap* heap = map->GetHeap(); 426 Heap* heap = map->GetHeap();
427 Code* code = Code::cast(object); 427 Code* code = Code::cast(object);
428 if (FLAG_age_code && !heap->isolate()->serializer_enabled()) { 428 if (FLAG_age_code && !heap->isolate()->serializer_enabled()) {
429 code->MakeOlder(heap->mark_compact_collector()->marking_parity()); 429 code->MakeOlder(heap->mark_compact_collector()->marking_parity());
430 } 430 }
431 MarkCompactCollector* collector = heap->mark_compact_collector();
432 if (collector->is_code_flushing_enabled()) {
433 if (code->kind() == Code::OPTIMIZED_FUNCTION) {
434 // Visit all unoptimized code objects to prevent flushing them.
435 MarkInlinedFunctionsCode(heap, code);
436 }
437 }
431 code->CodeIterateBody<StaticVisitor>(heap); 438 code->CodeIterateBody<StaticVisitor>(heap);
432 } 439 }
433 440
434 441
435 template <typename StaticVisitor> 442 template <typename StaticVisitor>
436 void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfo( 443 void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfo(
437 Map* map, HeapObject* object) { 444 Map* map, HeapObject* object) {
438 Heap* heap = map->GetHeap(); 445 Heap* heap = map->GetHeap();
439 SharedFunctionInfo* shared = SharedFunctionInfo::cast(object); 446 SharedFunctionInfo* shared = SharedFunctionInfo::cast(object);
440 if (shared->ic_age() != heap->global_ic_age()) { 447 if (shared->ic_age() != heap->global_ic_age()) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 if (StaticVisitor::MarkObjectWithoutPush(heap, shared)) { 511 if (StaticVisitor::MarkObjectWithoutPush(heap, shared)) {
505 StaticVisitor::MarkObject(heap, shared->map()); 512 StaticVisitor::MarkObject(heap, shared->map());
506 VisitSharedFunctionInfoWeakCode(heap, shared); 513 VisitSharedFunctionInfoWeakCode(heap, shared);
507 } 514 }
508 // Treat the reference to the code object weakly. 515 // Treat the reference to the code object weakly.
509 VisitJSFunctionWeakCode(heap, object); 516 VisitJSFunctionWeakCode(heap, object);
510 return; 517 return;
511 } else { 518 } else {
512 // Visit all unoptimized code objects to prevent flushing them. 519 // Visit all unoptimized code objects to prevent flushing them.
513 StaticVisitor::MarkObject(heap, function->shared()->code()); 520 StaticVisitor::MarkObject(heap, function->shared()->code());
514 if (function->code()->kind() == Code::OPTIMIZED_FUNCTION) {
515 MarkInlinedFunctionsCode(heap, function->code());
516 }
517 } 521 }
518 } 522 }
519 VisitJSFunctionStrongCode(heap, object); 523 VisitJSFunctionStrongCode(heap, object);
520 } 524 }
521 525
522 526
523 template <typename StaticVisitor> 527 template <typename StaticVisitor>
524 void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp(Map* map, 528 void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp(Map* map,
525 HeapObject* object) { 529 HeapObject* object) {
526 int last_property_offset = 530 int last_property_offset =
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 } 652 }
649 } 653 }
650 654
651 655
652 template <typename StaticVisitor> 656 template <typename StaticVisitor>
653 void StaticMarkingVisitor<StaticVisitor>::MarkInlinedFunctionsCode(Heap* heap, 657 void StaticMarkingVisitor<StaticVisitor>::MarkInlinedFunctionsCode(Heap* heap,
654 Code* code) { 658 Code* code) {
655 // For optimized functions we should retain both non-optimized version 659 // For optimized functions we should retain both non-optimized version
656 // of its code and non-optimized version of all inlined functions. 660 // of its code and non-optimized version of all inlined functions.
657 // This is required to support bailing out from inlined code. 661 // This is required to support bailing out from inlined code.
658 DeoptimizationInputData* const data = 662 if (code->deoptimization_data() != heap->empty_fixed_array()) {
659 DeoptimizationInputData::cast(code->deoptimization_data()); 663 DeoptimizationInputData* const data =
660 FixedArray* const literals = data->LiteralArray(); 664 DeoptimizationInputData::cast(code->deoptimization_data());
661 int const inlined_count = data->InlinedFunctionCount()->value(); 665 FixedArray* const literals = data->LiteralArray();
662 for (int i = 0; i < inlined_count; ++i) { 666 int const inlined_count = data->InlinedFunctionCount()->value();
663 StaticVisitor::MarkObject( 667 for (int i = 0; i < inlined_count; ++i) {
664 heap, SharedFunctionInfo::cast(literals->get(i))->code()); 668 StaticVisitor::MarkObject(
669 heap, SharedFunctionInfo::cast(literals->get(i))->code());
670 }
665 } 671 }
666 } 672 }
667 673
668 674
669 inline static bool HasValidNonBuiltinContext(JSFunction* function) { 675 inline static bool HasValidNonBuiltinContext(JSFunction* function) {
670 return function->context()->IsContext() && !function->shared()->IsBuiltin(); 676 return function->context()->IsContext() && !function->shared()->IsBuiltin();
671 } 677 }
672 678
673 679
674 inline static bool HasSourceCode(Heap* heap, SharedFunctionInfo* info) { 680 inline static bool HasSourceCode(Heap* heap, SharedFunctionInfo* info) {
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 903
898 RelocIterator it(this, mode_mask); 904 RelocIterator it(this, mode_mask);
899 for (; !it.done(); it.next()) { 905 for (; !it.done(); it.next()) {
900 it.rinfo()->template Visit<StaticVisitor>(heap); 906 it.rinfo()->template Visit<StaticVisitor>(heap);
901 } 907 }
902 } 908 }
903 } // namespace internal 909 } // namespace internal
904 } // namespace v8 910 } // namespace v8
905 911
906 #endif // V8_OBJECTS_VISITING_INL_H_ 912 #endif // V8_OBJECTS_VISITING_INL_H_
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698