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 DCHECK(site->IsAllocationSite()); | 522 |
| 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 |
523 int value = | 528 int value = |
524 static_cast<int>(reinterpret_cast<intptr_t>(local_entry->value)); | 529 static_cast<int>(reinterpret_cast<intptr_t>(local_entry->value)); |
525 DCHECK_GT(value, 0); | 530 DCHECK_GT(value, 0); |
526 | 531 |
527 { | 532 if (site->IncrementMementoFoundCount(value)) { |
528 // TODO(mlippautz): For parallel processing we need synchronization here. | 533 global_pretenuring_feedback_->LookupOrInsert( |
529 if (site->IncrementMementoFoundCount(value)) { | 534 site, static_cast<uint32_t>(bit_cast<uintptr_t>(site) >> 3)); |
530 global_pretenuring_feedback_->LookupOrInsert( | |
531 site, static_cast<uint32_t>(bit_cast<uintptr_t>(site))); | |
532 } | |
533 } | 535 } |
534 } | 536 } |
535 } | 537 } |
536 | 538 |
537 | 539 |
538 class Heap::PretenuringScope { | 540 class Heap::PretenuringScope { |
539 public: | 541 public: |
540 explicit PretenuringScope(Heap* heap) : heap_(heap) { | 542 explicit PretenuringScope(Heap* heap) : heap_(heap) { |
541 heap_->global_pretenuring_feedback_ = | 543 heap_->global_pretenuring_feedback_ = |
542 new HashMap(HashMap::PointersMatch, kInitialFeedbackCapacity); | 544 new HashMap(HashMap::PointersMatch, kInitialFeedbackCapacity); |
(...skipping 5699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6242 } | 6244 } |
6243 | 6245 |
6244 | 6246 |
6245 // static | 6247 // static |
6246 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6248 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6247 return StaticVisitorBase::GetVisitorId(map); | 6249 return StaticVisitorBase::GetVisitorId(map); |
6248 } | 6250 } |
6249 | 6251 |
6250 } // namespace internal | 6252 } // namespace internal |
6251 } // namespace v8 | 6253 } // namespace v8 |
OLD | NEW |