OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 MarkBit mark = Marking::MarkBitFrom(object); | 877 MarkBit mark = Marking::MarkBitFrom(object); |
878 heap->mark_compact_collector()->MarkObject(object, mark); | 878 heap->mark_compact_collector()->MarkObject(object, mark); |
879 } | 879 } |
880 | 880 |
881 static inline void VisitCodeTarget(Heap* heap, RelocInfo* rinfo) { | 881 static inline void VisitCodeTarget(Heap* heap, RelocInfo* rinfo) { |
882 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); | 882 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); |
883 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 883 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
884 if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub()) { | 884 if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub()) { |
885 IC::Clear(rinfo->pc()); | 885 IC::Clear(rinfo->pc()); |
886 target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 886 target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
887 } else { | |
888 if (FLAG_cleanup_code_caches_at_gc && | |
889 target->kind() == Code::STUB && | |
890 target->major_key() == CodeStub::CallFunction && | |
891 target->has_function_cache()) { | |
892 CallFunctionStub::Clear(heap, rinfo->pc()); | |
893 } | |
894 } | 887 } |
895 MarkBit code_mark = Marking::MarkBitFrom(target); | 888 MarkBit code_mark = Marking::MarkBitFrom(target); |
896 heap->mark_compact_collector()->MarkObject(target, code_mark); | 889 heap->mark_compact_collector()->MarkObject(target, code_mark); |
897 | |
898 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); | 890 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); |
899 } | 891 } |
900 | 892 |
901 static inline void VisitDebugTarget(Heap* heap, RelocInfo* rinfo) { | 893 static inline void VisitDebugTarget(Heap* heap, RelocInfo* rinfo) { |
902 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && | 894 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && |
903 rinfo->IsPatchedReturnSequence()) || | 895 rinfo->IsPatchedReturnSequence()) || |
904 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && | 896 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && |
905 rinfo->IsPatchedDebugBreakSlotSequence())); | 897 rinfo->IsPatchedDebugBreakSlotSequence())); |
906 Code* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); | 898 Code* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); |
907 MarkBit code_mark = Marking::MarkBitFrom(target); | 899 MarkBit code_mark = Marking::MarkBitFrom(target); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 | 1000 |
1009 // Mark the backing hash table without pushing it on the marking stack. | 1001 // Mark the backing hash table without pushing it on the marking stack. |
1010 ObjectHashTable* table = ObjectHashTable::cast(weak_map->table()); | 1002 ObjectHashTable* table = ObjectHashTable::cast(weak_map->table()); |
1011 ASSERT(!MarkCompactCollector::IsMarked(table)); | 1003 ASSERT(!MarkCompactCollector::IsMarked(table)); |
1012 collector->SetMark(table, Marking::MarkBitFrom(table)); | 1004 collector->SetMark(table, Marking::MarkBitFrom(table)); |
1013 collector->MarkObject(table->map(), Marking::MarkBitFrom(table->map())); | 1005 collector->MarkObject(table->map(), Marking::MarkBitFrom(table->map())); |
1014 ASSERT(MarkCompactCollector::IsMarked(table->map())); | 1006 ASSERT(MarkCompactCollector::IsMarked(table->map())); |
1015 } | 1007 } |
1016 | 1008 |
1017 static void VisitCode(Map* map, HeapObject* object) { | 1009 static void VisitCode(Map* map, HeapObject* object) { |
1018 reinterpret_cast<Code*>(object)->CodeIterateBody<StaticMarkingVisitor>( | 1010 Heap* heap = map->GetHeap(); |
1019 map->GetHeap()); | 1011 Code* code = reinterpret_cast<Code*>(object); |
| 1012 if (FLAG_cleanup_code_caches_at_gc) { |
| 1013 TypeFeedbackCells* type_feedback_cells = code->type_feedback_cells(); |
| 1014 for (int i = 0; i < type_feedback_cells->CellCount(); i++) { |
| 1015 ASSERT(type_feedback_cells->AstId(i)->IsSmi()); |
| 1016 JSGlobalPropertyCell* cell = type_feedback_cells->Cell(i); |
| 1017 cell->set_value(TypeFeedbackCells::RawUninitializedSentinel(heap)); |
| 1018 } |
| 1019 } |
| 1020 code->CodeIterateBody<StaticMarkingVisitor>(heap); |
1020 } | 1021 } |
1021 | 1022 |
1022 // Code flushing support. | 1023 // Code flushing support. |
1023 | 1024 |
1024 // How many collections newly compiled code object will survive before being | 1025 // How many collections newly compiled code object will survive before being |
1025 // flushed. | 1026 // flushed. |
1026 static const int kCodeAgeThreshold = 5; | 1027 static const int kCodeAgeThreshold = 5; |
1027 | 1028 |
1028 static const int kRegExpCodeThreshold = 5; | 1029 static const int kRegExpCodeThreshold = 5; |
1029 | 1030 |
(...skipping 2874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3904 while (buffer != NULL) { | 3905 while (buffer != NULL) { |
3905 SlotsBuffer* next_buffer = buffer->next(); | 3906 SlotsBuffer* next_buffer = buffer->next(); |
3906 DeallocateBuffer(buffer); | 3907 DeallocateBuffer(buffer); |
3907 buffer = next_buffer; | 3908 buffer = next_buffer; |
3908 } | 3909 } |
3909 *buffer_address = NULL; | 3910 *buffer_address = NULL; |
3910 } | 3911 } |
3911 | 3912 |
3912 | 3913 |
3913 } } // namespace v8::internal | 3914 } } // namespace v8::internal |
OLD | NEW |