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

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

Issue 8700008: New approach to Crankshaft decision-making (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix function self-optimization; address first comment Created 9 years 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
OLDNEW
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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 // that there can be no such embedded pointers and add assertion here. 875 // that there can be no such embedded pointers and add assertion here.
876 HeapObject* object = HeapObject::cast(rinfo->target_object()); 876 HeapObject* object = HeapObject::cast(rinfo->target_object());
877 heap->mark_compact_collector()->RecordRelocSlot(rinfo, object); 877 heap->mark_compact_collector()->RecordRelocSlot(rinfo, object);
878 MarkBit mark = Marking::MarkBitFrom(object); 878 MarkBit mark = Marking::MarkBitFrom(object);
879 heap->mark_compact_collector()->MarkObject(object, mark); 879 heap->mark_compact_collector()->MarkObject(object, mark);
880 } 880 }
881 881
882 static inline void VisitCodeTarget(Heap* heap, RelocInfo* rinfo) { 882 static inline void VisitCodeTarget(Heap* heap, RelocInfo* rinfo) {
883 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); 883 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode()));
884 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); 884 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address());
885 if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub()) { 885 if (FLAG_cleanup_code_caches_at_gc && target->is_inline_cache_stub()
886 && (target->ic_state() == MEGAMORPHIC || Serializer::enabled() ||
887 heap->isolate()->context_exit_happened())) {
886 IC::Clear(rinfo->pc()); 888 IC::Clear(rinfo->pc());
887 // Please note targets for cleared inline cached do not have to be 889 // Please note targets for cleared inline cached do not have to be
888 // marked since they are contained in HEAP->non_monomorphic_cache(). 890 // marked since they are contained in HEAP->non_monomorphic_cache().
889 target = Code::GetCodeFromTargetAddress(rinfo->target_address()); 891 target = Code::GetCodeFromTargetAddress(rinfo->target_address());
890 } else { 892 } else {
891 if (FLAG_cleanup_code_caches_at_gc && 893 if (FLAG_cleanup_code_caches_at_gc &&
892 target->kind() == Code::STUB && 894 target->kind() == Code::STUB &&
893 target->major_key() == CodeStub::CallFunction && 895 target->major_key() == CodeStub::CallFunction &&
894 target->has_function_cache()) { 896 target->has_function_cache()) {
895 CallFunctionStub::Clear(heap, rinfo->pc()); 897 CallFunctionStub::Clear(heap, rinfo->pc());
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 2137
2136 // Remove object groups after marking phase. 2138 // Remove object groups after marking phase.
2137 heap()->isolate()->global_handles()->RemoveObjectGroups(); 2139 heap()->isolate()->global_handles()->RemoveObjectGroups();
2138 heap()->isolate()->global_handles()->RemoveImplicitRefGroups(); 2140 heap()->isolate()->global_handles()->RemoveImplicitRefGroups();
2139 2141
2140 // Flush code from collected candidates. 2142 // Flush code from collected candidates.
2141 if (is_code_flushing_enabled()) { 2143 if (is_code_flushing_enabled()) {
2142 code_flusher_->ProcessCandidates(); 2144 code_flusher_->ProcessCandidates();
2143 } 2145 }
2144 2146
2145 // Clean up dead objects from the runtime profiler. 2147 heap()->isolate()->set_context_exit_happened(false);
2146 heap()->isolate()->runtime_profiler()->RemoveDeadSamples();
2147 } 2148 }
2148 2149
2149 2150
2150 void MarkCompactCollector::ProcessMapCaches() { 2151 void MarkCompactCollector::ProcessMapCaches() {
2151 Object* raw_context = heap()->global_contexts_list_; 2152 Object* raw_context = heap()->global_contexts_list_;
2152 while (raw_context != heap()->undefined_value()) { 2153 while (raw_context != heap()->undefined_value()) {
2153 Context* context = reinterpret_cast<Context*>(raw_context); 2154 Context* context = reinterpret_cast<Context*>(raw_context);
2154 if (IsMarked(context)) { 2155 if (IsMarked(context)) {
2155 HeapObject* raw_map_cache = 2156 HeapObject* raw_map_cache =
2156 HeapObject::cast(context->get(Context::MAP_CACHE_INDEX)); 2157 HeapObject::cast(context->get(Context::MAP_CACHE_INDEX));
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
3140 3141
3141 // Update pointer from the global contexts list. 3142 // Update pointer from the global contexts list.
3142 updating_visitor.VisitPointer(heap_->global_contexts_list_address()); 3143 updating_visitor.VisitPointer(heap_->global_contexts_list_address());
3143 3144
3144 heap_->symbol_table()->Iterate(&updating_visitor); 3145 heap_->symbol_table()->Iterate(&updating_visitor);
3145 3146
3146 // Update pointers from external string table. 3147 // Update pointers from external string table.
3147 heap_->UpdateReferencesInExternalStringTable( 3148 heap_->UpdateReferencesInExternalStringTable(
3148 &UpdateReferenceInExternalStringTableEntry); 3149 &UpdateReferenceInExternalStringTableEntry);
3149 3150
3150 // Update JSFunction pointers from the runtime profiler.
3151 heap()->isolate()->runtime_profiler()->UpdateSamplesAfterCompact(
3152 &updating_visitor);
3153
3154 EvacuationWeakObjectRetainer evacuation_object_retainer; 3151 EvacuationWeakObjectRetainer evacuation_object_retainer;
3155 heap()->ProcessWeakReferences(&evacuation_object_retainer); 3152 heap()->ProcessWeakReferences(&evacuation_object_retainer);
3156 3153
3157 // Visit invalidated code (we ignored all slots on it) and clear mark-bits 3154 // Visit invalidated code (we ignored all slots on it) and clear mark-bits
3158 // under it. 3155 // under it.
3159 ProcessInvalidatedCode(&updating_visitor); 3156 ProcessInvalidatedCode(&updating_visitor);
3160 3157
3161 #ifdef DEBUG 3158 #ifdef DEBUG
3162 if (FLAG_verify_heap) { 3159 if (FLAG_verify_heap) {
3163 VerifyEvacuation(heap_); 3160 VerifyEvacuation(heap_);
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
3867 while (buffer != NULL) { 3864 while (buffer != NULL) {
3868 SlotsBuffer* next_buffer = buffer->next(); 3865 SlotsBuffer* next_buffer = buffer->next();
3869 DeallocateBuffer(buffer); 3866 DeallocateBuffer(buffer);
3870 buffer = next_buffer; 3867 buffer = next_buffer;
3871 } 3868 }
3872 *buffer_address = NULL; 3869 *buffer_address = NULL;
3873 } 3870 }
3874 3871
3875 3872
3876 } } // namespace v8::internal 3873 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698