| OLD | NEW |
| 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_HEAP_INL_H_ | 5 #ifndef V8_HEAP_HEAP_INL_H_ |
| 6 #define V8_HEAP_HEAP_INL_H_ | 6 #define V8_HEAP_HEAP_INL_H_ |
| 7 | 7 |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 return nullptr; | 503 return nullptr; |
| 504 default: | 504 default: |
| 505 UNREACHABLE(); | 505 UNREACHABLE(); |
| 506 } | 506 } |
| 507 UNREACHABLE(); | 507 UNREACHABLE(); |
| 508 return nullptr; | 508 return nullptr; |
| 509 } | 509 } |
| 510 | 510 |
| 511 template <Heap::UpdateAllocationSiteMode mode> | 511 template <Heap::UpdateAllocationSiteMode mode> |
| 512 void Heap::UpdateAllocationSite(HeapObject* object, | 512 void Heap::UpdateAllocationSite(HeapObject* object, |
| 513 HashMap* pretenuring_feedback) { | 513 base::HashMap* pretenuring_feedback) { |
| 514 DCHECK(InFromSpace(object)); | 514 DCHECK(InFromSpace(object)); |
| 515 if (!FLAG_allocation_site_pretenuring || | 515 if (!FLAG_allocation_site_pretenuring || |
| 516 !AllocationSite::CanTrack(object->map()->instance_type())) | 516 !AllocationSite::CanTrack(object->map()->instance_type())) |
| 517 return; | 517 return; |
| 518 AllocationMemento* memento_candidate = FindAllocationMemento<kForGC>(object); | 518 AllocationMemento* memento_candidate = FindAllocationMemento<kForGC>(object); |
| 519 if (memento_candidate == nullptr) return; | 519 if (memento_candidate == nullptr) return; |
| 520 | 520 |
| 521 if (mode == kGlobal) { | 521 if (mode == kGlobal) { |
| 522 DCHECK_EQ(pretenuring_feedback, global_pretenuring_feedback_); | 522 DCHECK_EQ(pretenuring_feedback, global_pretenuring_feedback_); |
| 523 // Entering global pretenuring feedback is only used in the scavenger, where | 523 // Entering global pretenuring feedback is only used in the scavenger, where |
| 524 // we are allowed to actually touch the allocation site. | 524 // we are allowed to actually touch the allocation site. |
| 525 if (!memento_candidate->IsValid()) return; | 525 if (!memento_candidate->IsValid()) return; |
| 526 AllocationSite* site = memento_candidate->GetAllocationSite(); | 526 AllocationSite* site = memento_candidate->GetAllocationSite(); |
| 527 DCHECK(!site->IsZombie()); | 527 DCHECK(!site->IsZombie()); |
| 528 // For inserting in the global pretenuring storage we need to first | 528 // For inserting in the global pretenuring storage we need to first |
| 529 // increment the memento found count on the allocation site. | 529 // increment the memento found count on the allocation site. |
| 530 if (site->IncrementMementoFoundCount()) { | 530 if (site->IncrementMementoFoundCount()) { |
| 531 global_pretenuring_feedback_->LookupOrInsert(site, | 531 global_pretenuring_feedback_->LookupOrInsert(site, |
| 532 ObjectHash(site->address())); | 532 ObjectHash(site->address())); |
| 533 } | 533 } |
| 534 } else { | 534 } else { |
| 535 DCHECK_EQ(mode, kCached); | 535 DCHECK_EQ(mode, kCached); |
| 536 DCHECK_NE(pretenuring_feedback, global_pretenuring_feedback_); | 536 DCHECK_NE(pretenuring_feedback, global_pretenuring_feedback_); |
| 537 // Entering cached feedback is used in the parallel case. We are not allowed | 537 // Entering cached feedback is used in the parallel case. We are not allowed |
| 538 // to dereference the allocation site and rather have to postpone all checks | 538 // to dereference the allocation site and rather have to postpone all checks |
| 539 // till actually merging the data. | 539 // till actually merging the data. |
| 540 Address key = memento_candidate->GetAllocationSiteUnchecked(); | 540 Address key = memento_candidate->GetAllocationSiteUnchecked(); |
| 541 HashMap::Entry* e = | 541 base::HashMap::Entry* e = |
| 542 pretenuring_feedback->LookupOrInsert(key, ObjectHash(key)); | 542 pretenuring_feedback->LookupOrInsert(key, ObjectHash(key)); |
| 543 DCHECK(e != nullptr); | 543 DCHECK(e != nullptr); |
| 544 (*bit_cast<intptr_t*>(&e->value))++; | 544 (*bit_cast<intptr_t*>(&e->value))++; |
| 545 } | 545 } |
| 546 } | 546 } |
| 547 | 547 |
| 548 | 548 |
| 549 void Heap::RemoveAllocationSitePretenuringFeedback(AllocationSite* site) { | 549 void Heap::RemoveAllocationSitePretenuringFeedback(AllocationSite* site) { |
| 550 global_pretenuring_feedback_->Remove( | 550 global_pretenuring_feedback_->Remove( |
| 551 site, static_cast<uint32_t>(bit_cast<uintptr_t>(site))); | 551 site, static_cast<uint32_t>(bit_cast<uintptr_t>(site))); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 | 734 |
| 735 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 735 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
| 736 for (Object** current = start; current < end; current++) { | 736 for (Object** current = start; current < end; current++) { |
| 737 CHECK((*current)->IsSmi()); | 737 CHECK((*current)->IsSmi()); |
| 738 } | 738 } |
| 739 } | 739 } |
| 740 } // namespace internal | 740 } // namespace internal |
| 741 } // namespace v8 | 741 } // namespace v8 |
| 742 | 742 |
| 743 #endif // V8_HEAP_HEAP_INL_H_ | 743 #endif // V8_HEAP_HEAP_INL_H_ |
| OLD | NEW |