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

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

Issue 9255014: Only clear monomorphic ICs on GC after Context exit (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fixed tests Created 8 years, 11 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') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 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
11 // with the distribution. 11 // with the distribution.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // MarkCompactCollector 56 // MarkCompactCollector
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 compacting_(false), 63 compacting_(false),
64 was_marked_incrementally_(false), 64 was_marked_incrementally_(false),
65 collect_maps_(FLAG_collect_maps), 65 collect_maps_(FLAG_collect_maps),
66 flush_monomorphic_ics_(false),
66 tracer_(NULL), 67 tracer_(NULL),
67 migration_slots_buffer_(NULL), 68 migration_slots_buffer_(NULL),
68 heap_(NULL), 69 heap_(NULL),
69 code_flusher_(NULL), 70 code_flusher_(NULL),
70 encountered_weak_maps_(NULL) { } 71 encountered_weak_maps_(NULL) { }
71 72
72 73
73 #ifdef DEBUG 74 #ifdef DEBUG
74 class VerifyMarkingVisitor: public ObjectVisitor { 75 class VerifyMarkingVisitor: public ObjectVisitor {
75 public: 76 public:
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 509
509 510
510 void MarkCompactCollector::Prepare(GCTracer* tracer) { 511 void MarkCompactCollector::Prepare(GCTracer* tracer) {
511 was_marked_incrementally_ = heap()->incremental_marking()->IsMarking(); 512 was_marked_incrementally_ = heap()->incremental_marking()->IsMarking();
512 513
513 // Disable collection of maps if incremental marking is enabled. 514 // Disable collection of maps if incremental marking is enabled.
514 // Map collection algorithm relies on a special map transition tree traversal 515 // Map collection algorithm relies on a special map transition tree traversal
515 // order which is not implemented for incremental marking. 516 // order which is not implemented for incremental marking.
516 collect_maps_ = FLAG_collect_maps && !was_marked_incrementally_; 517 collect_maps_ = FLAG_collect_maps && !was_marked_incrementally_;
517 518
519 // Monomorphic ICs are preserved when possible, but need to be flushed
520 // when they might be keeping a Context alive, or when the heap is about
521 // to be serialized.
522 flush_monomorphic_ics_ =
523 heap()->isolate()->context_exit_happened() || Serializer::enabled();
524
518 // Rather than passing the tracer around we stash it in a static member 525 // Rather than passing the tracer around we stash it in a static member
519 // variable. 526 // variable.
520 tracer_ = tracer; 527 tracer_ = tracer;
521 528
522 #ifdef DEBUG 529 #ifdef DEBUG
523 ASSERT(state_ == IDLE); 530 ASSERT(state_ == IDLE);
524 state_ = PREPARE_GC; 531 state_ = PREPARE_GC;
525 #endif 532 #endif
526 533
527 ASSERT(!FLAG_never_compact || !FLAG_always_compact); 534 ASSERT(!FLAG_never_compact || !FLAG_always_compact);
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 // that there can be no such embedded pointers and add assertion here. 881 // that there can be no such embedded pointers and add assertion here.
875 HeapObject* object = HeapObject::cast(rinfo->target_object()); 882 HeapObject* object = HeapObject::cast(rinfo->target_object());
876 heap->mark_compact_collector()->RecordRelocSlot(rinfo, object); 883 heap->mark_compact_collector()->RecordRelocSlot(rinfo, object);
877 MarkBit mark = Marking::MarkBitFrom(object); 884 MarkBit mark = Marking::MarkBitFrom(object);
878 heap->mark_compact_collector()->MarkObject(object, mark); 885 heap->mark_compact_collector()->MarkObject(object, mark);
879 } 886 }
880 887
881 static inline void VisitCodeTarget(Heap* heap, RelocInfo* rinfo) { 888 static inline void VisitCodeTarget(Heap* heap, RelocInfo* rinfo) {
882 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); 889 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode()));
883 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); 890 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address());
884 if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub()) { 891 if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub()
892 && (target->ic_state() == MEGAMORPHIC ||
893 heap->mark_compact_collector()->flush_monomorphic_ics_)) {
885 IC::Clear(rinfo->pc()); 894 IC::Clear(rinfo->pc());
886 target = Code::GetCodeFromTargetAddress(rinfo->target_address()); 895 target = Code::GetCodeFromTargetAddress(rinfo->target_address());
887 } else { 896 } else {
888 if (FLAG_cleanup_code_caches_at_gc && 897 if (FLAG_cleanup_code_caches_at_gc &&
889 target->kind() == Code::STUB && 898 target->kind() == Code::STUB &&
890 target->major_key() == CodeStub::CallFunction && 899 target->major_key() == CodeStub::CallFunction &&
891 target->has_function_cache()) { 900 target->has_function_cache()) {
892 CallFunctionStub::Clear(heap, rinfo->pc()); 901 CallFunctionStub::Clear(heap, rinfo->pc());
893 } 902 }
894 } 903 }
(...skipping 3012 matching lines...) Expand 10 before | Expand all | Expand 10 after
3907 while (buffer != NULL) { 3916 while (buffer != NULL) {
3908 SlotsBuffer* next_buffer = buffer->next(); 3917 SlotsBuffer* next_buffer = buffer->next();
3909 DeallocateBuffer(buffer); 3918 DeallocateBuffer(buffer);
3910 buffer = next_buffer; 3919 buffer = next_buffer;
3911 } 3920 }
3912 *buffer_address = NULL; 3921 *buffer_address = NULL;
3913 } 3922 }
3914 3923
3915 3924
3916 } } // namespace v8::internal 3925 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698