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

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

Issue 16773002: Add tracing for functions processed by code flushing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Hannes Payer. 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 984 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 JSFunction* next_candidate; 995 JSFunction* next_candidate;
996 while (candidate != NULL) { 996 while (candidate != NULL) {
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()) {
1006 SmartArrayPointer<char> name = shared->DebugName()->ToCString();
1007 PrintF("[code-flushing clears: %s]\n", *name);
1008 }
1005 shared->set_code(lazy_compile); 1009 shared->set_code(lazy_compile);
1006 candidate->set_code(lazy_compile); 1010 candidate->set_code(lazy_compile);
1007 } else { 1011 } else {
1008 candidate->set_code(code); 1012 candidate->set_code(code);
1009 } 1013 }
1010 1014
1011 // We are in the middle of a GC cycle so the write barrier in the code 1015 // We are in the middle of a GC cycle so the write barrier in the code
1012 // setter did not record the slot update and we have to do that manually. 1016 // setter did not record the slot update and we have to do that manually.
1013 Address slot = candidate->address() + JSFunction::kCodeEntryOffset; 1017 Address slot = candidate->address() + JSFunction::kCodeEntryOffset;
1014 Code* target = Code::cast(Code::GetObjectFromEntryAddress(slot)); 1018 Code* target = Code::cast(Code::GetObjectFromEntryAddress(slot));
(...skipping 17 matching lines...) Expand all
1032 1036
1033 SharedFunctionInfo* candidate = shared_function_info_candidates_head_; 1037 SharedFunctionInfo* candidate = shared_function_info_candidates_head_;
1034 SharedFunctionInfo* next_candidate; 1038 SharedFunctionInfo* next_candidate;
1035 while (candidate != NULL) { 1039 while (candidate != NULL) {
1036 next_candidate = GetNextCandidate(candidate); 1040 next_candidate = GetNextCandidate(candidate);
1037 ClearNextCandidate(candidate); 1041 ClearNextCandidate(candidate);
1038 1042
1039 Code* code = candidate->code(); 1043 Code* code = candidate->code();
1040 MarkBit code_mark = Marking::MarkBitFrom(code); 1044 MarkBit code_mark = Marking::MarkBitFrom(code);
1041 if (!code_mark.Get()) { 1045 if (!code_mark.Get()) {
1046 if (FLAG_trace_code_flushing && candidate->is_compiled()) {
1047 SmartArrayPointer<char> name = candidate->DebugName()->ToCString();
1048 PrintF("[code-flushing clears: %s]\n", *name);
1049 }
1042 candidate->set_code(lazy_compile); 1050 candidate->set_code(lazy_compile);
1043 } 1051 }
1044 1052
1045 Object** code_slot = 1053 Object** code_slot =
1046 HeapObject::RawField(candidate, SharedFunctionInfo::kCodeOffset); 1054 HeapObject::RawField(candidate, SharedFunctionInfo::kCodeOffset);
1047 isolate_->heap()->mark_compact_collector()-> 1055 isolate_->heap()->mark_compact_collector()->
1048 RecordSlot(code_slot, code_slot, *code_slot); 1056 RecordSlot(code_slot, code_slot, *code_slot);
1049 1057
1050 candidate = next_candidate; 1058 candidate = next_candidate;
1051 } 1059 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 } 1123 }
1116 1124
1117 optimized_code_map_holder_head_ = NULL; 1125 optimized_code_map_holder_head_ = NULL;
1118 } 1126 }
1119 1127
1120 1128
1121 void CodeFlusher::EvictCandidate(SharedFunctionInfo* shared_info) { 1129 void CodeFlusher::EvictCandidate(SharedFunctionInfo* shared_info) {
1122 // Make sure previous flushing decisions are revisited. 1130 // Make sure previous flushing decisions are revisited.
1123 isolate_->heap()->incremental_marking()->RecordWrites(shared_info); 1131 isolate_->heap()->incremental_marking()->RecordWrites(shared_info);
1124 1132
1133 if (FLAG_trace_code_flushing) {
1134 SmartArrayPointer<char> name = shared_info->DebugName()->ToCString();
1135 PrintF("[code-flushing abandons function-info: %s]\n", *name);
1136 }
1137
1125 SharedFunctionInfo* candidate = shared_function_info_candidates_head_; 1138 SharedFunctionInfo* candidate = shared_function_info_candidates_head_;
1126 SharedFunctionInfo* next_candidate; 1139 SharedFunctionInfo* next_candidate;
1127 if (candidate == shared_info) { 1140 if (candidate == shared_info) {
1128 next_candidate = GetNextCandidate(shared_info); 1141 next_candidate = GetNextCandidate(shared_info);
1129 shared_function_info_candidates_head_ = next_candidate; 1142 shared_function_info_candidates_head_ = next_candidate;
1130 ClearNextCandidate(shared_info); 1143 ClearNextCandidate(shared_info);
1131 } else { 1144 } else {
1132 while (candidate != NULL) { 1145 while (candidate != NULL) {
1133 next_candidate = GetNextCandidate(candidate); 1146 next_candidate = GetNextCandidate(candidate);
1134 1147
(...skipping 11 matching lines...) Expand all
1146 1159
1147 1160
1148 void CodeFlusher::EvictCandidate(JSFunction* function) { 1161 void CodeFlusher::EvictCandidate(JSFunction* function) {
1149 ASSERT(!function->next_function_link()->IsUndefined()); 1162 ASSERT(!function->next_function_link()->IsUndefined());
1150 Object* undefined = isolate_->heap()->undefined_value(); 1163 Object* undefined = isolate_->heap()->undefined_value();
1151 1164
1152 // Make sure previous flushing decisions are revisited. 1165 // Make sure previous flushing decisions are revisited.
1153 isolate_->heap()->incremental_marking()->RecordWrites(function); 1166 isolate_->heap()->incremental_marking()->RecordWrites(function);
1154 isolate_->heap()->incremental_marking()->RecordWrites(function->shared()); 1167 isolate_->heap()->incremental_marking()->RecordWrites(function->shared());
1155 1168
1169 if (FLAG_trace_code_flushing) {
1170 SmartArrayPointer<char> name = function->shared()->DebugName()->ToCString();
1171 PrintF("[code-flushing abandons closure: %s]\n", *name);
1172 }
1173
1156 JSFunction* candidate = jsfunction_candidates_head_; 1174 JSFunction* candidate = jsfunction_candidates_head_;
1157 JSFunction* next_candidate; 1175 JSFunction* next_candidate;
1158 if (candidate == function) { 1176 if (candidate == function) {
1159 next_candidate = GetNextCandidate(function); 1177 next_candidate = GetNextCandidate(function);
1160 jsfunction_candidates_head_ = next_candidate; 1178 jsfunction_candidates_head_ = next_candidate;
1161 ClearNextCandidate(function, undefined); 1179 ClearNextCandidate(function, undefined);
1162 } else { 1180 } else {
1163 while (candidate != NULL) { 1181 while (candidate != NULL) {
1164 next_candidate = GetNextCandidate(candidate); 1182 next_candidate = GetNextCandidate(candidate);
1165 1183
(...skipping 10 matching lines...) Expand all
1176 } 1194 }
1177 1195
1178 1196
1179 void CodeFlusher::EvictOptimizedCodeMap(SharedFunctionInfo* code_map_holder) { 1197 void CodeFlusher::EvictOptimizedCodeMap(SharedFunctionInfo* code_map_holder) {
1180 ASSERT(!FixedArray::cast(code_map_holder->optimized_code_map())-> 1198 ASSERT(!FixedArray::cast(code_map_holder->optimized_code_map())->
1181 get(SharedFunctionInfo::kNextMapIndex)->IsUndefined()); 1199 get(SharedFunctionInfo::kNextMapIndex)->IsUndefined());
1182 1200
1183 // Make sure previous flushing decisions are revisited. 1201 // Make sure previous flushing decisions are revisited.
1184 isolate_->heap()->incremental_marking()->RecordWrites(code_map_holder); 1202 isolate_->heap()->incremental_marking()->RecordWrites(code_map_holder);
1185 1203
1204 if (FLAG_trace_code_flushing) {
1205 SmartArrayPointer<char> name = code_map_holder->DebugName()->ToCString();
1206 PrintF("[code-flushing abandons code-map: %s]\n", *name);
1207 }
1208
1186 SharedFunctionInfo* holder = optimized_code_map_holder_head_; 1209 SharedFunctionInfo* holder = optimized_code_map_holder_head_;
1187 SharedFunctionInfo* next_holder; 1210 SharedFunctionInfo* next_holder;
1188 if (holder == code_map_holder) { 1211 if (holder == code_map_holder) {
1189 next_holder = GetNextCodeMap(code_map_holder); 1212 next_holder = GetNextCodeMap(code_map_holder);
1190 optimized_code_map_holder_head_ = next_holder; 1213 optimized_code_map_holder_head_ = next_holder;
1191 ClearNextCodeMap(code_map_holder); 1214 ClearNextCodeMap(code_map_holder);
1192 } else { 1215 } else {
1193 while (holder != NULL) { 1216 while (holder != NULL) {
1194 next_holder = GetNextCodeMap(holder); 1217 next_holder = GetNextCodeMap(holder);
1195 1218
(...skipping 3048 matching lines...) Expand 10 before | Expand all | Expand 10 after
4244 while (buffer != NULL) { 4267 while (buffer != NULL) {
4245 SlotsBuffer* next_buffer = buffer->next(); 4268 SlotsBuffer* next_buffer = buffer->next();
4246 DeallocateBuffer(buffer); 4269 DeallocateBuffer(buffer);
4247 buffer = next_buffer; 4270 buffer = next_buffer;
4248 } 4271 }
4249 *buffer_address = NULL; 4272 *buffer_address = NULL;
4250 } 4273 }
4251 4274
4252 4275
4253 } } // namespace v8::internal 4276 } } // 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