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 : #include "src/heap/invalidated-slots.h"
6 : #include "src/heap/spaces.h"
7 :
8 : namespace v8 {
9 : namespace internal {
10 :
11 19470 : InvalidatedSlotsFilter::InvalidatedSlotsFilter(MemoryChunk* chunk) {
12 : DCHECK_IMPLIES(chunk->invalidated_slots() != nullptr,
13 : chunk->owner()->identity() == OLD_SPACE);
14 : InvalidatedSlots* invalidated_slots =
15 6490 : chunk->invalidated_slots() ? chunk->invalidated_slots() : &empty_;
16 6490 : iterator_ = invalidated_slots->begin();
17 6490 : iterator_end_ = invalidated_slots->end();
18 6490 : sentinel_ = chunk->area_end();
19 6490 : if (iterator_ != iterator_end_) {
20 170 : invalidated_start_ = iterator_->first->address();
21 170 : invalidated_end_ = invalidated_start_ + iterator_->second;
22 : } else {
23 6320 : invalidated_start_ = sentinel_;
24 6320 : invalidated_end_ = sentinel_;
25 : }
26 : // These values will be lazily set when needed.
27 6490 : invalidated_object_ = nullptr;
28 6490 : invalidated_object_size_ = 0;
29 : #ifdef DEBUG
30 : last_slot_ = chunk->area_start();
31 : #endif
32 6490 : }
33 :
34 : } // namespace internal
35 : } // namespace v8
|