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 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
997 next_candidate = GetNextCandidate(candidate); | 997 next_candidate = GetNextCandidate(candidate); |
998 ClearNextCandidate(candidate, undefined); | 998 ClearNextCandidate(candidate, undefined); |
999 | 999 |
1000 SharedFunctionInfo* shared = candidate->shared(); | 1000 SharedFunctionInfo* shared = candidate->shared(); |
1001 | 1001 |
1002 Code* code = shared->code(); | 1002 Code* code = shared->code(); |
1003 MarkBit code_mark = Marking::MarkBitFrom(code); | 1003 MarkBit code_mark = Marking::MarkBitFrom(code); |
1004 if (!code_mark.Get()) { | 1004 if (!code_mark.Get()) { |
1005 if (FLAG_trace_code_flushing && shared->is_compiled()) { | 1005 if (FLAG_trace_code_flushing && shared->is_compiled()) { |
1006 SmartArrayPointer<char> name = shared->DebugName()->ToCString(); | 1006 SmartArrayPointer<char> name = shared->DebugName()->ToCString(); |
1007 PrintF("[code-flushing clears: %s]\n", *name); | 1007 int age = FLAG_age_code ? code->GetAge() : shared->code_age(); |
1008 PrintF("[code-flushing clears: %s - age: %d]\n", *name, age); | |
Michael Starzinger
2013/06/11 17:30:07
Won't this age be constant since we at a certain a
Hannes Payer (out of office)
2013/06/12 08:56:32
True, an assert is more appropriate.
| |
1008 } | 1009 } |
1009 shared->set_code(lazy_compile); | 1010 shared->set_code(lazy_compile); |
1010 candidate->set_code(lazy_compile); | 1011 candidate->set_code(lazy_compile); |
1011 } else { | 1012 } else { |
1012 candidate->set_code(code); | 1013 candidate->set_code(code); |
1013 } | 1014 } |
1014 | 1015 |
1015 // We are in the middle of a GC cycle so the write barrier in the code | 1016 // We are in the middle of a GC cycle so the write barrier in the code |
1016 // setter did not record the slot update and we have to do that manually. | 1017 // setter did not record the slot update and we have to do that manually. |
1017 Address slot = candidate->address() + JSFunction::kCodeEntryOffset; | 1018 Address slot = candidate->address() + JSFunction::kCodeEntryOffset; |
(...skipping 20 matching lines...) Expand all Loading... | |
1038 SharedFunctionInfo* next_candidate; | 1039 SharedFunctionInfo* next_candidate; |
1039 while (candidate != NULL) { | 1040 while (candidate != NULL) { |
1040 next_candidate = GetNextCandidate(candidate); | 1041 next_candidate = GetNextCandidate(candidate); |
1041 ClearNextCandidate(candidate); | 1042 ClearNextCandidate(candidate); |
1042 | 1043 |
1043 Code* code = candidate->code(); | 1044 Code* code = candidate->code(); |
1044 MarkBit code_mark = Marking::MarkBitFrom(code); | 1045 MarkBit code_mark = Marking::MarkBitFrom(code); |
1045 if (!code_mark.Get()) { | 1046 if (!code_mark.Get()) { |
1046 if (FLAG_trace_code_flushing && candidate->is_compiled()) { | 1047 if (FLAG_trace_code_flushing && candidate->is_compiled()) { |
1047 SmartArrayPointer<char> name = candidate->DebugName()->ToCString(); | 1048 SmartArrayPointer<char> name = candidate->DebugName()->ToCString(); |
1048 PrintF("[code-flushing clears: %s]\n", *name); | 1049 int age = FLAG_age_code ? code->GetAge() : candidate->code_age(); |
1050 PrintF("[code-flushing clears: %s - age: %d]\n", *name, age); | |
1049 } | 1051 } |
1050 candidate->set_code(lazy_compile); | 1052 candidate->set_code(lazy_compile); |
1051 } | 1053 } |
1052 | 1054 |
1053 Object** code_slot = | 1055 Object** code_slot = |
1054 HeapObject::RawField(candidate, SharedFunctionInfo::kCodeOffset); | 1056 HeapObject::RawField(candidate, SharedFunctionInfo::kCodeOffset); |
1055 isolate_->heap()->mark_compact_collector()-> | 1057 isolate_->heap()->mark_compact_collector()-> |
1056 RecordSlot(code_slot, code_slot, *code_slot); | 1058 RecordSlot(code_slot, code_slot, *code_slot); |
1057 | 1059 |
1058 candidate = next_candidate; | 1060 candidate = next_candidate; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1125 optimized_code_map_holder_head_ = NULL; | 1127 optimized_code_map_holder_head_ = NULL; |
1126 } | 1128 } |
1127 | 1129 |
1128 | 1130 |
1129 void CodeFlusher::EvictCandidate(SharedFunctionInfo* shared_info) { | 1131 void CodeFlusher::EvictCandidate(SharedFunctionInfo* shared_info) { |
1130 // Make sure previous flushing decisions are revisited. | 1132 // Make sure previous flushing decisions are revisited. |
1131 isolate_->heap()->incremental_marking()->RecordWrites(shared_info); | 1133 isolate_->heap()->incremental_marking()->RecordWrites(shared_info); |
1132 | 1134 |
1133 if (FLAG_trace_code_flushing) { | 1135 if (FLAG_trace_code_flushing) { |
1134 SmartArrayPointer<char> name = shared_info->DebugName()->ToCString(); | 1136 SmartArrayPointer<char> name = shared_info->DebugName()->ToCString(); |
1135 PrintF("[code-flushing abandons function-info: %s]\n", *name); | 1137 int age = FLAG_age_code ? |
1138 shared_info->code()->GetAge() : shared_info->code_age(); | |
1139 PrintF("[code-flushing abandons function-info: %s - age: %d]\n", | |
1140 *name, age); | |
1136 } | 1141 } |
1137 | 1142 |
1138 SharedFunctionInfo* candidate = shared_function_info_candidates_head_; | 1143 SharedFunctionInfo* candidate = shared_function_info_candidates_head_; |
1139 SharedFunctionInfo* next_candidate; | 1144 SharedFunctionInfo* next_candidate; |
1140 if (candidate == shared_info) { | 1145 if (candidate == shared_info) { |
1141 next_candidate = GetNextCandidate(shared_info); | 1146 next_candidate = GetNextCandidate(shared_info); |
1142 shared_function_info_candidates_head_ = next_candidate; | 1147 shared_function_info_candidates_head_ = next_candidate; |
1143 ClearNextCandidate(shared_info); | 1148 ClearNextCandidate(shared_info); |
1144 } else { | 1149 } else { |
1145 while (candidate != NULL) { | 1150 while (candidate != NULL) { |
(...skipping 15 matching lines...) Expand all Loading... | |
1161 void CodeFlusher::EvictCandidate(JSFunction* function) { | 1166 void CodeFlusher::EvictCandidate(JSFunction* function) { |
1162 ASSERT(!function->next_function_link()->IsUndefined()); | 1167 ASSERT(!function->next_function_link()->IsUndefined()); |
1163 Object* undefined = isolate_->heap()->undefined_value(); | 1168 Object* undefined = isolate_->heap()->undefined_value(); |
1164 | 1169 |
1165 // Make sure previous flushing decisions are revisited. | 1170 // Make sure previous flushing decisions are revisited. |
1166 isolate_->heap()->incremental_marking()->RecordWrites(function); | 1171 isolate_->heap()->incremental_marking()->RecordWrites(function); |
1167 isolate_->heap()->incremental_marking()->RecordWrites(function->shared()); | 1172 isolate_->heap()->incremental_marking()->RecordWrites(function->shared()); |
1168 | 1173 |
1169 if (FLAG_trace_code_flushing) { | 1174 if (FLAG_trace_code_flushing) { |
1170 SmartArrayPointer<char> name = function->shared()->DebugName()->ToCString(); | 1175 SmartArrayPointer<char> name = function->shared()->DebugName()->ToCString(); |
1171 PrintF("[code-flushing abandons closure: %s]\n", *name); | 1176 int age = FLAG_age_code ? |
1177 function->shared()->code()->GetAge() : function->shared()->code_age(); | |
1178 PrintF("[code-flushing abandons closure: %s - age: %d]\n", *name, age); | |
1172 } | 1179 } |
1173 | 1180 |
1174 JSFunction* candidate = jsfunction_candidates_head_; | 1181 JSFunction* candidate = jsfunction_candidates_head_; |
1175 JSFunction* next_candidate; | 1182 JSFunction* next_candidate; |
1176 if (candidate == function) { | 1183 if (candidate == function) { |
1177 next_candidate = GetNextCandidate(function); | 1184 next_candidate = GetNextCandidate(function); |
1178 jsfunction_candidates_head_ = next_candidate; | 1185 jsfunction_candidates_head_ = next_candidate; |
1179 ClearNextCandidate(function, undefined); | 1186 ClearNextCandidate(function, undefined); |
1180 } else { | 1187 } else { |
1181 while (candidate != NULL) { | 1188 while (candidate != NULL) { |
(...skipping 3083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4265 while (buffer != NULL) { | 4272 while (buffer != NULL) { |
4266 SlotsBuffer* next_buffer = buffer->next(); | 4273 SlotsBuffer* next_buffer = buffer->next(); |
4267 DeallocateBuffer(buffer); | 4274 DeallocateBuffer(buffer); |
4268 buffer = next_buffer; | 4275 buffer = next_buffer; |
4269 } | 4276 } |
4270 *buffer_address = NULL; | 4277 *buffer_address = NULL; |
4271 } | 4278 } |
4272 | 4279 |
4273 | 4280 |
4274 } } // namespace v8::internal | 4281 } } // namespace v8::internal |
OLD | NEW |