| OLD | NEW |
| 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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 | 466 |
| 467 static JSFunction* GetNextCandidate(JSFunction* candidate) { | 467 static JSFunction* GetNextCandidate(JSFunction* candidate) { |
| 468 return *GetNextCandidateField(candidate); | 468 return *GetNextCandidateField(candidate); |
| 469 } | 469 } |
| 470 | 470 |
| 471 static void SetNextCandidate(JSFunction* candidate, | 471 static void SetNextCandidate(JSFunction* candidate, |
| 472 JSFunction* next_candidate) { | 472 JSFunction* next_candidate) { |
| 473 *GetNextCandidateField(candidate) = next_candidate; | 473 *GetNextCandidateField(candidate) = next_candidate; |
| 474 } | 474 } |
| 475 | 475 |
| 476 STATIC_ASSERT(kPointerSize <= Code::kHeaderSize - Code::kHeaderPaddingStart); | |
| 477 | |
| 478 static SharedFunctionInfo** GetNextCandidateField( | 476 static SharedFunctionInfo** GetNextCandidateField( |
| 479 SharedFunctionInfo* candidate) { | 477 SharedFunctionInfo* candidate) { |
| 480 Code* code = candidate->unchecked_code(); | 478 Code* code = candidate->unchecked_code(); |
| 481 return reinterpret_cast<SharedFunctionInfo**>( | 479 return reinterpret_cast<SharedFunctionInfo**>( |
| 482 code->address() + Code::kHeaderPaddingStart); | 480 code->address() + Code::kNextCodeFlushingCandidateOffset); |
| 483 } | 481 } |
| 484 | 482 |
| 485 static SharedFunctionInfo* GetNextCandidate(SharedFunctionInfo* candidate) { | 483 static SharedFunctionInfo* GetNextCandidate(SharedFunctionInfo* candidate) { |
| 486 return *GetNextCandidateField(candidate); | 484 return *GetNextCandidateField(candidate); |
| 487 } | 485 } |
| 488 | 486 |
| 489 static void SetNextCandidate(SharedFunctionInfo* candidate, | 487 static void SetNextCandidate(SharedFunctionInfo* candidate, |
| 490 SharedFunctionInfo* next_candidate) { | 488 SharedFunctionInfo* next_candidate) { |
| 491 *GetNextCandidateField(candidate) = next_candidate; | 489 *GetNextCandidateField(candidate) = next_candidate; |
| 492 } | 490 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 if (end - start >= kMinRangeForMarkingRecursion) { | 619 if (end - start >= kMinRangeForMarkingRecursion) { |
| 622 if (VisitUnmarkedObjects(heap, start, end)) return; | 620 if (VisitUnmarkedObjects(heap, start, end)) return; |
| 623 // We are close to a stack overflow, so just mark the objects. | 621 // We are close to a stack overflow, so just mark the objects. |
| 624 } | 622 } |
| 625 for (Object** p = start; p < end; p++) MarkObjectByPointer(heap, p); | 623 for (Object** p = start; p < end; p++) MarkObjectByPointer(heap, p); |
| 626 } | 624 } |
| 627 | 625 |
| 628 static inline void VisitCodeTarget(Heap* heap, RelocInfo* rinfo) { | 626 static inline void VisitCodeTarget(Heap* heap, RelocInfo* rinfo) { |
| 629 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); | 627 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); |
| 630 Code* code = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 628 Code* code = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
| 631 if (FLAG_cleanup_ics_at_gc && code->is_inline_cache_stub()) { | 629 if (FLAG_cleanup_code_caches_at_gc && code->is_inline_cache_stub()) { |
| 632 IC::Clear(rinfo->pc()); | 630 IC::Clear(rinfo->pc()); |
| 633 // Please note targets for cleared inline cached do not have to be | 631 // Please note targets for cleared inline cached do not have to be |
| 634 // marked since they are contained in HEAP->non_monomorphic_cache(). | 632 // marked since they are contained in HEAP->non_monomorphic_cache(). |
| 635 } else { | 633 } else { |
| 636 MarkBit code_mark = Marking::MarkBitFrom(code); | 634 MarkBit code_mark = Marking::MarkBitFrom(code); |
| 637 heap->mark_compact_collector()->MarkObject(code, code_mark); | 635 heap->mark_compact_collector()->MarkObject(code, code_mark); |
| 638 } | 636 } |
| 639 } | 637 } |
| 640 | 638 |
| 641 static void VisitGlobalPropertyCell(Heap* heap, RelocInfo* rinfo) { | 639 static void VisitGlobalPropertyCell(Heap* heap, RelocInfo* rinfo) { |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 } | 1247 } |
| 1250 } | 1248 } |
| 1251 }; | 1249 }; |
| 1252 | 1250 |
| 1253 | 1251 |
| 1254 void MarkCompactCollector::ProcessNewlyMarkedObject(HeapObject* object) { | 1252 void MarkCompactCollector::ProcessNewlyMarkedObject(HeapObject* object) { |
| 1255 ASSERT(IsMarked(object)); | 1253 ASSERT(IsMarked(object)); |
| 1256 ASSERT(HEAP->Contains(object)); | 1254 ASSERT(HEAP->Contains(object)); |
| 1257 if (object->IsMap()) { | 1255 if (object->IsMap()) { |
| 1258 Map* map = Map::cast(object); | 1256 Map* map = Map::cast(object); |
| 1259 if (FLAG_cleanup_caches_in_maps_at_gc) { | 1257 if (FLAG_cleanup_code_caches_at_gc) { |
| 1260 map->ClearCodeCache(heap()); | 1258 map->ClearCodeCache(heap()); |
| 1261 } | 1259 } |
| 1262 if (FLAG_collect_maps && | 1260 if (FLAG_collect_maps && |
| 1263 map->instance_type() >= FIRST_JS_OBJECT_TYPE && | 1261 map->instance_type() >= FIRST_JS_OBJECT_TYPE && |
| 1264 map->instance_type() <= JS_FUNCTION_TYPE) { | 1262 map->instance_type() <= JS_FUNCTION_TYPE) { |
| 1265 MarkMapContents(map); | 1263 MarkMapContents(map); |
| 1266 } else { | 1264 } else { |
| 1267 marking_deque_.PushBlack(map); | 1265 marking_deque_.PushBlack(map); |
| 1268 } | 1266 } |
| 1269 } else { | 1267 } else { |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2111 // Update pointers in to space. | 2109 // Update pointers in to space. |
| 2112 Address current = space->bottom(); | 2110 Address current = space->bottom(); |
| 2113 while (current < space->top()) { | 2111 while (current < space->top()) { |
| 2114 HeapObject* object = HeapObject::FromAddress(current); | 2112 HeapObject* object = HeapObject::FromAddress(current); |
| 2115 current += | 2113 current += |
| 2116 StaticPointersToNewGenUpdatingVisitor::IterateBody(object->map(), | 2114 StaticPointersToNewGenUpdatingVisitor::IterateBody(object->map(), |
| 2117 object); | 2115 object); |
| 2118 } | 2116 } |
| 2119 | 2117 |
| 2120 // Update roots. | 2118 // Update roots. |
| 2121 heap_->IterateRoots(&updating_visitor, VISIT_ALL_IN_SCAVENGE); | 2119 heap_->IterateRoots(&updating_visitor, VISIT_ALL_IN_SWEEP_NEWSPACE); |
| 2122 LiveObjectList::IterateElements(&updating_visitor); | 2120 LiveObjectList::IterateElements(&updating_visitor); |
| 2123 | 2121 |
| 2124 { | 2122 { |
| 2125 StoreBufferRebuildScope scope(heap_, | 2123 StoreBufferRebuildScope scope(heap_, |
| 2126 heap_->store_buffer(), | 2124 heap_->store_buffer(), |
| 2127 &Heap::ScavengeStoreBufferCallback); | 2125 &Heap::ScavengeStoreBufferCallback); |
| 2128 heap_->store_buffer()->IteratePointersToNewSpace(&UpdatePointerToNewGen); | 2126 heap_->store_buffer()->IteratePointersToNewSpace(&UpdatePointerToNewGen); |
| 2129 } | 2127 } |
| 2130 | 2128 |
| 2131 // Update pointers from cells. | 2129 // Update pointers from cells. |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2761 } | 2759 } |
| 2762 | 2760 |
| 2763 | 2761 |
| 2764 void MarkCompactCollector::Initialize() { | 2762 void MarkCompactCollector::Initialize() { |
| 2765 StaticPointersToNewGenUpdatingVisitor::Initialize(); | 2763 StaticPointersToNewGenUpdatingVisitor::Initialize(); |
| 2766 StaticMarkingVisitor::Initialize(); | 2764 StaticMarkingVisitor::Initialize(); |
| 2767 } | 2765 } |
| 2768 | 2766 |
| 2769 | 2767 |
| 2770 } } // namespace v8::internal | 2768 } } // namespace v8::internal |
| OLD | NEW |