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()) { |
| 449 // Always flush the optimized code map if requested by flag. |
| 450 shared->ClearOptimizedCodeMap(); |
| 451 } |
| 452 MarkCompactCollector* collector = heap->mark_compact_collector(); |
| 453 if (collector->is_code_flushing_enabled()) { |
448 if (!shared->optimized_code_map()->IsSmi()) { | 454 if (!shared->optimized_code_map()->IsSmi()) { |
449 // Always flush the optimized code map if requested by flag. | 455 // Add the shared function info holding an optimized code map to |
450 shared->ClearOptimizedCodeMap(); | 456 // the code flusher for processing of code maps after marking. |
451 } | 457 collector->code_flusher()->AddOptimizedCodeMap(shared); |
452 } else { | |
453 if (!shared->optimized_code_map()->IsSmi()) { | |
454 // Treat some references within the code map weakly by marking the | 458 // Treat some references within the code map weakly by marking the |
455 // code map itself but not pushing it onto the marking deque. The | 459 // code map itself but not pushing it onto the marking deque. |
456 // map will be processed after marking. | |
457 FixedArray* code_map = FixedArray::cast(shared->optimized_code_map()); | 460 FixedArray* code_map = FixedArray::cast(shared->optimized_code_map()); |
458 MarkOptimizedCodeMap(heap, code_map); | 461 MarkOptimizedCodeMap(heap, code_map); |
459 } | 462 } |
460 } | |
461 MarkCompactCollector* collector = heap->mark_compact_collector(); | |
462 if (collector->is_code_flushing_enabled()) { | |
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! | |
477 if (!shared->optimized_code_map()->IsSmi()) { | 476 if (!shared->optimized_code_map()->IsSmi()) { |
478 // Flush optimized code map on major GCs without code flushing, | 477 // Flush optimized code map on major GCs without code flushing, |
479 // needed because cached code doesn't contain breakpoints. | 478 // needed because cached code doesn't contain breakpoints. |
480 shared->ClearOptimizedCodeMap(); | 479 shared->ClearOptimizedCodeMap(); |
481 } | 480 } |
482 } | 481 } |
483 VisitSharedFunctionInfoStrongCode(heap, object); | 482 VisitSharedFunctionInfoStrongCode(heap, object); |
484 } | 483 } |
485 | 484 |
486 | 485 |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 | 898 |
900 RelocIterator it(this, mode_mask); | 899 RelocIterator it(this, mode_mask); |
901 for (; !it.done(); it.next()) { | 900 for (; !it.done(); it.next()) { |
902 it.rinfo()->template Visit<StaticVisitor>(heap); | 901 it.rinfo()->template Visit<StaticVisitor>(heap); |
903 } | 902 } |
904 } | 903 } |
905 } // namespace internal | 904 } // namespace internal |
906 } // namespace v8 | 905 } // namespace v8 |
907 | 906 |
908 #endif // V8_OBJECTS_VISITING_INL_H_ | 907 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |