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

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

Issue 141363005: A64: Synchronize with r15204. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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/log.cc ('k') | src/mips/OWNERS » ('j') | 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 VerifyMarking(p->area_start(), p->area_end()); 141 VerifyMarking(p->area_start(), p->area_end());
142 } 142 }
143 } 143 }
144 144
145 145
146 static void VerifyMarking(Heap* heap) { 146 static void VerifyMarking(Heap* heap) {
147 VerifyMarking(heap->old_pointer_space()); 147 VerifyMarking(heap->old_pointer_space());
148 VerifyMarking(heap->old_data_space()); 148 VerifyMarking(heap->old_data_space());
149 VerifyMarking(heap->code_space()); 149 VerifyMarking(heap->code_space());
150 VerifyMarking(heap->cell_space()); 150 VerifyMarking(heap->cell_space());
151 VerifyMarking(heap->property_cell_space());
151 VerifyMarking(heap->map_space()); 152 VerifyMarking(heap->map_space());
152 VerifyMarking(heap->new_space()); 153 VerifyMarking(heap->new_space());
153 154
154 VerifyMarkingVisitor visitor; 155 VerifyMarkingVisitor visitor;
155 156
156 LargeObjectIterator it(heap->lo_space()); 157 LargeObjectIterator it(heap->lo_space());
157 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { 158 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) {
158 if (MarkCompactCollector::IsMarked(obj)) { 159 if (MarkCompactCollector::IsMarked(obj)) {
159 obj->Iterate(&visitor); 160 obj->Iterate(&visitor);
160 } 161 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 VerifyEvacuation(p->area_start(), p->area_end()); 223 VerifyEvacuation(p->area_start(), p->area_end());
223 } 224 }
224 } 225 }
225 226
226 227
227 static void VerifyEvacuation(Heap* heap) { 228 static void VerifyEvacuation(Heap* heap) {
228 VerifyEvacuation(heap->old_pointer_space()); 229 VerifyEvacuation(heap->old_pointer_space());
229 VerifyEvacuation(heap->old_data_space()); 230 VerifyEvacuation(heap->old_data_space());
230 VerifyEvacuation(heap->code_space()); 231 VerifyEvacuation(heap->code_space());
231 VerifyEvacuation(heap->cell_space()); 232 VerifyEvacuation(heap->cell_space());
233 VerifyEvacuation(heap->property_cell_space());
232 VerifyEvacuation(heap->map_space()); 234 VerifyEvacuation(heap->map_space());
233 VerifyEvacuation(heap->new_space()); 235 VerifyEvacuation(heap->new_space());
234 236
235 VerifyEvacuationVisitor visitor; 237 VerifyEvacuationVisitor visitor;
236 heap->IterateStrongRoots(&visitor, VISIT_ALL); 238 heap->IterateStrongRoots(&visitor, VISIT_ALL);
237 } 239 }
238 #endif // VERIFY_HEAP 240 #endif // VERIFY_HEAP
239 241
240 242
241 #ifdef DEBUG 243 #ifdef DEBUG
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 FixedArray* array = FixedArray::cast(object); 278 FixedArray* array = FixedArray::cast(object);
277 int length = array->length(); 279 int length = array->length();
278 // Set array length to zero to prevent cycles while iterating 280 // Set array length to zero to prevent cycles while iterating
279 // over array bodies, this is easier than intrusive marking. 281 // over array bodies, this is easier than intrusive marking.
280 array->set_length(0); 282 array->set_length(0);
281 array->IterateBody( 283 array->IterateBody(
282 FIXED_ARRAY_TYPE, FixedArray::SizeFor(length), this); 284 FIXED_ARRAY_TYPE, FixedArray::SizeFor(length), this);
283 array->set_length(length); 285 array->set_length(length);
284 } 286 }
285 break; 287 break;
286 case JS_GLOBAL_PROPERTY_CELL_TYPE: 288 case CELL_TYPE:
287 case JS_PROXY_TYPE: 289 case JS_PROXY_TYPE:
288 case JS_VALUE_TYPE: 290 case JS_VALUE_TYPE:
289 case TYPE_FEEDBACK_INFO_TYPE: 291 case TYPE_FEEDBACK_INFO_TYPE:
290 object->Iterate(this); 292 object->Iterate(this);
291 break; 293 break;
292 case DECLARED_ACCESSOR_INFO_TYPE: 294 case DECLARED_ACCESSOR_INFO_TYPE:
293 case EXECUTABLE_ACCESSOR_INFO_TYPE: 295 case EXECUTABLE_ACCESSOR_INFO_TYPE:
294 case BYTE_ARRAY_TYPE: 296 case BYTE_ARRAY_TYPE:
295 case CALL_HANDLER_INFO_TYPE: 297 case CALL_HANDLER_INFO_TYPE:
296 case CODE_TYPE: 298 case CODE_TYPE:
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 (mode == NON_INCREMENTAL_COMPACTION || 370 (mode == NON_INCREMENTAL_COMPACTION ||
369 FLAG_incremental_code_compaction)) { 371 FLAG_incremental_code_compaction)) {
370 CollectEvacuationCandidates(heap()->code_space()); 372 CollectEvacuationCandidates(heap()->code_space());
371 } else if (FLAG_trace_fragmentation) { 373 } else if (FLAG_trace_fragmentation) {
372 TraceFragmentation(heap()->code_space()); 374 TraceFragmentation(heap()->code_space());
373 } 375 }
374 376
375 if (FLAG_trace_fragmentation) { 377 if (FLAG_trace_fragmentation) {
376 TraceFragmentation(heap()->map_space()); 378 TraceFragmentation(heap()->map_space());
377 TraceFragmentation(heap()->cell_space()); 379 TraceFragmentation(heap()->cell_space());
380 TraceFragmentation(heap()->property_cell_space());
378 } 381 }
379 382
380 heap()->old_pointer_space()->EvictEvacuationCandidatesFromFreeLists(); 383 heap()->old_pointer_space()->EvictEvacuationCandidatesFromFreeLists();
381 heap()->old_data_space()->EvictEvacuationCandidatesFromFreeLists(); 384 heap()->old_data_space()->EvictEvacuationCandidatesFromFreeLists();
382 heap()->code_space()->EvictEvacuationCandidatesFromFreeLists(); 385 heap()->code_space()->EvictEvacuationCandidatesFromFreeLists();
383 386
384 compacting_ = evacuation_candidates_.length() > 0; 387 compacting_ = evacuation_candidates_.length() > 0;
385 } 388 }
386 389
387 return compacting_; 390 return compacting_;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 CHECK_EQ(0, p->LiveBytes()); 464 CHECK_EQ(0, p->LiveBytes());
462 } 465 }
463 } 466 }
464 467
465 468
466 void MarkCompactCollector::VerifyMarkbitsAreClean() { 469 void MarkCompactCollector::VerifyMarkbitsAreClean() {
467 VerifyMarkbitsAreClean(heap_->old_pointer_space()); 470 VerifyMarkbitsAreClean(heap_->old_pointer_space());
468 VerifyMarkbitsAreClean(heap_->old_data_space()); 471 VerifyMarkbitsAreClean(heap_->old_data_space());
469 VerifyMarkbitsAreClean(heap_->code_space()); 472 VerifyMarkbitsAreClean(heap_->code_space());
470 VerifyMarkbitsAreClean(heap_->cell_space()); 473 VerifyMarkbitsAreClean(heap_->cell_space());
474 VerifyMarkbitsAreClean(heap_->property_cell_space());
471 VerifyMarkbitsAreClean(heap_->map_space()); 475 VerifyMarkbitsAreClean(heap_->map_space());
472 VerifyMarkbitsAreClean(heap_->new_space()); 476 VerifyMarkbitsAreClean(heap_->new_space());
473 477
474 LargeObjectIterator it(heap_->lo_space()); 478 LargeObjectIterator it(heap_->lo_space());
475 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { 479 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) {
476 MarkBit mark_bit = Marking::MarkBitFrom(obj); 480 MarkBit mark_bit = Marking::MarkBitFrom(obj);
477 CHECK(Marking::IsWhite(mark_bit)); 481 CHECK(Marking::IsWhite(mark_bit));
478 CHECK_EQ(0, Page::FromAddress(obj->address())->LiveBytes()); 482 CHECK_EQ(0, Page::FromAddress(obj->address())->LiveBytes());
479 } 483 }
480 } 484 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 } 526 }
523 } 527 }
524 528
525 529
526 void MarkCompactCollector::ClearMarkbits() { 530 void MarkCompactCollector::ClearMarkbits() {
527 ClearMarkbitsInPagedSpace(heap_->code_space()); 531 ClearMarkbitsInPagedSpace(heap_->code_space());
528 ClearMarkbitsInPagedSpace(heap_->map_space()); 532 ClearMarkbitsInPagedSpace(heap_->map_space());
529 ClearMarkbitsInPagedSpace(heap_->old_pointer_space()); 533 ClearMarkbitsInPagedSpace(heap_->old_pointer_space());
530 ClearMarkbitsInPagedSpace(heap_->old_data_space()); 534 ClearMarkbitsInPagedSpace(heap_->old_data_space());
531 ClearMarkbitsInPagedSpace(heap_->cell_space()); 535 ClearMarkbitsInPagedSpace(heap_->cell_space());
536 ClearMarkbitsInPagedSpace(heap_->property_cell_space());
532 ClearMarkbitsInNewSpace(heap_->new_space()); 537 ClearMarkbitsInNewSpace(heap_->new_space());
533 538
534 LargeObjectIterator it(heap_->lo_space()); 539 LargeObjectIterator it(heap_->lo_space());
535 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { 540 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) {
536 MarkBit mark_bit = Marking::MarkBitFrom(obj); 541 MarkBit mark_bit = Marking::MarkBitFrom(obj);
537 mark_bit.Clear(); 542 mark_bit.Clear();
538 mark_bit.Next().Clear(); 543 mark_bit.Next().Clear();
539 Page::FromAddress(obj->address())->ResetProgressBar(); 544 Page::FromAddress(obj->address())->ResetProgressBar();
540 Page::FromAddress(obj->address())->ResetLiveBytes(); 545 Page::FromAddress(obj->address())->ResetLiveBytes();
541 } 546 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 646
642 647
643 const char* AllocationSpaceName(AllocationSpace space) { 648 const char* AllocationSpaceName(AllocationSpace space) {
644 switch (space) { 649 switch (space) {
645 case NEW_SPACE: return "NEW_SPACE"; 650 case NEW_SPACE: return "NEW_SPACE";
646 case OLD_POINTER_SPACE: return "OLD_POINTER_SPACE"; 651 case OLD_POINTER_SPACE: return "OLD_POINTER_SPACE";
647 case OLD_DATA_SPACE: return "OLD_DATA_SPACE"; 652 case OLD_DATA_SPACE: return "OLD_DATA_SPACE";
648 case CODE_SPACE: return "CODE_SPACE"; 653 case CODE_SPACE: return "CODE_SPACE";
649 case MAP_SPACE: return "MAP_SPACE"; 654 case MAP_SPACE: return "MAP_SPACE";
650 case CELL_SPACE: return "CELL_SPACE"; 655 case CELL_SPACE: return "CELL_SPACE";
656 case PROPERTY_CELL_SPACE:
657 return "PROPERTY_CELL_SPACE";
651 case LO_SPACE: return "LO_SPACE"; 658 case LO_SPACE: return "LO_SPACE";
652 default: 659 default:
653 UNREACHABLE(); 660 UNREACHABLE();
654 } 661 }
655 662
656 return NULL; 663 return NULL;
657 } 664 }
658 665
659 666
660 // Returns zero for pages that have so little fragmentation that it is not 667 // Returns zero for pages that have so little fragmentation that it is not
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 while (candidate != NULL) { 1003 while (candidate != NULL) {
997 next_candidate = GetNextCandidate(candidate); 1004 next_candidate = GetNextCandidate(candidate);
998 ClearNextCandidate(candidate, undefined); 1005 ClearNextCandidate(candidate, undefined);
999 1006
1000 SharedFunctionInfo* shared = candidate->shared(); 1007 SharedFunctionInfo* shared = candidate->shared();
1001 1008
1002 Code* code = shared->code(); 1009 Code* code = shared->code();
1003 MarkBit code_mark = Marking::MarkBitFrom(code); 1010 MarkBit code_mark = Marking::MarkBitFrom(code);
1004 if (!code_mark.Get()) { 1011 if (!code_mark.Get()) {
1005 if (FLAG_trace_code_flushing && shared->is_compiled()) { 1012 if (FLAG_trace_code_flushing && shared->is_compiled()) {
1006 SmartArrayPointer<char> name = shared->DebugName()->ToCString(); 1013 PrintF("[code-flushing clears: ");
1007 PrintF("[code-flushing clears: %s]\n", *name); 1014 shared->ShortPrint();
1015 PrintF(" - age: %d]\n", code->GetAge());
1008 } 1016 }
1009 shared->set_code(lazy_compile); 1017 shared->set_code(lazy_compile);
1010 candidate->set_code(lazy_compile); 1018 candidate->set_code(lazy_compile);
1011 } else { 1019 } else {
1012 candidate->set_code(code); 1020 candidate->set_code(code);
1013 } 1021 }
1014 1022
1015 // 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
1016 // 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.
1017 Address slot = candidate->address() + JSFunction::kCodeEntryOffset; 1025 Address slot = candidate->address() + JSFunction::kCodeEntryOffset;
(...skipping 19 matching lines...) Expand all
1037 SharedFunctionInfo* candidate = shared_function_info_candidates_head_; 1045 SharedFunctionInfo* candidate = shared_function_info_candidates_head_;
1038 SharedFunctionInfo* next_candidate; 1046 SharedFunctionInfo* next_candidate;
1039 while (candidate != NULL) { 1047 while (candidate != NULL) {
1040 next_candidate = GetNextCandidate(candidate); 1048 next_candidate = GetNextCandidate(candidate);
1041 ClearNextCandidate(candidate); 1049 ClearNextCandidate(candidate);
1042 1050
1043 Code* code = candidate->code(); 1051 Code* code = candidate->code();
1044 MarkBit code_mark = Marking::MarkBitFrom(code); 1052 MarkBit code_mark = Marking::MarkBitFrom(code);
1045 if (!code_mark.Get()) { 1053 if (!code_mark.Get()) {
1046 if (FLAG_trace_code_flushing && candidate->is_compiled()) { 1054 if (FLAG_trace_code_flushing && candidate->is_compiled()) {
1047 SmartArrayPointer<char> name = candidate->DebugName()->ToCString(); 1055 PrintF("[code-flushing clears: ");
1048 PrintF("[code-flushing clears: %s]\n", *name); 1056 candidate->ShortPrint();
1057 PrintF(" - age: %d]\n", code->GetAge());
1049 } 1058 }
1050 candidate->set_code(lazy_compile); 1059 candidate->set_code(lazy_compile);
1051 } 1060 }
1052 1061
1053 Object** code_slot = 1062 Object** code_slot =
1054 HeapObject::RawField(candidate, SharedFunctionInfo::kCodeOffset); 1063 HeapObject::RawField(candidate, SharedFunctionInfo::kCodeOffset);
1055 isolate_->heap()->mark_compact_collector()-> 1064 isolate_->heap()->mark_compact_collector()->
1056 RecordSlot(code_slot, code_slot, *code_slot); 1065 RecordSlot(code_slot, code_slot, *code_slot);
1057 1066
1058 candidate = next_candidate; 1067 candidate = next_candidate;
(...skipping 20 matching lines...) Expand all
1079 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map()); 1088 FixedArray* code_map = FixedArray::cast(holder->optimized_code_map());
1080 int new_length = kEntriesStart; 1089 int new_length = kEntriesStart;
1081 int old_length = code_map->length(); 1090 int old_length = code_map->length();
1082 for (int i = kEntriesStart; i < old_length; i += kEntryLength) { 1091 for (int i = kEntriesStart; i < old_length; i += kEntryLength) {
1083 Code* code = Code::cast(code_map->get(i + kCodeOffset)); 1092 Code* code = Code::cast(code_map->get(i + kCodeOffset));
1084 MarkBit code_mark = Marking::MarkBitFrom(code); 1093 MarkBit code_mark = Marking::MarkBitFrom(code);
1085 if (!code_mark.Get()) { 1094 if (!code_mark.Get()) {
1086 continue; 1095 continue;
1087 } 1096 }
1088 1097
1089 // Update and record the context slot in the optimizled code map. 1098 // Update and record the context slot in the optimized code map.
1090 Object** context_slot = HeapObject::RawField(code_map, 1099 Object** context_slot = HeapObject::RawField(code_map,
1091 FixedArray::OffsetOfElementAt(new_length)); 1100 FixedArray::OffsetOfElementAt(new_length));
1092 code_map->set(new_length++, code_map->get(i + kContextOffset)); 1101 code_map->set(new_length++, code_map->get(i + kContextOffset));
1093 ASSERT(Marking::IsBlack( 1102 ASSERT(Marking::IsBlack(
1094 Marking::MarkBitFrom(HeapObject::cast(*context_slot)))); 1103 Marking::MarkBitFrom(HeapObject::cast(*context_slot))));
1095 isolate_->heap()->mark_compact_collector()-> 1104 isolate_->heap()->mark_compact_collector()->
1096 RecordSlot(context_slot, context_slot, *context_slot); 1105 RecordSlot(context_slot, context_slot, *context_slot);
1097 1106
1098 // Update and record the code slot in the optimized code map. 1107 // Update and record the code slot in the optimized code map.
1099 Object** code_slot = HeapObject::RawField(code_map, 1108 Object** code_slot = HeapObject::RawField(code_map,
(...skipping 24 matching lines...) Expand all
1124 1133
1125 optimized_code_map_holder_head_ = NULL; 1134 optimized_code_map_holder_head_ = NULL;
1126 } 1135 }
1127 1136
1128 1137
1129 void CodeFlusher::EvictCandidate(SharedFunctionInfo* shared_info) { 1138 void CodeFlusher::EvictCandidate(SharedFunctionInfo* shared_info) {
1130 // Make sure previous flushing decisions are revisited. 1139 // Make sure previous flushing decisions are revisited.
1131 isolate_->heap()->incremental_marking()->RecordWrites(shared_info); 1140 isolate_->heap()->incremental_marking()->RecordWrites(shared_info);
1132 1141
1133 if (FLAG_trace_code_flushing) { 1142 if (FLAG_trace_code_flushing) {
1134 SmartArrayPointer<char> name = shared_info->DebugName()->ToCString(); 1143 PrintF("[code-flushing abandons function-info: ");
1135 PrintF("[code-flushing abandons function-info: %s]\n", *name); 1144 shared_info->ShortPrint();
1145 PrintF("]\n");
1136 } 1146 }
1137 1147
1138 SharedFunctionInfo* candidate = shared_function_info_candidates_head_; 1148 SharedFunctionInfo* candidate = shared_function_info_candidates_head_;
1139 SharedFunctionInfo* next_candidate; 1149 SharedFunctionInfo* next_candidate;
1140 if (candidate == shared_info) { 1150 if (candidate == shared_info) {
1141 next_candidate = GetNextCandidate(shared_info); 1151 next_candidate = GetNextCandidate(shared_info);
1142 shared_function_info_candidates_head_ = next_candidate; 1152 shared_function_info_candidates_head_ = next_candidate;
1143 ClearNextCandidate(shared_info); 1153 ClearNextCandidate(shared_info);
1144 } else { 1154 } else {
1145 while (candidate != NULL) { 1155 while (candidate != NULL) {
(...skipping 14 matching lines...) Expand all
1160 1170
1161 void CodeFlusher::EvictCandidate(JSFunction* function) { 1171 void CodeFlusher::EvictCandidate(JSFunction* function) {
1162 ASSERT(!function->next_function_link()->IsUndefined()); 1172 ASSERT(!function->next_function_link()->IsUndefined());
1163 Object* undefined = isolate_->heap()->undefined_value(); 1173 Object* undefined = isolate_->heap()->undefined_value();
1164 1174
1165 // Make sure previous flushing decisions are revisited. 1175 // Make sure previous flushing decisions are revisited.
1166 isolate_->heap()->incremental_marking()->RecordWrites(function); 1176 isolate_->heap()->incremental_marking()->RecordWrites(function);
1167 isolate_->heap()->incremental_marking()->RecordWrites(function->shared()); 1177 isolate_->heap()->incremental_marking()->RecordWrites(function->shared());
1168 1178
1169 if (FLAG_trace_code_flushing) { 1179 if (FLAG_trace_code_flushing) {
1170 SmartArrayPointer<char> name = function->shared()->DebugName()->ToCString(); 1180 PrintF("[code-flushing abandons closure: ");
1171 PrintF("[code-flushing abandons closure: %s]\n", *name); 1181 function->shared()->ShortPrint();
1182 PrintF("]\n");
1172 } 1183 }
1173 1184
1174 JSFunction* candidate = jsfunction_candidates_head_; 1185 JSFunction* candidate = jsfunction_candidates_head_;
1175 JSFunction* next_candidate; 1186 JSFunction* next_candidate;
1176 if (candidate == function) { 1187 if (candidate == function) {
1177 next_candidate = GetNextCandidate(function); 1188 next_candidate = GetNextCandidate(function);
1178 jsfunction_candidates_head_ = next_candidate; 1189 jsfunction_candidates_head_ = next_candidate;
1179 ClearNextCandidate(function, undefined); 1190 ClearNextCandidate(function, undefined);
1180 } else { 1191 } else {
1181 while (candidate != NULL) { 1192 while (candidate != NULL) {
(...skipping 13 matching lines...) Expand all
1195 1206
1196 1207
1197 void CodeFlusher::EvictOptimizedCodeMap(SharedFunctionInfo* code_map_holder) { 1208 void CodeFlusher::EvictOptimizedCodeMap(SharedFunctionInfo* code_map_holder) {
1198 ASSERT(!FixedArray::cast(code_map_holder->optimized_code_map())-> 1209 ASSERT(!FixedArray::cast(code_map_holder->optimized_code_map())->
1199 get(SharedFunctionInfo::kNextMapIndex)->IsUndefined()); 1210 get(SharedFunctionInfo::kNextMapIndex)->IsUndefined());
1200 1211
1201 // Make sure previous flushing decisions are revisited. 1212 // Make sure previous flushing decisions are revisited.
1202 isolate_->heap()->incremental_marking()->RecordWrites(code_map_holder); 1213 isolate_->heap()->incremental_marking()->RecordWrites(code_map_holder);
1203 1214
1204 if (FLAG_trace_code_flushing) { 1215 if (FLAG_trace_code_flushing) {
1205 SmartArrayPointer<char> name = code_map_holder->DebugName()->ToCString(); 1216 PrintF("[code-flushing abandons code-map: ");
1206 PrintF("[code-flushing abandons code-map: %s]\n", *name); 1217 code_map_holder->ShortPrint();
1218 PrintF("]\n");
1207 } 1219 }
1208 1220
1209 SharedFunctionInfo* holder = optimized_code_map_holder_head_; 1221 SharedFunctionInfo* holder = optimized_code_map_holder_head_;
1210 SharedFunctionInfo* next_holder; 1222 SharedFunctionInfo* next_holder;
1211 if (holder == code_map_holder) { 1223 if (holder == code_map_holder) {
1212 next_holder = GetNextCodeMap(code_map_holder); 1224 next_holder = GetNextCodeMap(code_map_holder);
1213 optimized_code_map_holder_head_ = next_holder; 1225 optimized_code_map_holder_head_ = next_holder;
1214 ClearNextCodeMap(code_map_holder); 1226 ClearNextCodeMap(code_map_holder);
1215 } else { 1227 } else {
1216 while (holder != NULL) { 1228 while (holder != NULL) {
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 1493
1482 static void UpdateRegExpCodeAgeAndFlush(Heap* heap, 1494 static void UpdateRegExpCodeAgeAndFlush(Heap* heap,
1483 JSRegExp* re, 1495 JSRegExp* re,
1484 bool is_ascii) { 1496 bool is_ascii) {
1485 // Make sure that the fixed array is in fact initialized on the RegExp. 1497 // Make sure that the fixed array is in fact initialized on the RegExp.
1486 // We could potentially trigger a GC when initializing the RegExp. 1498 // We could potentially trigger a GC when initializing the RegExp.
1487 if (HeapObject::cast(re->data())->map()->instance_type() != 1499 if (HeapObject::cast(re->data())->map()->instance_type() !=
1488 FIXED_ARRAY_TYPE) return; 1500 FIXED_ARRAY_TYPE) return;
1489 1501
1490 // Make sure this is a RegExp that actually contains code. 1502 // Make sure this is a RegExp that actually contains code.
1491 if (re->TypeTagUnchecked() != JSRegExp::IRREGEXP) return; 1503 if (re->TypeTag() != JSRegExp::IRREGEXP) return;
1492 1504
1493 Object* code = re->DataAtUnchecked(JSRegExp::code_index(is_ascii)); 1505 Object* code = re->DataAt(JSRegExp::code_index(is_ascii));
1494 if (!code->IsSmi() && 1506 if (!code->IsSmi() &&
1495 HeapObject::cast(code)->map()->instance_type() == CODE_TYPE) { 1507 HeapObject::cast(code)->map()->instance_type() == CODE_TYPE) {
1496 // Save a copy that can be reinstated if we need the code again. 1508 // Save a copy that can be reinstated if we need the code again.
1497 re->SetDataAtUnchecked(JSRegExp::saved_code_index(is_ascii), 1509 re->SetDataAt(JSRegExp::saved_code_index(is_ascii), code);
1498 code,
1499 heap);
1500 1510
1501 // Saving a copy might create a pointer into compaction candidate 1511 // Saving a copy might create a pointer into compaction candidate
1502 // that was not observed by marker. This might happen if JSRegExp data 1512 // that was not observed by marker. This might happen if JSRegExp data
1503 // was marked through the compilation cache before marker reached JSRegExp 1513 // was marked through the compilation cache before marker reached JSRegExp
1504 // object. 1514 // object.
1505 FixedArray* data = FixedArray::cast(re->data()); 1515 FixedArray* data = FixedArray::cast(re->data());
1506 Object** slot = data->data_start() + JSRegExp::saved_code_index(is_ascii); 1516 Object** slot = data->data_start() + JSRegExp::saved_code_index(is_ascii);
1507 heap->mark_compact_collector()-> 1517 heap->mark_compact_collector()->
1508 RecordSlot(slot, slot, code); 1518 RecordSlot(slot, slot, code);
1509 1519
1510 // Set a number in the 0-255 range to guarantee no smi overflow. 1520 // Set a number in the 0-255 range to guarantee no smi overflow.
1511 re->SetDataAtUnchecked(JSRegExp::code_index(is_ascii), 1521 re->SetDataAt(JSRegExp::code_index(is_ascii),
1512 Smi::FromInt(heap->sweep_generation() & 0xff), 1522 Smi::FromInt(heap->sweep_generation() & 0xff));
1513 heap);
1514 } else if (code->IsSmi()) { 1523 } else if (code->IsSmi()) {
1515 int value = Smi::cast(code)->value(); 1524 int value = Smi::cast(code)->value();
1516 // The regexp has not been compiled yet or there was a compilation error. 1525 // The regexp has not been compiled yet or there was a compilation error.
1517 if (value == JSRegExp::kUninitializedValue || 1526 if (value == JSRegExp::kUninitializedValue ||
1518 value == JSRegExp::kCompilationErrorValue) { 1527 value == JSRegExp::kCompilationErrorValue) {
1519 return; 1528 return;
1520 } 1529 }
1521 1530
1522 // Check if we should flush now. 1531 // Check if we should flush now.
1523 if (value == ((heap->sweep_generation() - kRegExpCodeThreshold) & 0xff)) { 1532 if (value == ((heap->sweep_generation() - kRegExpCodeThreshold) & 0xff)) {
1524 re->SetDataAtUnchecked(JSRegExp::code_index(is_ascii), 1533 re->SetDataAt(JSRegExp::code_index(is_ascii),
1525 Smi::FromInt(JSRegExp::kUninitializedValue), 1534 Smi::FromInt(JSRegExp::kUninitializedValue));
1526 heap); 1535 re->SetDataAt(JSRegExp::saved_code_index(is_ascii),
1527 re->SetDataAtUnchecked(JSRegExp::saved_code_index(is_ascii), 1536 Smi::FromInt(JSRegExp::kUninitializedValue));
1528 Smi::FromInt(JSRegExp::kUninitializedValue),
1529 heap);
1530 } 1537 }
1531 } 1538 }
1532 } 1539 }
1533 1540
1534 1541
1535 // Works by setting the current sweep_generation (as a smi) in the 1542 // Works by setting the current sweep_generation (as a smi) in the
1536 // code object place in the data array of the RegExp and keeps a copy 1543 // code object place in the data array of the RegExp and keeps a copy
1537 // around that can be reinstated if we reuse the RegExp before flushing. 1544 // around that can be reinstated if we reuse the RegExp before flushing.
1538 // If we did not use the code for kRegExpCodeThreshold mark sweep GCs 1545 // If we did not use the code for kRegExpCodeThreshold mark sweep GCs
1539 // we flush the code. 1546 // we flush the code.
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
2141 DiscoverGreyObjectsInSpace(heap(), 2148 DiscoverGreyObjectsInSpace(heap(),
2142 &marking_deque_, 2149 &marking_deque_,
2143 heap()->map_space()); 2150 heap()->map_space());
2144 if (marking_deque_.IsFull()) return; 2151 if (marking_deque_.IsFull()) return;
2145 2152
2146 DiscoverGreyObjectsInSpace(heap(), 2153 DiscoverGreyObjectsInSpace(heap(),
2147 &marking_deque_, 2154 &marking_deque_,
2148 heap()->cell_space()); 2155 heap()->cell_space());
2149 if (marking_deque_.IsFull()) return; 2156 if (marking_deque_.IsFull()) return;
2150 2157
2158 DiscoverGreyObjectsInSpace(heap(),
2159 &marking_deque_,
2160 heap()->property_cell_space());
2161 if (marking_deque_.IsFull()) return;
2162
2151 LargeObjectIterator lo_it(heap()->lo_space()); 2163 LargeObjectIterator lo_it(heap()->lo_space());
2152 DiscoverGreyObjectsWithIterator(heap(), 2164 DiscoverGreyObjectsWithIterator(heap(),
2153 &marking_deque_, 2165 &marking_deque_,
2154 &lo_it); 2166 &lo_it);
2155 if (marking_deque_.IsFull()) return; 2167 if (marking_deque_.IsFull()) return;
2156 2168
2157 marking_deque_.ClearOverflowed(); 2169 marking_deque_.ClearOverflowed();
2158 } 2170 }
2159 2171
2160 2172
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2234 2246
2235 PrepareForCodeFlushing(); 2247 PrepareForCodeFlushing();
2236 2248
2237 if (was_marked_incrementally_) { 2249 if (was_marked_incrementally_) {
2238 // There is no write barrier on cells so we have to scan them now at the end 2250 // There is no write barrier on cells so we have to scan them now at the end
2239 // of the incremental marking. 2251 // of the incremental marking.
2240 { 2252 {
2241 HeapObjectIterator cell_iterator(heap()->cell_space()); 2253 HeapObjectIterator cell_iterator(heap()->cell_space());
2242 HeapObject* cell; 2254 HeapObject* cell;
2243 while ((cell = cell_iterator.Next()) != NULL) { 2255 while ((cell = cell_iterator.Next()) != NULL) {
2244 ASSERT(cell->IsJSGlobalPropertyCell()); 2256 ASSERT(cell->IsCell());
2245 if (IsMarked(cell)) { 2257 if (IsMarked(cell)) {
2246 int offset = JSGlobalPropertyCell::kValueOffset; 2258 int offset = Cell::kValueOffset;
2247 MarkCompactMarkingVisitor::VisitPointer( 2259 MarkCompactMarkingVisitor::VisitPointer(
2248 heap(), 2260 heap(),
2249 reinterpret_cast<Object**>(cell->address() + offset)); 2261 reinterpret_cast<Object**>(cell->address() + offset));
2262 }
2263 }
2264 }
2265 {
2266 HeapObjectIterator js_global_property_cell_iterator(
2267 heap()->property_cell_space());
2268 HeapObject* cell;
2269 while ((cell = js_global_property_cell_iterator.Next()) != NULL) {
2270 ASSERT(cell->IsPropertyCell());
2271 if (IsMarked(cell)) {
2272 int offset = PropertyCell::kValueOffset;
2273 MarkCompactMarkingVisitor::VisitPointer(
2274 heap(),
2275 reinterpret_cast<Object**>(cell->address() + offset));
2276 offset = PropertyCell::kTypeOffset;
2277 MarkCompactMarkingVisitor::VisitPointer(
2278 heap(),
2279 reinterpret_cast<Object**>(cell->address() + offset));
2250 } 2280 }
2251 } 2281 }
2252 } 2282 }
2253 } 2283 }
2254 2284
2255 RootMarkingVisitor root_visitor(heap()); 2285 RootMarkingVisitor root_visitor(heap());
2256 MarkRoots(&root_visitor); 2286 MarkRoots(&root_visitor);
2257 2287
2258 // The objects reachable from the roots are marked, yet unreachable 2288 // The objects reachable from the roots are marked, yet unreachable
2259 // objects are unmarked. Mark objects reachable due to host 2289 // objects are unmarked. Mark objects reachable due to host
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 if (map->IsFreeSpace()) continue; 2441 if (map->IsFreeSpace()) continue;
2412 2442
2413 ASSERT(map->IsMap()); 2443 ASSERT(map->IsMap());
2414 if (!map->CanTransition()) continue; 2444 if (!map->CanTransition()) continue;
2415 2445
2416 if (map_mark.Get() && 2446 if (map_mark.Get() &&
2417 map->attached_to_shared_function_info()) { 2447 map->attached_to_shared_function_info()) {
2418 // This map is used for inobject slack tracking and has been detached 2448 // This map is used for inobject slack tracking and has been detached
2419 // from SharedFunctionInfo during the mark phase. 2449 // from SharedFunctionInfo during the mark phase.
2420 // Since it survived the GC, reattach it now. 2450 // Since it survived the GC, reattach it now.
2421 map->unchecked_constructor()->unchecked_shared()->AttachInitialMap(map); 2451 JSFunction::cast(map->constructor())->shared()->AttachInitialMap(map);
2422 } 2452 }
2423 2453
2424 ClearNonLivePrototypeTransitions(map); 2454 ClearNonLivePrototypeTransitions(map);
2425 ClearNonLiveMapTransitions(map, map_mark); 2455 ClearNonLiveMapTransitions(map, map_mark);
2426 2456
2427 if (map_mark.Get()) { 2457 if (map_mark.Get()) {
2428 ClearNonLiveDependentCode(map); 2458 ClearNonLiveDependentCode(map);
2429 } else { 2459 } else {
2430 ClearAndDeoptimizeDependentCode(map); 2460 ClearAndDeoptimizeDependentCode(map);
2431 } 2461 }
(...skipping 10 matching lines...) Expand all
2442 const int proto_offset = header + Map::kProtoTransitionPrototypeOffset; 2472 const int proto_offset = header + Map::kProtoTransitionPrototypeOffset;
2443 const int map_offset = header + Map::kProtoTransitionMapOffset; 2473 const int map_offset = header + Map::kProtoTransitionMapOffset;
2444 const int step = Map::kProtoTransitionElementsPerEntry; 2474 const int step = Map::kProtoTransitionElementsPerEntry;
2445 for (int i = 0; i < number_of_transitions; i++) { 2475 for (int i = 0; i < number_of_transitions; i++) {
2446 Object* prototype = prototype_transitions->get(proto_offset + i * step); 2476 Object* prototype = prototype_transitions->get(proto_offset + i * step);
2447 Object* cached_map = prototype_transitions->get(map_offset + i * step); 2477 Object* cached_map = prototype_transitions->get(map_offset + i * step);
2448 if (IsMarked(prototype) && IsMarked(cached_map)) { 2478 if (IsMarked(prototype) && IsMarked(cached_map)) {
2449 int proto_index = proto_offset + new_number_of_transitions * step; 2479 int proto_index = proto_offset + new_number_of_transitions * step;
2450 int map_index = map_offset + new_number_of_transitions * step; 2480 int map_index = map_offset + new_number_of_transitions * step;
2451 if (new_number_of_transitions != i) { 2481 if (new_number_of_transitions != i) {
2452 prototype_transitions->set_unchecked( 2482 prototype_transitions->set(
2453 heap_,
2454 proto_index, 2483 proto_index,
2455 prototype, 2484 prototype,
2456 UPDATE_WRITE_BARRIER); 2485 UPDATE_WRITE_BARRIER);
2457 prototype_transitions->set_unchecked( 2486 prototype_transitions->set(
2458 heap_,
2459 map_index, 2487 map_index,
2460 cached_map, 2488 cached_map,
2461 SKIP_WRITE_BARRIER); 2489 SKIP_WRITE_BARRIER);
2462 } 2490 }
2463 Object** slot = 2491 Object** slot =
2464 HeapObject::RawField(prototype_transitions, 2492 HeapObject::RawField(prototype_transitions,
2465 FixedArray::OffsetOfElementAt(proto_index)); 2493 FixedArray::OffsetOfElementAt(proto_index));
2466 RecordSlot(slot, slot, prototype); 2494 RecordSlot(slot, slot, prototype);
2467 new_number_of_transitions++; 2495 new_number_of_transitions++;
2468 } 2496 }
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
3382 } 3410 }
3383 } 3411 }
3384 3412
3385 GCTracer::Scope gc_scope(tracer_, GCTracer::Scope::MC_UPDATE_MISC_POINTERS); 3413 GCTracer::Scope gc_scope(tracer_, GCTracer::Scope::MC_UPDATE_MISC_POINTERS);
3386 3414
3387 // Update pointers from cells. 3415 // Update pointers from cells.
3388 HeapObjectIterator cell_iterator(heap_->cell_space()); 3416 HeapObjectIterator cell_iterator(heap_->cell_space());
3389 for (HeapObject* cell = cell_iterator.Next(); 3417 for (HeapObject* cell = cell_iterator.Next();
3390 cell != NULL; 3418 cell != NULL;
3391 cell = cell_iterator.Next()) { 3419 cell = cell_iterator.Next()) {
3392 if (cell->IsJSGlobalPropertyCell()) { 3420 if (cell->IsCell()) {
3393 Address value_address = 3421 Address value_address = reinterpret_cast<Address>(cell) +
3394 reinterpret_cast<Address>(cell) + 3422 (Cell::kValueOffset - kHeapObjectTag);
3395 (JSGlobalPropertyCell::kValueOffset - kHeapObjectTag);
3396 updating_visitor.VisitPointer(reinterpret_cast<Object**>(value_address)); 3423 updating_visitor.VisitPointer(reinterpret_cast<Object**>(value_address));
3397 } 3424 }
3398 } 3425 }
3399 3426
3427 HeapObjectIterator js_global_property_cell_iterator(
3428 heap_->property_cell_space());
3429 for (HeapObject* cell = js_global_property_cell_iterator.Next();
3430 cell != NULL;
3431 cell = js_global_property_cell_iterator.Next()) {
3432 if (cell->IsPropertyCell()) {
3433 Address value_address =
3434 reinterpret_cast<Address>(cell) +
3435 (PropertyCell::kValueOffset - kHeapObjectTag);
3436 updating_visitor.VisitPointer(reinterpret_cast<Object**>(value_address));
3437 Address type_address =
3438 reinterpret_cast<Address>(cell) +
3439 (PropertyCell::kTypeOffset - kHeapObjectTag);
3440 updating_visitor.VisitPointer(reinterpret_cast<Object**>(type_address));
3441 }
3442 }
3443
3400 // Update pointer from the native contexts list. 3444 // Update pointer from the native contexts list.
3401 updating_visitor.VisitPointer(heap_->native_contexts_list_address()); 3445 updating_visitor.VisitPointer(heap_->native_contexts_list_address());
3402 3446
3403 heap_->string_table()->Iterate(&updating_visitor); 3447 heap_->string_table()->Iterate(&updating_visitor);
3404 3448
3405 // Update pointers from external string table. 3449 // Update pointers from external string table.
3406 heap_->UpdateReferencesInExternalStringTable( 3450 heap_->UpdateReferencesInExternalStringTable(
3407 &UpdateReferenceInExternalStringTableEntry); 3451 &UpdateReferenceInExternalStringTableEntry);
3408 3452
3409 // Update pointers in the new error object list. 3453 // Update pointers in the new error object list.
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
4048 } 4092 }
4049 4093
4050 if (how_to_sweep == PARALLEL_CONSERVATIVE) { 4094 if (how_to_sweep == PARALLEL_CONSERVATIVE) {
4051 WaitUntilSweepingCompleted(); 4095 WaitUntilSweepingCompleted();
4052 } 4096 }
4053 4097
4054 RemoveDeadInvalidatedCode(); 4098 RemoveDeadInvalidatedCode();
4055 SweepSpace(heap()->code_space(), PRECISE); 4099 SweepSpace(heap()->code_space(), PRECISE);
4056 4100
4057 SweepSpace(heap()->cell_space(), PRECISE); 4101 SweepSpace(heap()->cell_space(), PRECISE);
4102 SweepSpace(heap()->property_cell_space(), PRECISE);
4058 4103
4059 EvacuateNewSpaceAndCandidates(); 4104 EvacuateNewSpaceAndCandidates();
4060 4105
4061 // ClearNonLiveTransitions depends on precise sweeping of map space to 4106 // ClearNonLiveTransitions depends on precise sweeping of map space to
4062 // detect whether unmarked map became dead in this collection or in one 4107 // detect whether unmarked map became dead in this collection or in one
4063 // of the previous ones. 4108 // of the previous ones.
4064 SweepSpace(heap()->map_space(), PRECISE); 4109 SweepSpace(heap()->map_space(), PRECISE);
4065 4110
4066 // Deallocate unmarked objects and clear marked bits for marked objects. 4111 // Deallocate unmarked objects and clear marked bits for marked objects.
4067 heap_->lo_space()->FreeUnmarkedObjects(); 4112 heap_->lo_space()->FreeUnmarkedObjects();
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
4270 while (buffer != NULL) { 4315 while (buffer != NULL) {
4271 SlotsBuffer* next_buffer = buffer->next(); 4316 SlotsBuffer* next_buffer = buffer->next();
4272 DeallocateBuffer(buffer); 4317 DeallocateBuffer(buffer);
4273 buffer = next_buffer; 4318 buffer = next_buffer;
4274 } 4319 }
4275 *buffer_address = NULL; 4320 *buffer_address = NULL;
4276 } 4321 }
4277 4322
4278 4323
4279 } } // namespace v8::internal 4324 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/mips/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698