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

Side by Side Diff: src/mark-compact.cc

Issue 10831123: Make incremental marking clear ICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Erik Corry. Created 8 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « src/mark-compact.h ('k') | src/objects-visiting.h » ('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 // 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 MarkCompactCollector::MarkCompactCollector() : // NOLINT 58 MarkCompactCollector::MarkCompactCollector() : // NOLINT
59 #ifdef DEBUG 59 #ifdef DEBUG
60 state_(IDLE), 60 state_(IDLE),
61 #endif 61 #endif
62 sweep_precisely_(false), 62 sweep_precisely_(false),
63 reduce_memory_footprint_(false), 63 reduce_memory_footprint_(false),
64 abort_incremental_marking_(false), 64 abort_incremental_marking_(false),
65 compacting_(false), 65 compacting_(false),
66 was_marked_incrementally_(false), 66 was_marked_incrementally_(false),
67 flush_monomorphic_ics_(false),
68 tracer_(NULL), 67 tracer_(NULL),
69 migration_slots_buffer_(NULL), 68 migration_slots_buffer_(NULL),
70 heap_(NULL), 69 heap_(NULL),
71 code_flusher_(NULL), 70 code_flusher_(NULL),
72 encountered_weak_maps_(NULL), 71 encountered_weak_maps_(NULL),
73 marker_(this, this) { } 72 marker_(this, this) { }
74 73
75 74
76 #ifdef DEBUG 75 #ifdef DEBUG
77 class VerifyMarkingVisitor: public ObjectVisitor { 76 class VerifyMarkingVisitor: public ObjectVisitor {
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 evacuation_candidates_.Rewind(0); 760 evacuation_candidates_.Rewind(0);
762 invalidated_code_.Rewind(0); 761 invalidated_code_.Rewind(0);
763 } 762 }
764 ASSERT_EQ(0, evacuation_candidates_.length()); 763 ASSERT_EQ(0, evacuation_candidates_.length());
765 } 764 }
766 765
767 766
768 void MarkCompactCollector::Prepare(GCTracer* tracer) { 767 void MarkCompactCollector::Prepare(GCTracer* tracer) {
769 was_marked_incrementally_ = heap()->incremental_marking()->IsMarking(); 768 was_marked_incrementally_ = heap()->incremental_marking()->IsMarking();
770 769
771 // Monomorphic ICs are preserved when possible, but need to be flushed
772 // when they might be keeping a Context alive, or when the heap is about
773 // to be serialized.
774 flush_monomorphic_ics_ =
775 heap()->isolate()->context_exit_happened() || Serializer::enabled();
776
777 // Rather than passing the tracer around we stash it in a static member 770 // Rather than passing the tracer around we stash it in a static member
778 // variable. 771 // variable.
779 tracer_ = tracer; 772 tracer_ = tracer;
780 773
781 #ifdef DEBUG 774 #ifdef DEBUG
782 ASSERT(state_ == IDLE); 775 ASSERT(state_ == IDLE);
783 state_ = PREPARE_GC; 776 state_ = PREPARE_GC;
784 #endif 777 #endif
785 778
786 ASSERT(!FLAG_never_compact || !FLAG_always_compact); 779 ASSERT(!FLAG_never_compact || !FLAG_always_compact);
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 for (Object** p = start; p < end; p++) { 1064 for (Object** p = start; p < end; p++) {
1072 MarkObjectByPointer(collector, start, p); 1065 MarkObjectByPointer(collector, start, p);
1073 } 1066 }
1074 } 1067 }
1075 1068
1076 INLINE(static void MarkObject(Heap* heap, HeapObject* object)) { 1069 INLINE(static void MarkObject(Heap* heap, HeapObject* object)) {
1077 MarkBit mark = Marking::MarkBitFrom(object); 1070 MarkBit mark = Marking::MarkBitFrom(object);
1078 heap->mark_compact_collector()->MarkObject(object, mark); 1071 heap->mark_compact_collector()->MarkObject(object, mark);
1079 } 1072 }
1080 1073
1081 static inline void VisitCodeTarget(Heap* heap, RelocInfo* rinfo) {
1082 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode()));
1083 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address());
1084 if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub()
1085 && (target->ic_state() == MEGAMORPHIC ||
1086 heap->mark_compact_collector()->flush_monomorphic_ics_ ||
1087 target->ic_age() != heap->global_ic_age())) {
1088 IC::Clear(rinfo->pc());
1089 target = Code::GetCodeFromTargetAddress(rinfo->target_address());
1090 }
1091 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target);
1092 MarkObject(heap, target);
1093 }
1094
1095 // Mark object pointed to by p. 1074 // Mark object pointed to by p.
1096 INLINE(static void MarkObjectByPointer(MarkCompactCollector* collector, 1075 INLINE(static void MarkObjectByPointer(MarkCompactCollector* collector,
1097 Object** anchor_slot, 1076 Object** anchor_slot,
1098 Object** p)) { 1077 Object** p)) {
1099 if (!(*p)->IsHeapObject()) return; 1078 if (!(*p)->IsHeapObject()) return;
1100 HeapObject* object = ShortCircuitConsString(p); 1079 HeapObject* object = ShortCircuitConsString(p);
1101 collector->RecordSlot(anchor_slot, p, object); 1080 collector->RecordSlot(anchor_slot, p, object);
1102 MarkBit mark = Marking::MarkBitFrom(object); 1081 MarkBit mark = Marking::MarkBitFrom(object);
1103 collector->MarkObject(object, mark); 1082 collector->MarkObject(object, mark);
1104 } 1083 }
(...skipping 3125 matching lines...) Expand 10 before | Expand all | Expand 10 after
4230 while (buffer != NULL) { 4209 while (buffer != NULL) {
4231 SlotsBuffer* next_buffer = buffer->next(); 4210 SlotsBuffer* next_buffer = buffer->next();
4232 DeallocateBuffer(buffer); 4211 DeallocateBuffer(buffer);
4233 buffer = next_buffer; 4212 buffer = next_buffer;
4234 } 4213 }
4235 *buffer_address = NULL; 4214 *buffer_address = NULL;
4236 } 4215 }
4237 4216
4238 4217
4239 } } // namespace v8::internal 4218 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.h ('k') | src/objects-visiting.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698