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 #include "src/heap/heap.h" | 5 #include "src/heap/heap.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/ast/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 const HashMap& local_pretenuring_feedback) { | 512 const HashMap& local_pretenuring_feedback) { |
513 AllocationSite* site = nullptr; | 513 AllocationSite* site = nullptr; |
514 for (HashMap::Entry* local_entry = local_pretenuring_feedback.Start(); | 514 for (HashMap::Entry* local_entry = local_pretenuring_feedback.Start(); |
515 local_entry != nullptr; | 515 local_entry != nullptr; |
516 local_entry = local_pretenuring_feedback.Next(local_entry)) { | 516 local_entry = local_pretenuring_feedback.Next(local_entry)) { |
517 site = reinterpret_cast<AllocationSite*>(local_entry->key); | 517 site = reinterpret_cast<AllocationSite*>(local_entry->key); |
518 MapWord map_word = site->map_word(); | 518 MapWord map_word = site->map_word(); |
519 if (map_word.IsForwardingAddress()) { | 519 if (map_word.IsForwardingAddress()) { |
520 site = AllocationSite::cast(map_word.ToForwardingAddress()); | 520 site = AllocationSite::cast(map_word.ToForwardingAddress()); |
521 } | 521 } |
522 | 522 DCHECK(site->IsAllocationSite()); |
523 // We have not validated the allocation site yet, since we have not | |
524 // dereferenced the site during collecting information. | |
525 // This is an inlined check of AllocationMemento::IsValid. | |
526 if (!site->IsAllocationSite() || site->IsZombie()) continue; | |
527 | |
528 int value = | 523 int value = |
529 static_cast<int>(reinterpret_cast<intptr_t>(local_entry->value)); | 524 static_cast<int>(reinterpret_cast<intptr_t>(local_entry->value)); |
530 DCHECK_GT(value, 0); | 525 DCHECK_GT(value, 0); |
531 | 526 |
532 if (site->IncrementMementoFoundCount(value)) { | 527 { |
533 global_pretenuring_feedback_->LookupOrInsert(site, | 528 // TODO(mlippautz): For parallel processing we need synchronization here. |
534 ObjectHash(site->address())); | 529 if (site->IncrementMementoFoundCount(value)) { |
| 530 global_pretenuring_feedback_->LookupOrInsert( |
| 531 site, static_cast<uint32_t>(bit_cast<uintptr_t>(site))); |
| 532 } |
535 } | 533 } |
536 } | 534 } |
537 } | 535 } |
538 | 536 |
539 | 537 |
540 class Heap::PretenuringScope { | 538 class Heap::PretenuringScope { |
541 public: | 539 public: |
542 explicit PretenuringScope(Heap* heap) : heap_(heap) { | 540 explicit PretenuringScope(Heap* heap) : heap_(heap) { |
543 heap_->global_pretenuring_feedback_ = | 541 heap_->global_pretenuring_feedback_ = |
544 new HashMap(HashMap::PointersMatch, kInitialFeedbackCapacity); | 542 new HashMap(HashMap::PointersMatch, kInitialFeedbackCapacity); |
(...skipping 5701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6246 } | 6244 } |
6247 | 6245 |
6248 | 6246 |
6249 // static | 6247 // static |
6250 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6248 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6251 return StaticVisitorBase::GetVisitorId(map); | 6249 return StaticVisitorBase::GetVisitorId(map); |
6252 } | 6250 } |
6253 | 6251 |
6254 } // namespace internal | 6252 } // namespace internal |
6255 } // namespace v8 | 6253 } // namespace v8 |
OLD | NEW |