• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2021 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_SNAPSHOT_SERIALIZER_INL_H_
6 #define V8_SNAPSHOT_SERIALIZER_INL_H_
7 
8 #include "src/roots/roots-inl.h"
9 #include "src/snapshot/serializer.h"
10 
11 namespace v8 {
12 namespace internal {
13 
IsNotMappedSymbol(HeapObject obj)14 bool Serializer::IsNotMappedSymbol(HeapObject obj) const {
15   Object not_mapped_symbol = ReadOnlyRoots(isolate()).not_mapped_symbol();
16   if (V8_EXTERNAL_CODE_SPACE_BOOL) {
17     // It's possible that a Code object might have the same compressed value
18     // as the not_mapped_symbol, so we must compare full pointers.
19     // TODO(v8:11880): Avoid the need for this special case by never putting
20     // Code references anywhere except the CodeDadaContainer objects.
21     // In particular, the Code objects should not appear in serializer's
22     // identity map. This should be possible once the IsolateData::builtins
23     // table is migrated to contain CodeT references.
24     return obj.ptr() == not_mapped_symbol.ptr();
25   }
26   return obj == not_mapped_symbol;
27 }
28 
29 }  // namespace internal
30 }  // namespace v8
31 
32 #endif  // V8_SNAPSHOT_SERIALIZER_INL_H_
33