summaryrefslogtreecommitdiff
path: root/deps/v8/src/snapshot/serializer-inl.h
blob: 681d90d60b2d46111cbdf458b5647c0c6dfdcd1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2021 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_SNAPSHOT_SERIALIZER_INL_H_
#define V8_SNAPSHOT_SERIALIZER_INL_H_

#include "src/roots/roots-inl.h"
#include "src/snapshot/serializer.h"

namespace v8 {
namespace internal {

bool Serializer::IsNotMappedSymbol(HeapObject obj) const {
  Object not_mapped_symbol = ReadOnlyRoots(isolate()).not_mapped_symbol();
  if (V8_EXTERNAL_CODE_SPACE_BOOL) {
    // It's possible that a Code object might have the same compressed value
    // as the not_mapped_symbol, so we must compare full pointers.
    // TODO(v8:11880): Avoid the need for this special case by never putting
    // Code references anywhere except the CodeDadaContainer objects.
    // In particular, the Code objects should not appear in serializer's
    // identity map. This should be possible once the IsolateData::builtins
    // table is migrated to contain CodeT references.
    return obj.ptr() == not_mapped_symbol.ptr();
  }
  return obj == not_mapped_symbol;
}

}  // namespace internal
}  // namespace v8

#endif  // V8_SNAPSHOT_SERIALIZER_INL_H_