11cb0ef41Sopenharmony_ci// Copyright 2021 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#ifndef V8_SNAPSHOT_EMBEDDED_EMBEDDED_FILE_WRITER_INTERFACE_H_
61cb0ef41Sopenharmony_ci#define V8_SNAPSHOT_EMBEDDED_EMBEDDED_FILE_WRITER_INTERFACE_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include <string>
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ci#include "v8config.h"  // NOLINT(build/include_directory)
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_cinamespace v8 {
131cb0ef41Sopenharmony_cinamespace internal {
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ciclass Builtins;
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ci#if defined(V8_OS_WIN64)
181cb0ef41Sopenharmony_cinamespace win64_unwindinfo {
191cb0ef41Sopenharmony_ciclass BuiltinUnwindInfo;
201cb0ef41Sopenharmony_ci}
211cb0ef41Sopenharmony_ci#endif  // V8_OS_WIN64
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_cistatic constexpr char kDefaultEmbeddedVariant[] = "Default";
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_cistruct LabelInfo {
261cb0ef41Sopenharmony_ci  int offset;
271cb0ef41Sopenharmony_ci  std::string name;
281cb0ef41Sopenharmony_ci};
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci// Detailed source-code information about builtins can only be obtained by
311cb0ef41Sopenharmony_ci// registration on the isolate during compilation.
321cb0ef41Sopenharmony_ciclass EmbeddedFileWriterInterface {
331cb0ef41Sopenharmony_ci public:
341cb0ef41Sopenharmony_ci  // We maintain a database of filenames to synthetic IDs.
351cb0ef41Sopenharmony_ci  virtual int LookupOrAddExternallyCompiledFilename(const char* filename) = 0;
361cb0ef41Sopenharmony_ci  virtual const char* GetExternallyCompiledFilename(int index) const = 0;
371cb0ef41Sopenharmony_ci  virtual int GetExternallyCompiledFilenameCount() const = 0;
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_ci  // The isolate will call the method below just prior to replacing the
401cb0ef41Sopenharmony_ci  // compiled builtin Code objects with trampolines.
411cb0ef41Sopenharmony_ci  virtual void PrepareBuiltinSourcePositionMap(Builtins* builtins) = 0;
421cb0ef41Sopenharmony_ci
431cb0ef41Sopenharmony_ci  virtual void PrepareBuiltinLabelInfoMap(int create_offset,
441cb0ef41Sopenharmony_ci                                          int invoke_offset) = 0;
451cb0ef41Sopenharmony_ci
461cb0ef41Sopenharmony_ci#if defined(V8_OS_WIN64)
471cb0ef41Sopenharmony_ci  virtual void SetBuiltinUnwindData(
481cb0ef41Sopenharmony_ci      Builtin builtin,
491cb0ef41Sopenharmony_ci      const win64_unwindinfo::BuiltinUnwindInfo& unwinding_info) = 0;
501cb0ef41Sopenharmony_ci#endif  // V8_OS_WIN64
511cb0ef41Sopenharmony_ci};
521cb0ef41Sopenharmony_ci
531cb0ef41Sopenharmony_ci}  // namespace internal
541cb0ef41Sopenharmony_ci}  // namespace v8
551cb0ef41Sopenharmony_ci
561cb0ef41Sopenharmony_ci#endif  // V8_SNAPSHOT_EMBEDDED_EMBEDDED_FILE_WRITER_INTERFACE_H_
57