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

Side by Side Diff: src/heap/mark-compact.h

Issue 1260463002: Remove slot buffer entries in deoptimized code objects after marking. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | src/heap/mark-compact.cc » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HEAP_MARK_COMPACT_H_ 5 #ifndef V8_HEAP_MARK_COMPACT_H_
6 #define V8_HEAP_MARK_COMPACT_H_ 6 #define V8_HEAP_MARK_COMPACT_H_
7 7
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/heap/spaces.h" 9 #include "src/heap/spaces.h"
10 10
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 void Add(ObjectSlot slot) { 318 void Add(ObjectSlot slot) {
319 DCHECK(0 <= idx_ && idx_ < kNumberOfElements); 319 DCHECK(0 <= idx_ && idx_ < kNumberOfElements);
320 #ifdef DEBUG 320 #ifdef DEBUG
321 if (slot >= reinterpret_cast<ObjectSlot>(NUMBER_OF_SLOT_TYPES)) { 321 if (slot >= reinterpret_cast<ObjectSlot>(NUMBER_OF_SLOT_TYPES)) {
322 DCHECK_NOT_NULL(*slot); 322 DCHECK_NOT_NULL(*slot);
323 } 323 }
324 #endif 324 #endif
325 slots_[idx_++] = slot; 325 slots_[idx_++] = slot;
326 } 326 }
327 327
328 // Should be used for testing only.
329 ObjectSlot Get(intptr_t i) {
330 DCHECK(i >= 0 && i < kNumberOfElements);
331 return slots_[i];
332 }
333
328 enum SlotType { 334 enum SlotType {
329 EMBEDDED_OBJECT_SLOT, 335 EMBEDDED_OBJECT_SLOT,
330 OBJECT_SLOT, 336 OBJECT_SLOT,
331 RELOCATED_CODE_OBJECT, 337 RELOCATED_CODE_OBJECT,
332 CELL_TARGET_SLOT, 338 CELL_TARGET_SLOT,
333 CODE_TARGET_SLOT, 339 CODE_TARGET_SLOT,
334 CODE_ENTRY_SLOT, 340 CODE_ENTRY_SLOT,
335 DEBUG_TARGET_SLOT, 341 DEBUG_TARGET_SLOT,
336 NUMBER_OF_SLOT_TYPES 342 NUMBER_OF_SLOT_TYPES
337 }; 343 };
(...skipping 29 matching lines...) Expand all
367 static int SizeOfChain(SlotsBuffer* buffer) { 373 static int SizeOfChain(SlotsBuffer* buffer) {
368 if (buffer == NULL) return 0; 374 if (buffer == NULL) return 0;
369 return static_cast<int>(buffer->idx_ + 375 return static_cast<int>(buffer->idx_ +
370 (buffer->chain_length_ - 1) * kNumberOfElements); 376 (buffer->chain_length_ - 1) * kNumberOfElements);
371 } 377 }
372 378
373 inline bool IsFull() { return idx_ == kNumberOfElements; } 379 inline bool IsFull() { return idx_ == kNumberOfElements; }
374 380
375 inline bool HasSpaceForTypedSlot() { return idx_ < kNumberOfElements - 1; } 381 inline bool HasSpaceForTypedSlot() { return idx_ < kNumberOfElements - 1; }
376 382
377 static void UpdateSlotsRecordedIn(Heap* heap, SlotsBuffer* buffer, 383 static void UpdateSlotsRecordedIn(Heap* heap, SlotsBuffer* buffer) {
378 bool code_slots_filtering_required) {
379 while (buffer != NULL) { 384 while (buffer != NULL) {
380 if (code_slots_filtering_required) {
381 buffer->UpdateSlotsWithFilter(heap);
382 } else {
383 buffer->UpdateSlots(heap); 385 buffer->UpdateSlots(heap);
384 }
385 buffer = buffer->next(); 386 buffer = buffer->next();
386 } 387 }
387 } 388 }
388 389
389 enum AdditionMode { FAIL_ON_OVERFLOW, IGNORE_OVERFLOW }; 390 enum AdditionMode { FAIL_ON_OVERFLOW, IGNORE_OVERFLOW };
390 391
391 static bool ChainLengthThresholdReached(SlotsBuffer* buffer) { 392 static bool ChainLengthThresholdReached(SlotsBuffer* buffer) {
392 return buffer != NULL && buffer->chain_length_ >= kChainLengthThreshold; 393 return buffer != NULL && buffer->chain_length_ >= kChainLengthThreshold;
393 } 394 }
394 395
(...skipping 18 matching lines...) Expand all
413 static bool AddTo(SlotsBufferAllocator* allocator, 414 static bool AddTo(SlotsBufferAllocator* allocator,
414 SlotsBuffer** buffer_address, SlotType type, Address addr, 415 SlotsBuffer** buffer_address, SlotType type, Address addr,
415 AdditionMode mode); 416 AdditionMode mode);
416 417
417 // Eliminates all stale entries from the slots buffer, i.e., slots that 418 // Eliminates all stale entries from the slots buffer, i.e., slots that
418 // are not part of live objects anymore. This method must be called after 419 // are not part of live objects anymore. This method must be called after
419 // marking, when the whole transitive closure is known and must be called 420 // marking, when the whole transitive closure is known and must be called
420 // before sweeping when mark bits are still intact. 421 // before sweeping when mark bits are still intact.
421 static void RemoveInvalidSlots(Heap* heap, SlotsBuffer* buffer); 422 static void RemoveInvalidSlots(Heap* heap, SlotsBuffer* buffer);
422 423
424 // Eliminate all slots that are within the given address range.
425 static void RemoveObjectSlots(Heap* heap, SlotsBuffer* buffer,
426 Address start_slot, Address end_slot);
427
423 // Ensures that there are no invalid slots in the chain of slots buffers. 428 // Ensures that there are no invalid slots in the chain of slots buffers.
424 static void VerifySlots(Heap* heap, SlotsBuffer* buffer); 429 static void VerifySlots(Heap* heap, SlotsBuffer* buffer);
425 430
426 static const int kNumberOfElements = 1021; 431 static const int kNumberOfElements = 1021;
427 432
428 private: 433 private:
429 static const int kChainLengthThreshold = 15; 434 static const int kChainLengthThreshold = 15;
430 435
431 intptr_t idx_; 436 intptr_t idx_;
432 intptr_t chain_length_; 437 intptr_t chain_length_;
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 void InitializeMarkingDeque(); 739 void InitializeMarkingDeque();
735 740
736 // The following four methods can just be called after marking, when the 741 // The following four methods can just be called after marking, when the
737 // whole transitive closure is known. They must be called before sweeping 742 // whole transitive closure is known. They must be called before sweeping
738 // when mark bits are still intact. 743 // when mark bits are still intact.
739 bool IsSlotInBlackObject(Page* p, Address slot, HeapObject** out_object); 744 bool IsSlotInBlackObject(Page* p, Address slot, HeapObject** out_object);
740 bool IsSlotInBlackObjectSlow(Page* p, Address slot); 745 bool IsSlotInBlackObjectSlow(Page* p, Address slot);
741 bool IsSlotInLiveObject(Address slot); 746 bool IsSlotInLiveObject(Address slot);
742 void VerifyIsSlotInLiveObject(Address slot, HeapObject* object); 747 void VerifyIsSlotInLiveObject(Address slot, HeapObject* object);
743 748
749 // Removes all the slots in the slot buffers that are within the given
750 // address range.
751 void RemoveObjectSlots(Address start_slot, Address end_slot);
752
744 private: 753 private:
745 class SweeperTask; 754 class SweeperTask;
746 755
747 explicit MarkCompactCollector(Heap* heap); 756 explicit MarkCompactCollector(Heap* heap);
748 ~MarkCompactCollector(); 757 ~MarkCompactCollector();
749 758
750 bool MarkInvalidatedCode(); 759 void RemoveDeoptimizedCodeSlots();
751 bool WillBeDeoptimized(Code* code); 760 bool WillBeDeoptimized(Code* code);
752 void RemoveDeadInvalidatedCode(); 761 void RemoveDeadInvalidatedCode();
753 void ProcessInvalidatedCode(ObjectVisitor* visitor); 762 void ProcessInvalidatedCode(ObjectVisitor* visitor);
754 void EvictPopularEvacuationCandidate(Page* page); 763 void EvictPopularEvacuationCandidate(Page* page);
755 void ClearInvalidSlotsBufferEntries(PagedSpace* space); 764 void ClearInvalidSlotsBufferEntries(PagedSpace* space);
756 void ClearInvalidStoreAndSlotsBufferEntries(); 765 void ClearInvalidStoreAndSlotsBufferEntries();
757 766
758 void StartSweeperThreads(); 767 void StartSweeperThreads();
759 768
760 #ifdef DEBUG 769 #ifdef DEBUG
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 private: 1037 private:
1029 MarkCompactCollector* collector_; 1038 MarkCompactCollector* collector_;
1030 }; 1039 };
1031 1040
1032 1041
1033 const char* AllocationSpaceName(AllocationSpace space); 1042 const char* AllocationSpaceName(AllocationSpace space);
1034 } 1043 }
1035 } // namespace v8::internal 1044 } // namespace v8::internal
1036 1045
1037 #endif // V8_HEAP_MARK_COMPACT_H_ 1046 #endif // V8_HEAP_MARK_COMPACT_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698