From be5ccde28abd47eefcd389f764df17294de3dfbf Mon Sep 17 00:00:00 2001 From: Dan Elphick Date: Mon, 1 Mar 2021 18:30:26 +0000 Subject: [PATCH] [build] Split out EmbeddedFileWriterInterface To reduce gn check errors, this moves EmbeddedFileWriterInterface into its own header file that can be included directly by isolate.cc since embedded-file-writer.h is in the mksnapshot target. Bug: v8:7330 Change-Id: I3bfb1f48c646680b71189e8229b8df54ead9eea0 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2727817 Auto-Submit: Dan Elphick Commit-Queue: Jakob Gruber Reviewed-by: Jakob Gruber Cr-Commit-Position: refs/heads/master@{#73118} --- BUILD.gn | 1 + src/execution/isolate.cc | 2 +- .../embedded/embedded-file-writer-interface.h | 56 +++++++++++++++++++ src/snapshot/embedded/embedded-file-writer.h | 32 +---------- 4 files changed, 59 insertions(+), 32 deletions(-) create mode 100644 src/snapshot/embedded/embedded-file-writer-interface.h diff --git a/BUILD.gn b/BUILD.gn index d240ccf58a..b8b5d57f09 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -2888,6 +2888,7 @@ v8_header_set("v8_internal_headers") { "src/snapshot/context-serializer.h", "src/snapshot/deserializer.h", "src/snapshot/embedded/embedded-data.h", + "src/snapshot/embedded/embedded-file-writer-interface.h", "src/snapshot/object-deserializer.h", "src/snapshot/read-only-deserializer.h", "src/snapshot/read-only-serializer.h", diff --git a/src/execution/isolate.cc b/src/execution/isolate.cc index 248cba7a20..8b9cc8dadf 100644 --- a/src/execution/isolate.cc +++ b/src/execution/isolate.cc @@ -79,7 +79,7 @@ #include "src/profiler/tracing-cpu-profiler.h" #include "src/regexp/regexp-stack.h" #include "src/snapshot/embedded/embedded-data.h" -#include "src/snapshot/embedded/embedded-file-writer.h" +#include "src/snapshot/embedded/embedded-file-writer-interface.h" #include "src/snapshot/read-only-deserializer.h" #include "src/snapshot/startup-deserializer.h" #include "src/strings/string-builder-inl.h" diff --git a/src/snapshot/embedded/embedded-file-writer-interface.h b/src/snapshot/embedded/embedded-file-writer-interface.h new file mode 100644 index 0000000000..0873eecbb7 --- /dev/null +++ b/src/snapshot/embedded/embedded-file-writer-interface.h @@ -0,0 +1,56 @@ +// 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_EMBEDDED_EMBEDDED_FILE_WRITER_INTERFACE_H_ +#define V8_SNAPSHOT_EMBEDDED_EMBEDDED_FILE_WRITER_INTERFACE_H_ + +#include + +#include "v8config.h" // NOLINT(build/include_directory) + +namespace v8 { +namespace internal { + +class Builtins; + +#if defined(V8_OS_WIN64) +namespace win64_unwindinfo { +class BuiltinUnwindInfo; +} +#endif // V8_OS_WIN64 + +static constexpr char kDefaultEmbeddedVariant[] = "Default"; + +struct LabelInfo { + int offset; + std::string name; +}; + +// Detailed source-code information about builtins can only be obtained by +// registration on the isolate during compilation. +class EmbeddedFileWriterInterface { + public: + // We maintain a database of filenames to synthetic IDs. + virtual int LookupOrAddExternallyCompiledFilename(const char* filename) = 0; + virtual const char* GetExternallyCompiledFilename(int index) const = 0; + virtual int GetExternallyCompiledFilenameCount() const = 0; + + // The isolate will call the method below just prior to replacing the + // compiled builtin Code objects with trampolines. + virtual void PrepareBuiltinSourcePositionMap(Builtins* builtins) = 0; + + virtual void PrepareBuiltinLabelInfoMap(int create_offset, + int invoke_offset) = 0; + +#if defined(V8_OS_WIN64) + virtual void SetBuiltinUnwindData( + int builtin_index, + const win64_unwindinfo::BuiltinUnwindInfo& unwinding_info) = 0; +#endif // V8_OS_WIN64 +}; + +} // namespace internal +} // namespace v8 + +#endif // V8_SNAPSHOT_EMBEDDED_EMBEDDED_FILE_WRITER_INTERFACE_H_ diff --git a/src/snapshot/embedded/embedded-file-writer.h b/src/snapshot/embedded/embedded-file-writer.h index 6e7ec59f44..0650f070a2 100644 --- a/src/snapshot/embedded/embedded-file-writer.h +++ b/src/snapshot/embedded/embedded-file-writer.h @@ -12,6 +12,7 @@ #include "src/common/globals.h" #include "src/snapshot/embedded/embedded-data.h" +#include "src/snapshot/embedded/embedded-file-writer-interface.h" #include "src/snapshot/embedded/platform-embedded-file-writer-base.h" #if defined(V8_OS_WIN64) @@ -21,37 +22,6 @@ namespace v8 { namespace internal { - -static constexpr char kDefaultEmbeddedVariant[] = "Default"; - -struct LabelInfo { - int offset; - std::string name; -}; - -// Detailed source-code information about builtins can only be obtained by -// registration on the isolate during compilation. -class EmbeddedFileWriterInterface { - public: - // We maintain a database of filenames to synthetic IDs. - virtual int LookupOrAddExternallyCompiledFilename(const char* filename) = 0; - virtual const char* GetExternallyCompiledFilename(int index) const = 0; - virtual int GetExternallyCompiledFilenameCount() const = 0; - - // The isolate will call the method below just prior to replacing the - // compiled builtin Code objects with trampolines. - virtual void PrepareBuiltinSourcePositionMap(Builtins* builtins) = 0; - - virtual void PrepareBuiltinLabelInfoMap(int create_offset, - int invoke_offset) = 0; - -#if defined(V8_OS_WIN64) - virtual void SetBuiltinUnwindData( - int builtin_index, - const win64_unwindinfo::BuiltinUnwindInfo& unwinding_info) = 0; -#endif // V8_OS_WIN64 -}; - // Generates the embedded.S file which is later compiled into the final v8 // binary. Its contents are exported through two symbols: //