OLD | NEW |
---|---|
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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
436 void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfo( | 436 void StaticMarkingVisitor<StaticVisitor>::VisitSharedFunctionInfo( |
437 Map* map, HeapObject* object) { | 437 Map* map, HeapObject* object) { |
438 Heap* heap = map->GetHeap(); | 438 Heap* heap = map->GetHeap(); |
439 SharedFunctionInfo* shared = SharedFunctionInfo::cast(object); | 439 SharedFunctionInfo* shared = SharedFunctionInfo::cast(object); |
440 if (shared->ic_age() != heap->global_ic_age()) { | 440 if (shared->ic_age() != heap->global_ic_age()) { |
441 shared->ResetForNewContext(heap->global_ic_age()); | 441 shared->ResetForNewContext(heap->global_ic_age()); |
442 } | 442 } |
443 if (FLAG_cleanup_code_caches_at_gc) { | 443 if (FLAG_cleanup_code_caches_at_gc) { |
444 shared->ClearTypeFeedbackInfoAtGCTime(); | 444 shared->ClearTypeFeedbackInfoAtGCTime(); |
445 } | 445 } |
446 if ((FLAG_flush_optimized_code_cache || | 446 if (FLAG_flush_optimized_code_cache || |
447 heap->isolate()->serializer_enabled()) && | 447 heap->isolate()->serializer_enabled()) { |
448 !shared->optimized_code_map()->IsSmi()) { | 448 if (!shared->optimized_code_map()->IsSmi()) { |
449 // Always flush the optimized code map if requested by flag. | 449 // Always flush the optimized code map if requested by flag. |
450 shared->ClearOptimizedCodeMap(); | 450 shared->ClearOptimizedCodeMap(); |
451 } | |
452 } else { | |
453 if (!shared->optimized_code_map()->IsSmi()) { | |
454 // Treat some references within the code map weakly by marking the | |
455 // code map itself but not pushing it onto the marking deque. The | |
456 // map will be processed after marking. | |
457 FixedArray* code_map = FixedArray::cast(shared->optimized_code_map()); | |
458 MarkOptimizedCodeMap(heap, code_map); | |
ulan
2015/11/05 13:23:17
Not related to the CL: there is a potential memory
Michael Starzinger
2015/11/05 13:51:03
Acknowledged. As discussed offline: Yes, you are a
| |
459 } | |
451 } | 460 } |
452 MarkCompactCollector* collector = heap->mark_compact_collector(); | 461 MarkCompactCollector* collector = heap->mark_compact_collector(); |
453 if (collector->is_code_flushing_enabled()) { | 462 if (collector->is_code_flushing_enabled()) { |
454 if (!shared->optimized_code_map()->IsSmi()) { | |
455 // Add the shared function info holding an optimized code map to | |
456 // the code flusher for processing of code maps after marking. | |
457 collector->code_flusher()->AddOptimizedCodeMap(shared); | |
458 // Treat some references within the code map weakly by marking the | |
459 // code map itself but not pushing it onto the marking deque. | |
460 FixedArray* code_map = FixedArray::cast(shared->optimized_code_map()); | |
461 MarkOptimizedCodeMap(heap, code_map); | |
462 } | |
463 if (IsFlushable(heap, shared)) { | 463 if (IsFlushable(heap, shared)) { |
464 // This function's code looks flushable. But we have to postpone | 464 // This function's code looks flushable. But we have to postpone |
465 // the decision until we see all functions that point to the same | 465 // the decision until we see all functions that point to the same |
466 // SharedFunctionInfo because some of them might be optimized. | 466 // SharedFunctionInfo because some of them might be optimized. |
467 // That would also make the non-optimized version of the code | 467 // That would also make the non-optimized version of the code |
468 // non-flushable, because it is required for bailing out from | 468 // non-flushable, because it is required for bailing out from |
469 // optimized code. | 469 // optimized code. |
470 collector->code_flusher()->AddCandidate(shared); | 470 collector->code_flusher()->AddCandidate(shared); |
471 // Treat the reference to the code object weakly. | 471 // Treat the reference to the code object weakly. |
472 VisitSharedFunctionInfoWeakCode(heap, object); | 472 VisitSharedFunctionInfoWeakCode(heap, object); |
473 return; | 473 return; |
474 } | 474 } |
475 } else { | 475 } else { |
476 // TODO(mstarzinger): Drop this case, it shouldn't be done here! | |
476 if (!shared->optimized_code_map()->IsSmi()) { | 477 if (!shared->optimized_code_map()->IsSmi()) { |
477 // Flush optimized code map on major GCs without code flushing, | 478 // Flush optimized code map on major GCs without code flushing, |
478 // needed because cached code doesn't contain breakpoints. | 479 // needed because cached code doesn't contain breakpoints. |
479 shared->ClearOptimizedCodeMap(); | 480 shared->ClearOptimizedCodeMap(); |
480 } | 481 } |
481 } | 482 } |
482 VisitSharedFunctionInfoStrongCode(heap, object); | 483 VisitSharedFunctionInfoStrongCode(heap, object); |
483 } | 484 } |
484 | 485 |
485 | 486 |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
898 | 899 |
899 RelocIterator it(this, mode_mask); | 900 RelocIterator it(this, mode_mask); |
900 for (; !it.done(); it.next()) { | 901 for (; !it.done(); it.next()) { |
901 it.rinfo()->template Visit<StaticVisitor>(heap); | 902 it.rinfo()->template Visit<StaticVisitor>(heap); |
902 } | 903 } |
903 } | 904 } |
904 } // namespace internal | 905 } // namespace internal |
905 } // namespace v8 | 906 } // namespace v8 |
906 | 907 |
907 #endif // V8_OBJECTS_VISITING_INL_H_ | 908 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |