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

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

Issue 17059007: Make --trace-code-flushing uniform with other tracing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | « no previous file | 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 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 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 while (candidate != NULL) { 1003 while (candidate != NULL) {
1004 next_candidate = GetNextCandidate(candidate); 1004 next_candidate = GetNextCandidate(candidate);
1005 ClearNextCandidate(candidate, undefined); 1005 ClearNextCandidate(candidate, undefined);
1006 1006
1007 SharedFunctionInfo* shared = candidate->shared(); 1007 SharedFunctionInfo* shared = candidate->shared();
1008 1008
1009 Code* code = shared->code(); 1009 Code* code = shared->code();
1010 MarkBit code_mark = Marking::MarkBitFrom(code); 1010 MarkBit code_mark = Marking::MarkBitFrom(code);
1011 if (!code_mark.Get()) { 1011 if (!code_mark.Get()) {
1012 if (FLAG_trace_code_flushing && shared->is_compiled()) { 1012 if (FLAG_trace_code_flushing && shared->is_compiled()) {
1013 SmartArrayPointer<char> name = shared->DebugName()->ToCString(); 1013 PrintF("[code-flushing clears: ");
1014 PrintF("[code-flushing clears: %s - age: %d]\n", *name, code->GetAge()); 1014 shared->ShortPrint();
1015 PrintF(" - age: %d]\n", code->GetAge());
1015 } 1016 }
1016 shared->set_code(lazy_compile); 1017 shared->set_code(lazy_compile);
1017 candidate->set_code(lazy_compile); 1018 candidate->set_code(lazy_compile);
1018 } else { 1019 } else {
1019 candidate->set_code(code); 1020 candidate->set_code(code);
1020 } 1021 }
1021 1022
1022 // We are in the middle of a GC cycle so the write barrier in the code 1023 // We are in the middle of a GC cycle so the write barrier in the code
1023 // setter did not record the slot update and we have to do that manually. 1024 // setter did not record the slot update and we have to do that manually.
1024 Address slot = candidate->address() + JSFunction::kCodeEntryOffset; 1025 Address slot = candidate->address() + JSFunction::kCodeEntryOffset;
(...skipping 19 matching lines...) Expand all
1044 SharedFunctionInfo* candidate = shared_function_info_candidates_head_; 1045 SharedFunctionInfo* candidate = shared_function_info_candidates_head_;
1045 SharedFunctionInfo* next_candidate; 1046 SharedFunctionInfo* next_candidate;
1046 while (candidate != NULL) { 1047 while (candidate != NULL) {
1047 next_candidate = GetNextCandidate(candidate); 1048 next_candidate = GetNextCandidate(candidate);
1048 ClearNextCandidate(candidate); 1049 ClearNextCandidate(candidate);
1049 1050
1050 Code* code = candidate->code(); 1051 Code* code = candidate->code();
1051 MarkBit code_mark = Marking::MarkBitFrom(code); 1052 MarkBit code_mark = Marking::MarkBitFrom(code);
1052 if (!code_mark.Get()) { 1053 if (!code_mark.Get()) {
1053 if (FLAG_trace_code_flushing && candidate->is_compiled()) { 1054 if (FLAG_trace_code_flushing && candidate->is_compiled()) {
1054 SmartArrayPointer<char> name = candidate->DebugName()->ToCString(); 1055 PrintF("[code-flushing clears: ");
1055 PrintF("[code-flushing clears: %s - age: %d]\n", *name, code->GetAge()); 1056 candidate->ShortPrint();
1057 PrintF(" - age: %d]\n", code->GetAge());
1056 } 1058 }
1057 candidate->set_code(lazy_compile); 1059 candidate->set_code(lazy_compile);
1058 } 1060 }
1059 1061
1060 Object** code_slot = 1062 Object** code_slot =
1061 HeapObject::RawField(candidate, SharedFunctionInfo::kCodeOffset); 1063 HeapObject::RawField(candidate, SharedFunctionInfo::kCodeOffset);
1062 isolate_->heap()->mark_compact_collector()-> 1064 isolate_->heap()->mark_compact_collector()->
1063 RecordSlot(code_slot, code_slot, *code_slot); 1065 RecordSlot(code_slot, code_slot, *code_slot);
1064 1066
1065 candidate = next_candidate; 1067 candidate = next_candidate;
(...skipping 20 matching lines...) Expand all
1086 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); 1088 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map());
1087 int new_length = kEntriesStart; 1089 int new_length = kEntriesStart;
1088 int old_length = code_map->length(); 1090 int old_length = code_map->length();
1089 for (int i = kEntriesStart; i < old_length; i += kEntryLength) { 1091 for (int i = kEntriesStart; i < old_length; i += kEntryLength) {
1090 Code* code = Code::cast(code_map->get(i + kCodeOffset)); 1092 Code* code = Code::cast(code_map->get(i + kCodeOffset));
1091 MarkBit code_mark = Marking::MarkBitFrom(code); 1093 MarkBit code_mark = Marking::MarkBitFrom(code);
1092 if (!code_mark.Get()) { 1094 if (!code_mark.Get()) {
1093 continue; 1095 continue;
1094 } 1096 }
1095 1097
1096 // Update and record the context slot in the optimizled code map. 1098 // Update and record the context slot in the optimized code map.
1097 Object** context_slot = HeapObject::RawField(code_map, 1099 Object** context_slot = HeapObject::RawField(code_map,
1098 FixedArray::OffsetOfElementAt(new_length)); 1100 FixedArray::OffsetOfElementAt(new_length));
1099 code_map->set(new_length++, code_map->get(i + kContextOffset)); 1101 code_map->set(new_length++, code_map->get(i + kContextOffset));
1100 ASSERT(Marking::IsBlack( 1102 ASSERT(Marking::IsBlack(
1101 Marking::MarkBitFrom(HeapObject::cast(*context_slot)))); 1103 Marking::MarkBitFrom(HeapObject::cast(*context_slot))));
1102 isolate_->heap()->mark_compact_collector()-> 1104 isolate_->heap()->mark_compact_collector()->
1103 RecordSlot(context_slot, context_slot, *context_slot); 1105 RecordSlot(context_slot, context_slot, *context_slot);
1104 1106
1105 // Update and record the code slot in the optimized code map. 1107 // Update and record the code slot in the optimized code map.
1106 Object** code_slot = HeapObject::RawField(code_map, 1108 Object** code_slot = HeapObject::RawField(code_map,
(...skipping 24 matching lines...) Expand all
1131 1133
1132 optimized_code_map_holder_head_ = NULL; 1134 optimized_code_map_holder_head_ = NULL;
1133 } 1135 }
1134 1136
1135 1137
1136 void CodeFlusher::EvictCandidate(SharedFunctionInfo* shared_info) { 1138 void CodeFlusher::EvictCandidate(SharedFunctionInfo* shared_info) {
1137 // Make sure previous flushing decisions are revisited. 1139 // Make sure previous flushing decisions are revisited.
1138 isolate_->heap()->incremental_marking()->RecordWrites(shared_info); 1140 isolate_->heap()->incremental_marking()->RecordWrites(shared_info);
1139 1141
1140 if (FLAG_trace_code_flushing) { 1142 if (FLAG_trace_code_flushing) {
1141 SmartArrayPointer<char> name = shared_info->DebugName()->ToCString(); 1143 PrintF("[code-flushing abandons function-info: ");
1142 PrintF("[code-flushing abandons function-info: %s]\n", *name); 1144 shared_info->ShortPrint();
1145 PrintF("]\n");
1143 } 1146 }
1144 1147
1145 SharedFunctionInfo* candidate = shared_function_info_candidates_head_; 1148 SharedFunctionInfo* candidate = shared_function_info_candidates_head_;
1146 SharedFunctionInfo* next_candidate; 1149 SharedFunctionInfo* next_candidate;
1147 if (candidate == shared_info) { 1150 if (candidate == shared_info) {
1148 next_candidate = GetNextCandidate(shared_info); 1151 next_candidate = GetNextCandidate(shared_info);
1149 shared_function_info_candidates_head_ = next_candidate; 1152 shared_function_info_candidates_head_ = next_candidate;
1150 ClearNextCandidate(shared_info); 1153 ClearNextCandidate(shared_info);
1151 } else { 1154 } else {
1152 while (candidate != NULL) { 1155 while (candidate != NULL) {
(...skipping 14 matching lines...) Expand all
1167 1170
1168 void CodeFlusher::EvictCandidate(JSFunction* function) { 1171 void CodeFlusher::EvictCandidate(JSFunction* function) {
1169 ASSERT(!function->next_function_link()->IsUndefined()); 1172 ASSERT(!function->next_function_link()->IsUndefined());
1170 Object* undefined = isolate_->heap()->undefined_value(); 1173 Object* undefined = isolate_->heap()->undefined_value();
1171 1174
1172 // Make sure previous flushing decisions are revisited. 1175 // Make sure previous flushing decisions are revisited.
1173 isolate_->heap()->incremental_marking()->RecordWrites(function); 1176 isolate_->heap()->incremental_marking()->RecordWrites(function);
1174 isolate_->heap()->incremental_marking()->RecordWrites(function->shared()); 1177 isolate_->heap()->incremental_marking()->RecordWrites(function->shared());
1175 1178
1176 if (FLAG_trace_code_flushing) { 1179 if (FLAG_trace_code_flushing) {
1177 SmartArrayPointer<char> name = function->shared()->DebugName()->ToCString(); 1180 PrintF("[code-flushing abandons closure: ");
1178 PrintF("[code-flushing abandons closure: %s]\n", *name); 1181 function->shared()->ShortPrint();
1182 PrintF("]\n");
1179 } 1183 }
1180 1184
1181 JSFunction* candidate = jsfunction_candidates_head_; 1185 JSFunction* candidate = jsfunction_candidates_head_;
1182 JSFunction* next_candidate; 1186 JSFunction* next_candidate;
1183 if (candidate == function) { 1187 if (candidate == function) {
1184 next_candidate = GetNextCandidate(function); 1188 next_candidate = GetNextCandidate(function);
1185 jsfunction_candidates_head_ = next_candidate; 1189 jsfunction_candidates_head_ = next_candidate;
1186 ClearNextCandidate(function, undefined); 1190 ClearNextCandidate(function, undefined);
1187 } else { 1191 } else {
1188 while (candidate != NULL) { 1192 while (candidate != NULL) {
(...skipping 13 matching lines...) Expand all
1202 1206
1203 1207
1204 void CodeFlusher::EvictOptimizedCodeMap(SharedFunctionInfo* code_map_holder) { 1208 void CodeFlusher::EvictOptimizedCodeMap(SharedFunctionInfo* code_map_holder) {
1205 ASSERT(!FixedArray::cast(code_map_holder->optimized_code_map())-> 1209 ASSERT(!FixedArray::cast(code_map_holder->optimized_code_map())->
1206 get(SharedFunctionInfo::kNextMapIndex)->IsUndefined()); 1210 get(SharedFunctionInfo::kNextMapIndex)->IsUndefined());
1207 1211
1208 // Make sure previous flushing decisions are revisited. 1212 // Make sure previous flushing decisions are revisited.
1209 isolate_->heap()->incremental_marking()->RecordWrites(code_map_holder); 1213 isolate_->heap()->incremental_marking()->RecordWrites(code_map_holder);
1210 1214
1211 if (FLAG_trace_code_flushing) { 1215 if (FLAG_trace_code_flushing) {
1212 SmartArrayPointer<char> name = code_map_holder->DebugName()->ToCString(); 1216 PrintF("[code-flushing abandons code-map: ");
1213 PrintF("[code-flushing abandons code-map: %s]\n", *name); 1217 code_map_holder->ShortPrint();
1218 PrintF("]\n");
1214 } 1219 }
1215 1220
1216 SharedFunctionInfo* holder = optimized_code_map_holder_head_; 1221 SharedFunctionInfo* holder = optimized_code_map_holder_head_;
1217 SharedFunctionInfo* next_holder; 1222 SharedFunctionInfo* next_holder;
1218 if (holder == code_map_holder) { 1223 if (holder == code_map_holder) {
1219 next_holder = GetNextCodeMap(code_map_holder); 1224 next_holder = GetNextCodeMap(code_map_holder);
1220 optimized_code_map_holder_head_ = next_holder; 1225 optimized_code_map_holder_head_ = next_holder;
1221 ClearNextCodeMap(code_map_holder); 1226 ClearNextCodeMap(code_map_holder);
1222 } else { 1227 } else {
1223 while (holder != NULL) { 1228 while (holder != NULL) {
(...skipping 3086 matching lines...) Expand 10 before | Expand all | Expand 10 after
4310 while (buffer != NULL) { 4315 while (buffer != NULL) {
4311 SlotsBuffer* next_buffer = buffer->next(); 4316 SlotsBuffer* next_buffer = buffer->next();
4312 DeallocateBuffer(buffer); 4317 DeallocateBuffer(buffer);
4313 buffer = next_buffer; 4318 buffer = next_buffer;
4314 } 4319 }
4315 *buffer_address = NULL; 4320 *buffer_address = NULL;
4316 } 4321 }
4317 4322
4318 4323
4319 } } // namespace v8::internal 4324 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698