LCOV - code coverage report
Current view: top level - src/heap - invalidated-slots-inl.h (source / functions) Hit Total Coverage
Test: app.info Lines: 17 17 100.0 %
Date: 2019-04-19 Functions: 1 1 100.0 %

          Line data    Source code
       1             : // Copyright 2017 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_HEAP_INVALIDATED_SLOTS_INL_H_
       6             : #define V8_HEAP_INVALIDATED_SLOTS_INL_H_
       7             : 
       8             : #include <map>
       9             : 
      10             : #include "src/allocation.h"
      11             : #include "src/heap/invalidated-slots.h"
      12             : #include "src/heap/spaces.h"
      13             : #include "src/objects-body-descriptors-inl.h"
      14             : #include "src/objects-body-descriptors.h"
      15             : #include "src/objects.h"
      16             : 
      17             : namespace v8 {
      18             : namespace internal {
      19             : 
      20    37028142 : bool InvalidatedSlotsFilter::IsValid(Address slot) {
      21             : #ifdef DEBUG
      22             :   DCHECK_LT(slot, sentinel_);
      23             :   // Slots must come in non-decreasing order.
      24             :   DCHECK_LE(last_slot_, slot);
      25             :   last_slot_ = slot;
      26             : #endif
      27    37046510 :   while (slot >= invalidated_end_) {
      28             :     ++iterator_;
      29       18368 :     if (iterator_ != iterator_end_) {
      30             :       // Invalidated ranges must not overlap.
      31             :       DCHECK_LE(invalidated_end_, iterator_->first->address());
      32       18309 :       invalidated_start_ = iterator_->first->address();
      33       18309 :       invalidated_end_ = invalidated_start_ + iterator_->second;
      34       18309 :       invalidated_object_ = HeapObject();
      35       18309 :       invalidated_object_size_ = 0;
      36             :     } else {
      37          59 :       invalidated_start_ = sentinel_;
      38          59 :       invalidated_end_ = sentinel_;
      39             :     }
      40             :   }
      41             :   // Now the invalidated region ends after the slot.
      42    37028142 :   if (slot < invalidated_start_) {
      43             :     // The invalidated region starts after the slot.
      44             :     return true;
      45             :   }
      46             :   // The invalidated region includes the slot.
      47             :   // Ask the object if the slot is valid.
      48      618946 :   if (invalidated_object_.is_null()) {
      49       17961 :     invalidated_object_ = HeapObject::FromAddress(invalidated_start_);
      50             :     DCHECK(!invalidated_object_->IsFiller());
      51             :     invalidated_object_size_ =
      52       17961 :         invalidated_object_->SizeFromMap(invalidated_object_->map());
      53             :   }
      54      618946 :   int offset = static_cast<int>(slot - invalidated_start_);
      55             :   DCHECK_GT(offset, 0);
      56             :   DCHECK_LE(invalidated_object_size_,
      57             :             static_cast<int>(invalidated_end_ - invalidated_start_));
      58             : 
      59      618946 :   if (offset >= invalidated_object_size_) {
      60      235775 :     return slots_in_free_space_are_valid_;
      61             :   }
      62      383171 :   return invalidated_object_->IsValidSlot(invalidated_object_->map(), offset);
      63             : }
      64             : 
      65             : }  // namespace internal
      66             : }  // namespace v8
      67             : 
      68             : #endif  // V8_HEAP_INVALIDATED_SLOTS_INL_H_

Generated by: LCOV version 1.10