• 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_EMBEDDED_EMBEDDED_FILE_WRITER_INTERFACE_H_
6 #define V8_SNAPSHOT_EMBEDDED_EMBEDDED_FILE_WRITER_INTERFACE_H_
7 
8 #include <string>
9 
10 #include "v8config.h"  // NOLINT(build/include_directory)
11 
12 namespace v8 {
13 namespace internal {
14 
15 class Builtins;
16 
17 #if defined(V8_OS_WIN64)
18 namespace win64_unwindinfo {
19 class BuiltinUnwindInfo;
20 }
21 #endif  // V8_OS_WIN64
22 
23 static constexpr char kDefaultEmbeddedVariant[] = "Default";
24 
25 struct LabelInfo {
26   int offset;
27   std::string name;
28 };
29 
30 // Detailed source-code information about builtins can only be obtained by
31 // registration on the isolate during compilation.
32 class EmbeddedFileWriterInterface {
33  public:
34   // We maintain a database of filenames to synthetic IDs.
35   virtual int LookupOrAddExternallyCompiledFilename(const char* filename) = 0;
36   virtual const char* GetExternallyCompiledFilename(int index) const = 0;
37   virtual int GetExternallyCompiledFilenameCount() const = 0;
38 
39   // The isolate will call the method below just prior to replacing the
40   // compiled builtin Code objects with trampolines.
41   virtual void PrepareBuiltinSourcePositionMap(Builtins* builtins) = 0;
42 
43   virtual void PrepareBuiltinLabelInfoMap(int create_offset,
44                                           int invoke_offset) = 0;
45 
46 #if defined(V8_OS_WIN64)
47   virtual void SetBuiltinUnwindData(
48       Builtin builtin,
49       const win64_unwindinfo::BuiltinUnwindInfo& unwinding_info) = 0;
50 #endif  // V8_OS_WIN64
51 };
52 
53 }  // namespace internal
54 }  // namespace v8
55 
56 #endif  // V8_SNAPSHOT_EMBEDDED_EMBEDDED_FILE_WRITER_INTERFACE_H_
57