OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 isolate_->heap()->mark_compact_collector()-> | 919 isolate_->heap()->mark_compact_collector()-> |
920 RecordSlot(code_slot, code_slot, *code_slot); | 920 RecordSlot(code_slot, code_slot, *code_slot); |
921 | 921 |
922 candidate = next_candidate; | 922 candidate = next_candidate; |
923 } | 923 } |
924 | 924 |
925 shared_function_info_candidates_head_ = NULL; | 925 shared_function_info_candidates_head_ = NULL; |
926 } | 926 } |
927 | 927 |
928 | 928 |
| 929 void CodeFlusher::EvictCandidate(JSFunction* function) { |
| 930 ASSERT(!function->next_function_link()->IsUndefined()); |
| 931 Object* undefined = isolate_->heap()->undefined_value(); |
| 932 |
| 933 JSFunction* candidate = jsfunction_candidates_head_; |
| 934 JSFunction* next_candidate; |
| 935 if (candidate == function) { |
| 936 next_candidate = GetNextCandidate(function); |
| 937 jsfunction_candidates_head_ = next_candidate; |
| 938 ClearNextCandidate(function, undefined); |
| 939 } else { |
| 940 while (candidate != NULL) { |
| 941 next_candidate = GetNextCandidate(candidate); |
| 942 |
| 943 if (next_candidate == function) { |
| 944 next_candidate = GetNextCandidate(function); |
| 945 SetNextCandidate(candidate, next_candidate); |
| 946 ClearNextCandidate(function, undefined); |
| 947 } |
| 948 |
| 949 candidate = next_candidate; |
| 950 } |
| 951 } |
| 952 } |
| 953 |
| 954 |
929 MarkCompactCollector::~MarkCompactCollector() { | 955 MarkCompactCollector::~MarkCompactCollector() { |
930 if (code_flusher_ != NULL) { | 956 if (code_flusher_ != NULL) { |
931 delete code_flusher_; | 957 delete code_flusher_; |
932 code_flusher_ = NULL; | 958 code_flusher_ = NULL; |
933 } | 959 } |
934 } | 960 } |
935 | 961 |
936 | 962 |
937 static inline HeapObject* ShortCircuitConsString(Object** p) { | 963 static inline HeapObject* ShortCircuitConsString(Object** p) { |
938 // Optimization: If the heap object pointed to by p is a non-symbol | 964 // Optimization: If the heap object pointed to by p is a non-symbol |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1423 MarkCompactMarkingVisitor::MarkInlinedFunctionsCode(heap(), | 1449 MarkCompactMarkingVisitor::MarkInlinedFunctionsCode(heap(), |
1424 frame->LookupCode()); | 1450 frame->LookupCode()); |
1425 } | 1451 } |
1426 } | 1452 } |
1427 } | 1453 } |
1428 | 1454 |
1429 | 1455 |
1430 void MarkCompactCollector::PrepareForCodeFlushing() { | 1456 void MarkCompactCollector::PrepareForCodeFlushing() { |
1431 ASSERT(heap() == Isolate::Current()->heap()); | 1457 ASSERT(heap() == Isolate::Current()->heap()); |
1432 | 1458 |
1433 // TODO(1609) Currently incremental marker does not support code flushing. | 1459 // If code flushing is disabled, there is no need to prepare for it. |
1434 if (!FLAG_flush_code || was_marked_incrementally_) { | 1460 if (!is_code_flushing_enabled()) return; |
1435 EnableCodeFlushing(false); | |
1436 return; | |
1437 } | |
1438 | |
1439 #ifdef ENABLE_DEBUGGER_SUPPORT | |
1440 if (heap()->isolate()->debug()->IsLoaded() || | |
1441 heap()->isolate()->debug()->has_break_points()) { | |
1442 EnableCodeFlushing(false); | |
1443 return; | |
1444 } | |
1445 #endif | |
1446 | |
1447 EnableCodeFlushing(true); | |
1448 | 1461 |
1449 // Ensure that empty descriptor array is marked. Method MarkDescriptorArray | 1462 // Ensure that empty descriptor array is marked. Method MarkDescriptorArray |
1450 // relies on it being marked before any other descriptor array. | 1463 // relies on it being marked before any other descriptor array. |
1451 HeapObject* descriptor_array = heap()->empty_descriptor_array(); | 1464 HeapObject* descriptor_array = heap()->empty_descriptor_array(); |
1452 MarkBit descriptor_array_mark = Marking::MarkBitFrom(descriptor_array); | 1465 MarkBit descriptor_array_mark = Marking::MarkBitFrom(descriptor_array); |
1453 MarkObject(descriptor_array, descriptor_array_mark); | 1466 MarkObject(descriptor_array, descriptor_array_mark); |
1454 | 1467 |
1455 // Make sure we are not referencing the code from the stack. | 1468 // Make sure we are not referencing the code from the stack. |
1456 ASSERT(this == heap()->mark_compact_collector()); | 1469 ASSERT(this == heap()->mark_compact_collector()); |
1457 PrepareThreadForCodeFlushing(heap()->isolate(), | 1470 PrepareThreadForCodeFlushing(heap()->isolate(), |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1998 MarkCompactWeakObjectRetainer mark_compact_object_retainer; | 2011 MarkCompactWeakObjectRetainer mark_compact_object_retainer; |
1999 heap()->ProcessWeakReferences(&mark_compact_object_retainer); | 2012 heap()->ProcessWeakReferences(&mark_compact_object_retainer); |
2000 | 2013 |
2001 // Remove object groups after marking phase. | 2014 // Remove object groups after marking phase. |
2002 heap()->isolate()->global_handles()->RemoveObjectGroups(); | 2015 heap()->isolate()->global_handles()->RemoveObjectGroups(); |
2003 heap()->isolate()->global_handles()->RemoveImplicitRefGroups(); | 2016 heap()->isolate()->global_handles()->RemoveImplicitRefGroups(); |
2004 | 2017 |
2005 // Flush code from collected candidates. | 2018 // Flush code from collected candidates. |
2006 if (is_code_flushing_enabled()) { | 2019 if (is_code_flushing_enabled()) { |
2007 code_flusher_->ProcessCandidates(); | 2020 code_flusher_->ProcessCandidates(); |
2008 // TODO(1609) Currently incremental marker does not support code flushing, | |
2009 // we need to disable it before incremental marking steps for next cycle. | |
2010 EnableCodeFlushing(false); | |
2011 } | 2021 } |
2012 | 2022 |
2013 if (!FLAG_watch_ic_patching) { | 2023 if (!FLAG_watch_ic_patching) { |
2014 // Clean up dead objects from the runtime profiler. | 2024 // Clean up dead objects from the runtime profiler. |
2015 heap()->isolate()->runtime_profiler()->RemoveDeadSamples(); | 2025 heap()->isolate()->runtime_profiler()->RemoveDeadSamples(); |
2016 } | 2026 } |
2017 | 2027 |
2018 if (FLAG_track_gc_object_stats) { | 2028 if (FLAG_track_gc_object_stats) { |
2019 heap()->CheckpointObjectStats(); | 2029 heap()->CheckpointObjectStats(); |
2020 } | 2030 } |
(...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3755 while (buffer != NULL) { | 3765 while (buffer != NULL) { |
3756 SlotsBuffer* next_buffer = buffer->next(); | 3766 SlotsBuffer* next_buffer = buffer->next(); |
3757 DeallocateBuffer(buffer); | 3767 DeallocateBuffer(buffer); |
3758 buffer = next_buffer; | 3768 buffer = next_buffer; |
3759 } | 3769 } |
3760 *buffer_address = NULL; | 3770 *buffer_address = NULL; |
3761 } | 3771 } |
3762 | 3772 |
3763 | 3773 |
3764 } } // namespace v8::internal | 3774 } } // namespace v8::internal |
OLD | NEW |