[mksnapshot] Split out platform embedded file writers

Split out embedded file writers for AIX, Windows, and macOS. These are
no longer selected by compile-time defines (e.g. V8_OS_WIN,
V8_TARGET_ARCH_X64) but by --target-os and --target-arch runtime
flags.

Bug: v8:9103
Change-Id: I5d5cac15e48b5c743d74f8a382606a6194ba7865
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1624216
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61785}
diff --git a/BUILD.gn b/BUILD.gn
index 32278a4..11524ba 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -3792,10 +3792,16 @@
     sources = [
       "src/snapshot/embedded-file-writer.cc",
       "src/snapshot/embedded-file-writer.h",
+      "src/snapshot/embedded/platform-embedded-file-writer-aix.cc",
+      "src/snapshot/embedded/platform-embedded-file-writer-aix.h",
       "src/snapshot/embedded/platform-embedded-file-writer-base.cc",
       "src/snapshot/embedded/platform-embedded-file-writer-base.h",
       "src/snapshot/embedded/platform-embedded-file-writer-generic.cc",
       "src/snapshot/embedded/platform-embedded-file-writer-generic.h",
+      "src/snapshot/embedded/platform-embedded-file-writer-mac.cc",
+      "src/snapshot/embedded/platform-embedded-file-writer-mac.h",
+      "src/snapshot/embedded/platform-embedded-file-writer-win.cc",
+      "src/snapshot/embedded/platform-embedded-file-writer-win.h",
       "src/snapshot/mksnapshot.cc",
     ]
 
diff --git a/src/snapshot/embedded-file-writer.cc b/src/snapshot/embedded-file-writer.cc
index fee4391..cf8d505 100644
--- a/src/snapshot/embedded-file-writer.cc
+++ b/src/snapshot/embedded-file-writer.cc
@@ -9,8 +9,9 @@
 #include "src/codegen/source-position-table.h"
 #include "src/objects/code-inl.h"
 
-// TODO(jgruber): Remove once windows-specific code is extracted.
-#include "src/snapshot/embedded/platform-embedded-file-writer-generic.h"
+// TODO(jgruber): Refactor to move windows-specific code into the
+// windows-specific file writer.
+#include "src/snapshot/embedded/platform-embedded-file-writer-win.h"
 
 namespace v8 {
 namespace internal {
@@ -286,47 +287,47 @@
 void EmbeddedFileWriter::WriteUnwindInfoEntry(PlatformEmbeddedFileWriterBase* w,
                                               uint64_t rva_start,
                                               uint64_t rva_end) const {
-  PlatformEmbeddedFileWriterGeneric* w_gen =
-      static_cast<PlatformEmbeddedFileWriterGeneric*>(w);
-  w_gen->DeclareRvaToSymbol(EmbeddedBlobDataSymbol().c_str(), rva_start);
-  w_gen->DeclareRvaToSymbol(EmbeddedBlobDataSymbol().c_str(), rva_end);
-  w_gen->DeclareRvaToSymbol(BuiltinsUnwindInfoLabel().c_str());
+  PlatformEmbeddedFileWriterWin* w_win =
+      static_cast<PlatformEmbeddedFileWriterWin*>(w);
+  w_win->DeclareRvaToSymbol(EmbeddedBlobDataSymbol().c_str(), rva_start);
+  w_win->DeclareRvaToSymbol(EmbeddedBlobDataSymbol().c_str(), rva_end);
+  w_win->DeclareRvaToSymbol(BuiltinsUnwindInfoLabel().c_str());
 }
 
 void EmbeddedFileWriter::WriteUnwindInfo(PlatformEmbeddedFileWriterBase* w,
                                          const i::EmbeddedData* blob) const {
-  PlatformEmbeddedFileWriterGeneric* w_gen =
-      static_cast<PlatformEmbeddedFileWriterGeneric*>(w);
+  PlatformEmbeddedFileWriterWin* w_win =
+      static_cast<PlatformEmbeddedFileWriterWin*>(w);
 
   // Emit an UNWIND_INFO (XDATA) struct, which contains the unwinding
   // information that is used for all builtin functions.
   DCHECK(win64_unwindinfo::CanEmitUnwindInfoForBuiltins());
-  w_gen->Comment("xdata for all the code in the embedded blob.");
-  w_gen->DeclareExternalFunction(CRASH_HANDLER_FUNCTION_NAME_STRING);
+  w_win->Comment("xdata for all the code in the embedded blob.");
+  w_win->DeclareExternalFunction(CRASH_HANDLER_FUNCTION_NAME_STRING);
 
-  w_gen->StartXdataSection();
+  w_win->StartXdataSection();
   {
-    w_gen->DeclareLabel(BuiltinsUnwindInfoLabel().c_str());
+    w_win->DeclareLabel(BuiltinsUnwindInfoLabel().c_str());
     std::vector<uint8_t> xdata =
         win64_unwindinfo::GetUnwindInfoForBuiltinFunctions();
-    WriteBinaryContentsAsInlineAssembly(w_gen, xdata.data(),
+    WriteBinaryContentsAsInlineAssembly(w_win, xdata.data(),
                                         static_cast<uint32_t>(xdata.size()));
-    w_gen->Comment("    ExceptionHandler");
-    w_gen->DeclareRvaToSymbol(CRASH_HANDLER_FUNCTION_NAME_STRING);
+    w_win->Comment("    ExceptionHandler");
+    w_win->DeclareRvaToSymbol(CRASH_HANDLER_FUNCTION_NAME_STRING);
   }
-  w_gen->EndXdataSection();
-  w_gen->Newline();
+  w_win->EndXdataSection();
+  w_win->Newline();
 
   // Emit a RUNTIME_FUNCTION (PDATA) entry for each builtin function, as
   // documented here:
   // https://docs.microsoft.com/en-us/cpp/build/exception-handling-x64.
-  w_gen->Comment(
+  w_win->Comment(
       "pdata for all the code in the embedded blob (structs of type "
       "RUNTIME_FUNCTION).");
-  w_gen->Comment("    BeginAddress");
-  w_gen->Comment("    EndAddress");
-  w_gen->Comment("    UnwindInfoAddress");
-  w_gen->StartPdataSection();
+  w_win->Comment("    BeginAddress");
+  w_win->Comment("    EndAddress");
+  w_win->Comment("    UnwindInfoAddress");
+  w_win->StartPdataSection();
   {
     Address prev_builtin_end_offset = 0;
     for (int i = 0; i < Builtins::builtin_count; i++) {
@@ -350,7 +351,7 @@
         // a few bytes before the beginning of the function, if it does not
         // overlap the end of the previous builtin.
         WriteUnwindInfoEntry(
-            w_gen,
+            w_win,
             std::max(prev_builtin_end_offset,
                      builtin_start_offset - win64_unwindinfo::kRbpPrefixLength),
             builtin_start_offset + builtin_size);
@@ -362,7 +363,7 @@
         // we also emit a PDATA entry for the initial block of code up to the
         // first 'push rbp', like in the case above.
         if (xdata_desc[0] > 0) {
-          WriteUnwindInfoEntry(w_gen,
+          WriteUnwindInfoEntry(w_win,
                                std::max(prev_builtin_end_offset,
                                         builtin_start_offset -
                                             win64_unwindinfo::kRbpPrefixLength),
@@ -373,17 +374,17 @@
           int chunk_start = xdata_desc[j];
           int chunk_end =
               (j < xdata_desc.size() - 1) ? xdata_desc[j + 1] : builtin_size;
-          WriteUnwindInfoEntry(w_gen, builtin_start_offset + chunk_start,
+          WriteUnwindInfoEntry(w_win, builtin_start_offset + chunk_start,
                                builtin_start_offset + chunk_end);
         }
       }
 
       prev_builtin_end_offset = builtin_start_offset + builtin_size;
-      w_gen->Newline();
+      w_win->Newline();
     }
   }
-  w_gen->EndPdataSection();
-  w_gen->Newline();
+  w_win->EndPdataSection();
+  w_win->Newline();
 }
 #endif
 
diff --git a/src/snapshot/embedded/platform-embedded-file-writer-aix.cc b/src/snapshot/embedded/platform-embedded-file-writer-aix.cc
new file mode 100644
index 0000000..0c03f34
--- /dev/null
+++ b/src/snapshot/embedded/platform-embedded-file-writer-aix.cc
@@ -0,0 +1,120 @@
+// Copyright 2019 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.
+
+#include "src/snapshot/embedded/platform-embedded-file-writer-aix.h"
+
+namespace v8 {
+namespace internal {
+
+#define SYMBOL_PREFIX ""
+
+namespace {
+
+const char* DirectiveAsString(DataDirective directive) {
+  switch (directive) {
+    case kByte:
+      return ".byte";
+    case kLong:
+      return ".long";
+    case kQuad:
+      return ".llong";
+    default:
+      UNREACHABLE();
+  }
+}
+
+}  // namespace
+
+void PlatformEmbeddedFileWriterAIX::SectionText() {
+  fprintf(fp_, ".csect .text[PR]\n");
+}
+
+void PlatformEmbeddedFileWriterAIX::SectionData() {
+  fprintf(fp_, ".csect .data[RW]\n");
+}
+
+void PlatformEmbeddedFileWriterAIX::SectionRoData() {
+  fprintf(fp_, ".csect[RO]\n");
+}
+
+void PlatformEmbeddedFileWriterAIX::DeclareUint32(const char* name,
+                                                  uint32_t value) {
+  DeclareSymbolGlobal(name);
+  fprintf(fp_, ".align 2\n");
+  fprintf(fp_, "%s:\n", name);
+  IndentedDataDirective(kLong);
+  fprintf(fp_, "%d\n", value);
+  Newline();
+}
+
+void PlatformEmbeddedFileWriterAIX::DeclarePointerToSymbol(const char* name,
+                                                           const char* target) {
+  AlignToCodeAlignment();
+  DeclareLabel(name);
+  fprintf(fp_, "  %s %s\n", DirectiveAsString(PointerSizeDirective()), target);
+  Newline();
+}
+
+void PlatformEmbeddedFileWriterAIX::DeclareSymbolGlobal(const char* name) {
+  fprintf(fp_, ".globl %s\n", name);
+}
+
+void PlatformEmbeddedFileWriterAIX::AlignToCodeAlignment() {
+  fprintf(fp_, ".align 5\n");
+}
+
+void PlatformEmbeddedFileWriterAIX::AlignToDataAlignment() {
+  fprintf(fp_, ".align 3\n");
+}
+
+void PlatformEmbeddedFileWriterAIX::Comment(const char* string) {
+  fprintf(fp_, "// %s\n", string);
+}
+
+void PlatformEmbeddedFileWriterAIX::DeclareLabel(const char* name) {
+  DeclareSymbolGlobal(name);
+  fprintf(fp_, "%s:\n", name);
+}
+
+void PlatformEmbeddedFileWriterAIX::SourceInfo(int fileid, const char* filename,
+                                               int line) {
+  fprintf(fp_, ".xline %d, \"%s\"\n", line, filename);
+}
+
+void PlatformEmbeddedFileWriterAIX::DeclareFunctionBegin(const char* name) {
+  Newline();
+  DeclareSymbolGlobal(name);
+  fprintf(fp_, ".csect %s[DS]\n", name);  // function descriptor
+  fprintf(fp_, "%s:\n", name);
+  fprintf(fp_, ".llong .%s, 0, 0\n", name);
+  SectionText();
+  fprintf(fp_, ".%s:\n", name);
+}
+
+void PlatformEmbeddedFileWriterAIX::DeclareFunctionEnd(const char* name) {}
+
+int PlatformEmbeddedFileWriterAIX::HexLiteral(uint64_t value) {
+  return fprintf(fp_, "0x%" PRIx64, value);
+}
+
+void PlatformEmbeddedFileWriterAIX::FilePrologue() {}
+
+void PlatformEmbeddedFileWriterAIX::DeclareExternalFilename(
+    int fileid, const char* filename) {
+  // File name cannot be declared with an identifier on AIX.
+  // We use the SourceInfo method to emit debug info in
+  //.xline <line-number> <file-name> format.
+}
+
+void PlatformEmbeddedFileWriterAIX::FileEpilogue() {}
+
+int PlatformEmbeddedFileWriterAIX::IndentedDataDirective(
+    DataDirective directive) {
+  return fprintf(fp_, "  %s ", DirectiveAsString(directive));
+}
+
+#undef SYMBOL_PREFIX
+
+}  // namespace internal
+}  // namespace v8
diff --git a/src/snapshot/embedded/platform-embedded-file-writer-aix.h b/src/snapshot/embedded/platform-embedded-file-writer-aix.h
new file mode 100644
index 0000000..0eee55d
--- /dev/null
+++ b/src/snapshot/embedded/platform-embedded-file-writer-aix.h
@@ -0,0 +1,61 @@
+// Copyright 2019 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_PLATFORM_EMBEDDED_FILE_WRITER_AIX_H_
+#define V8_SNAPSHOT_EMBEDDED_PLATFORM_EMBEDDED_FILE_WRITER_AIX_H_
+
+#include "src/base/macros.h"
+#include "src/snapshot/embedded/platform-embedded-file-writer-base.h"
+
+namespace v8 {
+namespace internal {
+
+class PlatformEmbeddedFileWriterAIX : public PlatformEmbeddedFileWriterBase {
+ public:
+  PlatformEmbeddedFileWriterAIX(EmbeddedTargetArch target_arch,
+                                EmbeddedTargetOs target_os)
+      : target_arch_(target_arch), target_os_(target_os) {
+    USE(target_arch_);
+    USE(target_os_);
+    DCHECK_EQ(target_os_, EmbeddedTargetOs::kAIX);
+  }
+
+  void SectionText() override;
+  void SectionData() override;
+  void SectionRoData() override;
+
+  void AlignToCodeAlignment() override;
+  void AlignToDataAlignment() override;
+
+  void DeclareUint32(const char* name, uint32_t value) override;
+  void DeclarePointerToSymbol(const char* name, const char* target) override;
+
+  void DeclareLabel(const char* name) override;
+
+  void SourceInfo(int fileid, const char* filename, int line) override;
+  void DeclareFunctionBegin(const char* name) override;
+  void DeclareFunctionEnd(const char* name) override;
+
+  int HexLiteral(uint64_t value) override;
+
+  void Comment(const char* string) override;
+
+  void FilePrologue() override;
+  void DeclareExternalFilename(int fileid, const char* filename) override;
+  void FileEpilogue() override;
+
+  int IndentedDataDirective(DataDirective directive) override;
+
+ private:
+  void DeclareSymbolGlobal(const char* name);
+
+ private:
+  const EmbeddedTargetArch target_arch_;
+  const EmbeddedTargetOs target_os_;
+};
+
+}  // namespace internal
+}  // namespace v8
+
+#endif  // V8_SNAPSHOT_EMBEDDED_PLATFORM_EMBEDDED_FILE_WRITER_AIX_H_
diff --git a/src/snapshot/embedded/platform-embedded-file-writer-base.cc b/src/snapshot/embedded/platform-embedded-file-writer-base.cc
index 7694d17..bd3c767 100644
--- a/src/snapshot/embedded/platform-embedded-file-writer-base.cc
+++ b/src/snapshot/embedded/platform-embedded-file-writer-base.cc
@@ -6,11 +6,24 @@
 
 #include <string>
 
+#include "src/globals.h"
+#include "src/snapshot/embedded/platform-embedded-file-writer-aix.h"
 #include "src/snapshot/embedded/platform-embedded-file-writer-generic.h"
+#include "src/snapshot/embedded/platform-embedded-file-writer-mac.h"
+#include "src/snapshot/embedded/platform-embedded-file-writer-win.h"
 
 namespace v8 {
 namespace internal {
 
+DataDirective PointerSizeDirective() {
+  if (kSystemPointerSize == 8) {
+    return kQuad;
+  } else {
+    CHECK_EQ(4, kSystemPointerSize);
+    return kLong;
+  }
+}
+
 namespace {
 
 EmbeddedTargetArch DefaultEmbeddedTargetArch() {
@@ -83,9 +96,24 @@
 
 std::unique_ptr<PlatformEmbeddedFileWriterBase> NewPlatformEmbeddedFileWriter(
     const char* target_arch, const char* target_os) {
-  return std::unique_ptr<PlatformEmbeddedFileWriterGeneric>(
-      new PlatformEmbeddedFileWriterGeneric(ToEmbeddedTargetArch(target_arch),
-                                            ToEmbeddedTargetOs(target_os)));
+  auto embedded_target_arch = ToEmbeddedTargetArch(target_arch);
+  auto embedded_target_os = ToEmbeddedTargetOs(target_os);
+
+  if (embedded_target_os == EmbeddedTargetOs::kAIX) {
+    return base::make_unique<PlatformEmbeddedFileWriterAIX>(
+        embedded_target_arch, embedded_target_os);
+  } else if (embedded_target_os == EmbeddedTargetOs::kMac) {
+    return base::make_unique<PlatformEmbeddedFileWriterMac>(
+        embedded_target_arch, embedded_target_os);
+  } else if (embedded_target_os == EmbeddedTargetOs::kWin) {
+    return base::make_unique<PlatformEmbeddedFileWriterWin>(
+        embedded_target_arch, embedded_target_os);
+  } else {
+    return base::make_unique<PlatformEmbeddedFileWriterGeneric>(
+        embedded_target_arch, embedded_target_os);
+  }
+
+  UNREACHABLE();
 }
 
 }  // namespace internal
diff --git a/src/snapshot/embedded/platform-embedded-file-writer-base.h b/src/snapshot/embedded/platform-embedded-file-writer-base.h
index 9b516d5..13e5e6b 100644
--- a/src/snapshot/embedded/platform-embedded-file-writer-base.h
+++ b/src/snapshot/embedded/platform-embedded-file-writer-base.h
@@ -19,6 +19,8 @@
   kOcta,
 };
 
+DataDirective PointerSizeDirective();
+
 enum class EmbeddedTargetOs {
   kAIX,
   kChromeOS,
diff --git a/src/snapshot/embedded/platform-embedded-file-writer-generic.cc b/src/snapshot/embedded/platform-embedded-file-writer-generic.cc
index 5e2e7bf..780ca44 100644
--- a/src/snapshot/embedded/platform-embedded-file-writer-generic.cc
+++ b/src/snapshot/embedded/platform-embedded-file-writer-generic.cc
@@ -12,93 +12,11 @@
 namespace v8 {
 namespace internal {
 
-// V8_CC_MSVC is true for both MSVC and clang on windows. clang can handle
-// __asm__-style inline assembly but MSVC cannot, and thus we need a more
-// precise compiler detection that can distinguish between the two. clang on
-// windows sets both __clang__ and _MSC_VER, MSVC sets only _MSC_VER.
-#if defined(_MSC_VER) && !defined(__clang__)
-#define V8_COMPILER_IS_MSVC
-#endif
-
-// MSVC uses MASM for x86 and x64, while it has a ARMASM for ARM32 and
-// ARMASM64 for ARM64. Since ARMASM and ARMASM64 accept a slightly tweaked
-// version of ARM assembly language, they are referred to together in Visual
-// Studio project files as MARMASM.
-//
-// ARM assembly language docs:
-// http://infocenter.arm.com/help/topic/com.arm.doc.dui0802b/index.html
-// Microsoft ARM assembler and assembly language docs:
-// https://docs.microsoft.com/en-us/cpp/assembler/arm/arm-assembler-reference
-#if defined(V8_COMPILER_IS_MSVC)
-#if defined(V8_TARGET_ARCH_ARM64) || defined(V8_TARGET_ARCH_ARM)
-#define V8_ASSEMBLER_IS_MARMASM
-#elif defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_X64)
-#define V8_ASSEMBLER_IS_MASM
-#else
-#error Unknown Windows assembler target architecture.
-#endif
-#endif
-
-// Name mangling.
-// Symbols are prefixed with an underscore on 32-bit architectures.
-#if defined(V8_TARGET_OS_WIN) && !defined(V8_TARGET_ARCH_X64) && \
-    !defined(V8_TARGET_ARCH_ARM64)
-#define SYMBOL_PREFIX "_"
-#else
 #define SYMBOL_PREFIX ""
-#endif
-
-// Platform-independent bits.
-// -----------------------------------------------------------------------------
 
 namespace {
 
-DataDirective PointerSizeDirective() {
-  if (kSystemPointerSize == 8) {
-    return kQuad;
-  } else {
-    CHECK_EQ(4, kSystemPointerSize);
-    return kLong;
-  }
-}
-
-}  // namespace
-
 const char* DirectiveAsString(DataDirective directive) {
-#if defined(V8_TARGET_OS_WIN) && defined(V8_ASSEMBLER_IS_MASM)
-  switch (directive) {
-    case kByte:
-      return "BYTE";
-    case kLong:
-      return "DWORD";
-    case kQuad:
-      return "QWORD";
-    default:
-      UNREACHABLE();
-  }
-#elif defined(V8_TARGET_OS_WIN) && defined(V8_ASSEMBLER_IS_MARMASM)
-  switch (directive) {
-    case kByte:
-      return "DCB";
-    case kLong:
-      return "DCDU";
-    case kQuad:
-      return "DCQU";
-    default:
-      UNREACHABLE();
-  }
-#elif defined(V8_OS_AIX)
-  switch (directive) {
-    case kByte:
-      return ".byte";
-    case kLong:
-      return ".long";
-    case kQuad:
-      return ".llong";
-    default:
-      UNREACHABLE();
-  }
-#else
   switch (directive) {
     case kByte:
       return ".byte";
@@ -110,456 +28,24 @@
       return ".octa";
   }
   UNREACHABLE();
-#endif
 }
 
-// V8_OS_MACOSX
-// Fuchsia target is explicitly excluded here for Mac hosts. This is to avoid
-// generating uncompilable assembly files for the Fuchsia target.
-// -----------------------------------------------------------------------------
-
-#if defined(V8_OS_MACOSX) && !defined(V8_TARGET_OS_FUCHSIA)
+}  // namespace
 
 void PlatformEmbeddedFileWriterGeneric::SectionText() {
-  fprintf(fp_, ".text\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::SectionData() {
-  fprintf(fp_, ".data\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::SectionRoData() {
-  fprintf(fp_, ".const_data\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareUint32(const char* name,
-                                                      uint32_t value) {
-  DeclareSymbolGlobal(name);
-  DeclareLabel(name);
-  IndentedDataDirective(kLong);
-  fprintf(fp_, "%d", value);
-  Newline();
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclarePointerToSymbol(
-    const char* name, const char* target) {
-  DeclareSymbolGlobal(name);
-  DeclareLabel(name);
-  fprintf(fp_, "  %s _%s\n", DirectiveAsString(PointerSizeDirective()), target);
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareSymbolGlobal(const char* name) {
-  // TODO(jgruber): Investigate switching to .globl. Using .private_extern
-  // prevents something along the compilation chain from messing with the
-  // embedded blob. Using .global here causes embedded blob hash verification
-  // failures at runtime.
-  fprintf(fp_, ".private_extern _%s\n", name);
-}
-
-void PlatformEmbeddedFileWriterGeneric::AlignToCodeAlignment() {
-  fprintf(fp_, ".balign 32\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::AlignToDataAlignment() {
-  fprintf(fp_, ".balign 8\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::Comment(const char* string) {
-  fprintf(fp_, "// %s\n", string);
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareLabel(const char* name) {
-  fprintf(fp_, "_%s:\n", name);
-}
-
-void PlatformEmbeddedFileWriterGeneric::SourceInfo(int fileid,
-                                                   const char* filename,
-                                                   int line) {
-  fprintf(fp_, ".loc %d %d\n", fileid, line);
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareFunctionBegin(const char* name) {
-  DeclareLabel(name);
-
-  // TODO(mvstanton): Investigate the proper incantations to mark the label as
-  // a function on OSX.
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareFunctionEnd(const char* name) {}
-
-int PlatformEmbeddedFileWriterGeneric::HexLiteral(uint64_t value) {
-  return fprintf(fp_, "0x%" PRIx64, value);
-}
-
-void PlatformEmbeddedFileWriterGeneric::FilePrologue() {}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareExternalFilename(
-    int fileid, const char* filename) {
-  fprintf(fp_, ".file %d \"%s\"\n", fileid, filename);
-}
-
-void PlatformEmbeddedFileWriterGeneric::FileEpilogue() {}
-
-int PlatformEmbeddedFileWriterGeneric::IndentedDataDirective(
-    DataDirective directive) {
-  return fprintf(fp_, "  %s ", DirectiveAsString(directive));
-}
-
-// V8_OS_AIX
-// -----------------------------------------------------------------------------
-
-#elif defined(V8_OS_AIX)
-
-void PlatformEmbeddedFileWriterGeneric::SectionText() {
-  fprintf(fp_, ".csect .text[PR]\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::SectionData() {
-  fprintf(fp_, ".csect .data[RW]\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::SectionRoData() {
-  fprintf(fp_, ".csect[RO]\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareUint32(const char* name,
-                                                      uint32_t value) {
-  DeclareSymbolGlobal(name);
-  fprintf(fp_, ".align 2\n");
-  fprintf(fp_, "%s:\n", name);
-  IndentedDataDirective(kLong);
-  fprintf(fp_, "%d\n", value);
-  Newline();
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclarePointerToSymbol(
-    const char* name, const char* target) {
-  AlignToCodeAlignment();
-  DeclareLabel(name);
-  fprintf(fp_, "  %s %s\n", DirectiveAsString(PointerSizeDirective()), target);
-  Newline();
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareSymbolGlobal(const char* name) {
-  fprintf(fp_, ".globl %s\n", name);
-}
-
-void PlatformEmbeddedFileWriterGeneric::AlignToCodeAlignment() {
-  fprintf(fp_, ".align 5\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::AlignToDataAlignment() {
-  fprintf(fp_, ".align 3\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::Comment(const char* string) {
-  fprintf(fp_, "// %s\n", string);
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareLabel(const char* name) {
-  DeclareSymbolGlobal(name);
-  fprintf(fp_, "%s:\n", name);
-}
-
-void PlatformEmbeddedFileWriterGeneric::SourceInfo(int fileid,
-                                                   const char* filename,
-                                                   int line) {
-  fprintf(fp_, ".xline %d, \"%s\"\n", line, filename);
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareFunctionBegin(const char* name) {
-  Newline();
-  DeclareSymbolGlobal(name);
-  fprintf(fp_, ".csect %s[DS]\n", name);  // function descriptor
-  fprintf(fp_, "%s:\n", name);
-  fprintf(fp_, ".llong .%s, 0, 0\n", name);
-  SectionText();
-  fprintf(fp_, ".%s:\n", name);
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareFunctionEnd(const char* name) {}
-
-int PlatformEmbeddedFileWriterGeneric::HexLiteral(uint64_t value) {
-  return fprintf(fp_, "0x%" PRIx64, value);
-}
-
-void PlatformEmbeddedFileWriterGeneric::FilePrologue() {}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareExternalFilename(
-    int fileid, const char* filename) {
-  // File name cannot be declared with an identifier on AIX.
-  // We use the SourceInfo method to emit debug info in
-  //.xline <line-number> <file-name> format.
-}
-
-void PlatformEmbeddedFileWriterGeneric::FileEpilogue() {}
-
-int PlatformEmbeddedFileWriterGeneric::IndentedDataDirective(
-    DataDirective directive) {
-  return fprintf(fp_, "  %s ", DirectiveAsString(directive));
-}
-
-// V8_TARGET_OS_WIN (MSVC)
-// -----------------------------------------------------------------------------
-
-#elif defined(V8_TARGET_OS_WIN) && defined(V8_ASSEMBLER_IS_MASM)
-
-// For MSVC builds we emit assembly in MASM syntax.
-// See https://docs.microsoft.com/en-us/cpp/assembler/masm/directives-reference.
-
-void PlatformEmbeddedFileWriterGeneric::SectionText() {
-  fprintf(fp_, ".CODE\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::SectionData() {
-  fprintf(fp_, ".DATA\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::SectionRoData() {
-  fprintf(fp_, ".CONST\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareUint32(const char* name,
-                                                      uint32_t value) {
-  DeclareSymbolGlobal(name);
-  fprintf(fp_, "%s%s %s %d\n", SYMBOL_PREFIX, name, DirectiveAsString(kLong),
-          value);
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclarePointerToSymbol(
-    const char* name, const char* target) {
-  DeclareSymbolGlobal(name);
-  fprintf(fp_, "%s%s %s %s%s\n", SYMBOL_PREFIX, name,
-          DirectiveAsString(PointerSizeDirective()), SYMBOL_PREFIX, target);
-}
-
-#if defined(V8_OS_WIN_X64)
-
-void PlatformEmbeddedFileWriterGeneric::StartPdataSection() {
-  fprintf(fp_, "OPTION DOTNAME\n");
-  fprintf(fp_, ".pdata SEGMENT DWORD READ ''\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::EndPdataSection() {
-  fprintf(fp_, ".pdata ENDS\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::StartXdataSection() {
-  fprintf(fp_, "OPTION DOTNAME\n");
-  fprintf(fp_, ".xdata SEGMENT DWORD READ ''\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::EndXdataSection() {
-  fprintf(fp_, ".xdata ENDS\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareExternalFunction(
-    const char* name) {
-  fprintf(fp_, "EXTERN %s : PROC\n", name);
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareRvaToSymbol(const char* name,
-                                                           uint64_t offset) {
-  if (offset > 0) {
-    fprintf(fp_, "DD IMAGEREL %s+%llu\n", name, offset);
+  if (target_os_ == EmbeddedTargetOs::kChromeOS) {
+    fprintf(fp_, ".section .text.hot.embedded\n");
   } else {
-    fprintf(fp_, "DD IMAGEREL %s\n", name);
+    fprintf(fp_, ".section .text\n");
   }
 }
 
-#endif  // defined(V8_OS_WIN_X64)
-
-void PlatformEmbeddedFileWriterGeneric::DeclareSymbolGlobal(const char* name) {
-  fprintf(fp_, "PUBLIC %s%s\n", SYMBOL_PREFIX, name);
-}
-
-void PlatformEmbeddedFileWriterGeneric::AlignToCodeAlignment() {
-  // Diverges from other platforms due to compile error
-  // 'invalid combination with segment alignment'.
-  fprintf(fp_, "ALIGN 4\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::AlignToDataAlignment() {
-  fprintf(fp_, "ALIGN 4\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::Comment(const char* string) {
-  fprintf(fp_, "; %s\n", string);
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareLabel(const char* name) {
-  fprintf(fp_, "%s%s LABEL %s\n", SYMBOL_PREFIX, name,
-          DirectiveAsString(kByte));
-}
-
-void PlatformEmbeddedFileWriterGeneric::SourceInfo(int fileid,
-                                                   const char* filename,
-                                                   int line) {
-  // TODO(mvstanton): output source information for MSVC.
-  // Its syntax is #line <line> "<filename>"
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareFunctionBegin(const char* name) {
-  fprintf(fp_, "%s%s PROC\n", SYMBOL_PREFIX, name);
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareFunctionEnd(const char* name) {
-  fprintf(fp_, "%s%s ENDP\n", SYMBOL_PREFIX, name);
-}
-
-int PlatformEmbeddedFileWriterGeneric::HexLiteral(uint64_t value) {
-  return fprintf(fp_, "0%" PRIx64 "h", value);
-}
-
-void PlatformEmbeddedFileWriterGeneric::FilePrologue() {
-#if !defined(V8_TARGET_ARCH_X64)
-  fprintf(fp_, ".MODEL FLAT\n");
-#endif
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareExternalFilename(
-    int fileid, const char* filename) {}
-
-void PlatformEmbeddedFileWriterGeneric::FileEpilogue() {
-  fprintf(fp_, "END\n");
-}
-
-int PlatformEmbeddedFileWriterGeneric::IndentedDataDirective(
-    DataDirective directive) {
-  return fprintf(fp_, "  %s ", DirectiveAsString(directive));
-}
-
-#undef V8_ASSEMBLER_IS_MASM
-
-#elif defined(V8_TARGET_OS_WIN) && defined(V8_ASSEMBLER_IS_MARMASM)
-
-// The the AARCH64 ABI requires instructions be 4-byte-aligned and Windows does
-// not have a stricter alignment requirement (see the TEXTAREA macro of
-// kxarm64.h in the Windows SDK), so code is 4-byte-aligned.
-// The data fields in the emitted assembly tend to be accessed with 8-byte
-// LDR instructions, so data is 8-byte-aligned.
-//
-// armasm64's warning A4228 states
-//     Alignment value exceeds AREA alignment; alignment not guaranteed
-// To ensure that ALIGN directives are honored, their values are defined as
-// equal to their corresponding AREA's ALIGN attributes.
-
-#define ARM64_DATA_ALIGNMENT_POWER (3)
-#define ARM64_DATA_ALIGNMENT (1 << ARM64_DATA_ALIGNMENT_POWER)
-#define ARM64_CODE_ALIGNMENT_POWER (2)
-#define ARM64_CODE_ALIGNMENT (1 << ARM64_CODE_ALIGNMENT_POWER)
-
-void PlatformEmbeddedFileWriterGeneric::SectionText() {
-  fprintf(fp_, "  AREA |.text|, CODE, ALIGN=%d, READONLY\n",
-          ARM64_CODE_ALIGNMENT_POWER);
-}
-
-void PlatformEmbeddedFileWriterGeneric::SectionData() {
-  fprintf(fp_, "  AREA |.data|, DATA, ALIGN=%d, READWRITE\n",
-          ARM64_DATA_ALIGNMENT_POWER);
-}
-
-void PlatformEmbeddedFileWriterGeneric::SectionRoData() {
-  fprintf(fp_, "  AREA |.rodata|, DATA, ALIGN=%d, READONLY\n",
-          ARM64_DATA_ALIGNMENT_POWER);
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareUint32(const char* name,
-                                                      uint32_t value) {
-  DeclareSymbolGlobal(name);
-  fprintf(fp_, "%s%s %s %d\n", SYMBOL_PREFIX, name, DirectiveAsString(kLong),
-          value);
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclarePointerToSymbol(
-    const char* name, const char* target) {
-  DeclareSymbolGlobal(name);
-  fprintf(fp_, "%s%s %s %s%s\n", SYMBOL_PREFIX, name,
-          DirectiveAsString(PointerSizeDirective()), SYMBOL_PREFIX, target);
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareSymbolGlobal(const char* name) {
-  fprintf(fp_, "  EXPORT %s%s\n", SYMBOL_PREFIX, name);
-}
-
-void PlatformEmbeddedFileWriterGeneric::AlignToCodeAlignment() {
-  fprintf(fp_, "  ALIGN %d\n", ARM64_CODE_ALIGNMENT);
-}
-
-void PlatformEmbeddedFileWriterGeneric::AlignToDataAlignment() {
-  fprintf(fp_, "  ALIGN %d\n", ARM64_DATA_ALIGNMENT);
-}
-
-void PlatformEmbeddedFileWriterGeneric::Comment(const char* string) {
-  fprintf(fp_, "; %s\n", string);
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareLabel(const char* name) {
-  fprintf(fp_, "%s%s\n", SYMBOL_PREFIX, name);
-}
-
-void PlatformEmbeddedFileWriterGeneric::SourceInfo(int fileid,
-                                                   const char* filename,
-                                                   int line) {
-  // TODO(mvstanton): output source information for MSVC.
-  // Its syntax is #line <line> "<filename>"
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareFunctionBegin(const char* name) {
-  fprintf(fp_, "%s%s FUNCTION\n", SYMBOL_PREFIX, name);
-}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareFunctionEnd(const char* name) {
-  fprintf(fp_, "  ENDFUNC\n");
-}
-
-int PlatformEmbeddedFileWriterGeneric::HexLiteral(uint64_t value) {
-  return fprintf(fp_, "0x%" PRIx64, value);
-}
-
-void PlatformEmbeddedFileWriterGeneric::FilePrologue() {}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareExternalFilename(
-    int fileid, const char* filename) {}
-
-void PlatformEmbeddedFileWriterGeneric::FileEpilogue() {
-  fprintf(fp_, "  END\n");
-}
-
-int PlatformEmbeddedFileWriterGeneric::IndentedDataDirective(
-    DataDirective directive) {
-  return fprintf(fp_, "  %s ", DirectiveAsString(directive));
-}
-
-#undef V8_ASSEMBLER_IS_MARMASM
-#undef ARM64_DATA_ALIGNMENT_POWER
-#undef ARM64_DATA_ALIGNMENT
-#undef ARM64_CODE_ALIGNMENT_POWER
-#undef ARM64_CODE_ALIGNMENT
-
-// Everything but AIX, Windows with MSVC, or OSX.
-// -----------------------------------------------------------------------------
-
-#else
-
-void PlatformEmbeddedFileWriterGeneric::SectionText() {
-#if defined(V8_TARGET_OS_CHROMEOS)
-  fprintf(fp_, ".section .text.hot.embedded\n");
-#else
-  fprintf(fp_, ".section .text\n");
-#endif
-}
-
 void PlatformEmbeddedFileWriterGeneric::SectionData() {
   fprintf(fp_, ".section .data\n");
 }
 
 void PlatformEmbeddedFileWriterGeneric::SectionRoData() {
-  if (target_os_ == EmbeddedTargetOs::kWin) {
-    fprintf(fp_, ".section .rdata\n");
-  } else {
-    fprintf(fp_, ".section .rodata\n");
-  }
+  fprintf(fp_, ".section .rodata\n");
 }
 
 void PlatformEmbeddedFileWriterGeneric::DeclareUint32(const char* name,
@@ -579,34 +65,6 @@
           SYMBOL_PREFIX, target);
 }
 
-#if defined(V8_OS_WIN_X64)
-
-void PlatformEmbeddedFileWriterGeneric::StartPdataSection() {
-  fprintf(fp_, ".section .pdata\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::EndPdataSection() {}
-
-void PlatformEmbeddedFileWriterGeneric::StartXdataSection() {
-  fprintf(fp_, ".section .xdata\n");
-}
-
-void PlatformEmbeddedFileWriterGeneric::EndXdataSection() {}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareExternalFunction(
-    const char* name) {}
-
-void PlatformEmbeddedFileWriterGeneric::DeclareRvaToSymbol(const char* name,
-                                                           uint64_t offset) {
-  if (offset > 0) {
-    fprintf(fp_, ".rva %s + %llu\n", name, offset);
-  } else {
-    fprintf(fp_, ".rva %s\n", name);
-  }
-}
-
-#endif  // defined(V8_OS_WIN_X64)
-
 void PlatformEmbeddedFileWriterGeneric::DeclareSymbolGlobal(const char* name) {
   fprintf(fp_, ".global %s%s\n", SYMBOL_PREFIX, name);
 }
@@ -640,30 +98,15 @@
 void PlatformEmbeddedFileWriterGeneric::DeclareFunctionBegin(const char* name) {
   DeclareLabel(name);
 
-  if (target_os_ == EmbeddedTargetOs::kWin) {
-#if defined(V8_TARGET_ARCH_ARM64)
-    // Windows ARM64 assembly is in GAS syntax, but ".type" is invalid directive
-    // in PE/COFF for Windows.
-#else
-    // The directives for inserting debugging information on Windows come
-    // from the PE (Portable Executable) and COFF (Common Object File Format)
-    // standards. Documented here:
-    // https://docs.microsoft.com/en-us/windows/desktop/debug/pe-format
-    //
-    // .scl 2 means StorageClass external.
-    // .type 32 means Type Representation Function.
-    fprintf(fp_, ".def %s%s; .scl 2; .type 32; .endef;\n", SYMBOL_PREFIX, name);
-#endif
-  } else {
-#if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_ARM64)
+  if (target_arch_ == EmbeddedTargetArch::kArm ||
+      target_arch_ == EmbeddedTargetArch::kArm64) {
     // ELF format binaries on ARM use ".type <function name>, %function"
     // to create a DWARF subprogram entry.
     fprintf(fp_, ".type %s, %%function\n", name);
-#else
+  } else {
     // Other ELF Format binaries use ".type <function name>, @function"
     // to create a DWARF subprogram entry.
     fprintf(fp_, ".type %s, @function\n", name);
-#endif
   }
 }
 
@@ -691,10 +134,7 @@
   return fprintf(fp_, "  %s ", DirectiveAsString(directive));
 }
 
-#endif
-
 #undef SYMBOL_PREFIX
-#undef V8_COMPILER_IS_MSVC
 
 }  // namespace internal
 }  // namespace v8
diff --git a/src/snapshot/embedded/platform-embedded-file-writer-generic.h b/src/snapshot/embedded/platform-embedded-file-writer-generic.h
index c7ae112..db89600 100644
--- a/src/snapshot/embedded/platform-embedded-file-writer-generic.h
+++ b/src/snapshot/embedded/platform-embedded-file-writer-generic.h
@@ -5,9 +5,6 @@
 #ifndef V8_SNAPSHOT_EMBEDDED_PLATFORM_EMBEDDED_FILE_WRITER_GENERIC_H_
 #define V8_SNAPSHOT_EMBEDDED_PLATFORM_EMBEDDED_FILE_WRITER_GENERIC_H_
 
-#include <cinttypes>
-#include <cstdio>  // For FILE.
-
 #include "src/base/macros.h"
 #include "src/globals.h"  // For V8_OS_WIN_X64
 #include "src/snapshot/embedded/platform-embedded-file-writer-base.h"
@@ -21,9 +18,9 @@
   PlatformEmbeddedFileWriterGeneric(EmbeddedTargetArch target_arch,
                                     EmbeddedTargetOs target_os)
       : target_arch_(target_arch), target_os_(target_os) {
-    // TODO(jgruber): Remove these once platforms have been split off.
-    USE(target_arch_);
-    USE(target_os_);
+    DCHECK(target_os_ == EmbeddedTargetOs::kChromeOS ||
+           target_os_ == EmbeddedTargetOs::kFuchsia ||
+           target_os_ == EmbeddedTargetOs::kGeneric);
   }
 
   void SectionText() override;
@@ -52,19 +49,6 @@
 
   int IndentedDataDirective(DataDirective directive) override;
 
-#if defined(V8_OS_WIN_X64)
-  // TODO(jgruber): Move these to the windows-specific writer.
-  void StartPdataSection();
-  void EndPdataSection();
-  void StartXdataSection();
-  void EndXdataSection();
-  void DeclareExternalFunction(const char* name);
-
-  // Emits an RVA (address relative to the module load address) specified as an
-  // offset from a given symbol.
-  void DeclareRvaToSymbol(const char* name, uint64_t offset = 0);
-#endif  // defined(V8_OS_WIN_X64)
-
  private:
   void DeclareSymbolGlobal(const char* name);
 
diff --git a/src/snapshot/embedded/platform-embedded-file-writer-mac.cc b/src/snapshot/embedded/platform-embedded-file-writer-mac.cc
new file mode 100644
index 0000000..4be3c7a
--- /dev/null
+++ b/src/snapshot/embedded/platform-embedded-file-writer-mac.cc
@@ -0,0 +1,109 @@
+// Copyright 2019 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.
+
+#include "src/snapshot/embedded/platform-embedded-file-writer-mac.h"
+
+namespace v8 {
+namespace internal {
+
+namespace {
+
+const char* DirectiveAsString(DataDirective directive) {
+  switch (directive) {
+    case kByte:
+      return ".byte";
+    case kLong:
+      return ".long";
+    case kQuad:
+      return ".quad";
+    case kOcta:
+      return ".octa";
+  }
+  UNREACHABLE();
+}
+
+}  // namespace
+
+void PlatformEmbeddedFileWriterMac::SectionText() { fprintf(fp_, ".text\n"); }
+
+void PlatformEmbeddedFileWriterMac::SectionData() { fprintf(fp_, ".data\n"); }
+
+void PlatformEmbeddedFileWriterMac::SectionRoData() {
+  fprintf(fp_, ".const_data\n");
+}
+
+void PlatformEmbeddedFileWriterMac::DeclareUint32(const char* name,
+                                                  uint32_t value) {
+  DeclareSymbolGlobal(name);
+  DeclareLabel(name);
+  IndentedDataDirective(kLong);
+  fprintf(fp_, "%d", value);
+  Newline();
+}
+
+void PlatformEmbeddedFileWriterMac::DeclarePointerToSymbol(const char* name,
+                                                           const char* target) {
+  DeclareSymbolGlobal(name);
+  DeclareLabel(name);
+  fprintf(fp_, "  %s _%s\n", DirectiveAsString(PointerSizeDirective()), target);
+}
+
+void PlatformEmbeddedFileWriterMac::DeclareSymbolGlobal(const char* name) {
+  // TODO(jgruber): Investigate switching to .globl. Using .private_extern
+  // prevents something along the compilation chain from messing with the
+  // embedded blob. Using .global here causes embedded blob hash verification
+  // failures at runtime.
+  fprintf(fp_, ".private_extern _%s\n", name);
+}
+
+void PlatformEmbeddedFileWriterMac::AlignToCodeAlignment() {
+  fprintf(fp_, ".balign 32\n");
+}
+
+void PlatformEmbeddedFileWriterMac::AlignToDataAlignment() {
+  fprintf(fp_, ".balign 8\n");
+}
+
+void PlatformEmbeddedFileWriterMac::Comment(const char* string) {
+  fprintf(fp_, "// %s\n", string);
+}
+
+void PlatformEmbeddedFileWriterMac::DeclareLabel(const char* name) {
+  fprintf(fp_, "_%s:\n", name);
+}
+
+void PlatformEmbeddedFileWriterMac::SourceInfo(int fileid, const char* filename,
+                                               int line) {
+  fprintf(fp_, ".loc %d %d\n", fileid, line);
+}
+
+void PlatformEmbeddedFileWriterMac::DeclareFunctionBegin(const char* name) {
+  DeclareLabel(name);
+
+  // TODO(mvstanton): Investigate the proper incantations to mark the label as
+  // a function on OSX.
+}
+
+void PlatformEmbeddedFileWriterMac::DeclareFunctionEnd(const char* name) {}
+
+int PlatformEmbeddedFileWriterMac::HexLiteral(uint64_t value) {
+  return fprintf(fp_, "0x%" PRIx64, value);
+}
+
+void PlatformEmbeddedFileWriterMac::FilePrologue() {}
+
+void PlatformEmbeddedFileWriterMac::DeclareExternalFilename(
+    int fileid, const char* filename) {
+  fprintf(fp_, ".file %d \"%s\"\n", fileid, filename);
+}
+
+void PlatformEmbeddedFileWriterMac::FileEpilogue() {}
+
+int PlatformEmbeddedFileWriterMac::IndentedDataDirective(
+    DataDirective directive) {
+  return fprintf(fp_, "  %s ", DirectiveAsString(directive));
+}
+
+}  // namespace internal
+}  // namespace v8
diff --git a/src/snapshot/embedded/platform-embedded-file-writer-mac.h b/src/snapshot/embedded/platform-embedded-file-writer-mac.h
new file mode 100644
index 0000000..4f2cd3d
--- /dev/null
+++ b/src/snapshot/embedded/platform-embedded-file-writer-mac.h
@@ -0,0 +1,61 @@
+// Copyright 2019 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_PLATFORM_EMBEDDED_FILE_WRITER_MAC_H_
+#define V8_SNAPSHOT_EMBEDDED_PLATFORM_EMBEDDED_FILE_WRITER_MAC_H_
+
+#include "src/base/macros.h"
+#include "src/snapshot/embedded/platform-embedded-file-writer-base.h"
+
+namespace v8 {
+namespace internal {
+
+class PlatformEmbeddedFileWriterMac : public PlatformEmbeddedFileWriterBase {
+ public:
+  PlatformEmbeddedFileWriterMac(EmbeddedTargetArch target_arch,
+                                EmbeddedTargetOs target_os)
+      : target_arch_(target_arch), target_os_(target_os) {
+    USE(target_arch_);
+    USE(target_os_);
+    DCHECK_EQ(target_os_, EmbeddedTargetOs::kMac);
+  }
+
+  void SectionText() override;
+  void SectionData() override;
+  void SectionRoData() override;
+
+  void AlignToCodeAlignment() override;
+  void AlignToDataAlignment() override;
+
+  void DeclareUint32(const char* name, uint32_t value) override;
+  void DeclarePointerToSymbol(const char* name, const char* target) override;
+
+  void DeclareLabel(const char* name) override;
+
+  void SourceInfo(int fileid, const char* filename, int line) override;
+  void DeclareFunctionBegin(const char* name) override;
+  void DeclareFunctionEnd(const char* name) override;
+
+  int HexLiteral(uint64_t value) override;
+
+  void Comment(const char* string) override;
+
+  void FilePrologue() override;
+  void DeclareExternalFilename(int fileid, const char* filename) override;
+  void FileEpilogue() override;
+
+  int IndentedDataDirective(DataDirective directive) override;
+
+ private:
+  void DeclareSymbolGlobal(const char* name);
+
+ private:
+  const EmbeddedTargetArch target_arch_;
+  const EmbeddedTargetOs target_os_;
+};
+
+}  // namespace internal
+}  // namespace v8
+
+#endif  // V8_SNAPSHOT_EMBEDDED_PLATFORM_EMBEDDED_FILE_WRITER_MAC_H_
diff --git a/src/snapshot/embedded/platform-embedded-file-writer-win.cc b/src/snapshot/embedded/platform-embedded-file-writer-win.cc
new file mode 100644
index 0000000..f423cae
--- /dev/null
+++ b/src/snapshot/embedded/platform-embedded-file-writer-win.cc
@@ -0,0 +1,455 @@
+// Copyright 2019 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.
+
+#include "src/snapshot/embedded/platform-embedded-file-writer-win.h"
+
+namespace v8 {
+namespace internal {
+
+// V8_CC_MSVC is true for both MSVC and clang on windows. clang can handle
+// __asm__-style inline assembly but MSVC cannot, and thus we need a more
+// precise compiler detection that can distinguish between the two. clang on
+// windows sets both __clang__ and _MSC_VER, MSVC sets only _MSC_VER.
+#if defined(_MSC_VER) && !defined(__clang__)
+#define V8_COMPILER_IS_MSVC
+#endif
+
+// MSVC uses MASM for x86 and x64, while it has a ARMASM for ARM32 and
+// ARMASM64 for ARM64. Since ARMASM and ARMASM64 accept a slightly tweaked
+// version of ARM assembly language, they are referred to together in Visual
+// Studio project files as MARMASM.
+//
+// ARM assembly language docs:
+// http://infocenter.arm.com/help/topic/com.arm.doc.dui0802b/index.html
+// Microsoft ARM assembler and assembly language docs:
+// https://docs.microsoft.com/en-us/cpp/assembler/arm/arm-assembler-reference
+#if defined(V8_COMPILER_IS_MSVC)
+#if defined(V8_TARGET_ARCH_ARM64) || defined(V8_TARGET_ARCH_ARM)
+#define V8_ASSEMBLER_IS_MARMASM
+#elif defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_X64)
+#define V8_ASSEMBLER_IS_MASM
+#else
+#error Unknown Windows assembler target architecture.
+#endif
+#endif
+
+// Name mangling.
+// Symbols are prefixed with an underscore on 32-bit architectures.
+#if !defined(V8_TARGET_ARCH_X64) && !defined(V8_TARGET_ARCH_ARM64)
+#define SYMBOL_PREFIX "_"
+#else
+#define SYMBOL_PREFIX ""
+#endif
+
+// Notes:
+//
+// Cross-bitness builds are unsupported. It's thus safe to detect bitness
+// through compile-time defines.
+//
+// Cross-compiler builds (e.g. with mixed use of clang / MSVC) are likewise
+// unsupported and hence the compiler can also be detected through compile-time
+// defines.
+
+namespace {
+
+const char* DirectiveAsString(DataDirective directive) {
+#if defined(V8_ASSEMBLER_IS_MASM)
+  switch (directive) {
+    case kByte:
+      return "BYTE";
+    case kLong:
+      return "DWORD";
+    case kQuad:
+      return "QWORD";
+    default:
+      UNREACHABLE();
+  }
+#elif defined(V8_ASSEMBLER_IS_MARMASM)
+  switch (directive) {
+    case kByte:
+      return "DCB";
+    case kLong:
+      return "DCDU";
+    case kQuad:
+      return "DCQU";
+    default:
+      UNREACHABLE();
+  }
+#else
+  switch (directive) {
+    case kByte:
+      return ".byte";
+    case kLong:
+      return ".long";
+    case kQuad:
+      return ".quad";
+    case kOcta:
+      return ".octa";
+  }
+  UNREACHABLE();
+#endif
+}
+
+}  // namespace
+
+// Windows, MSVC, not arm/arm64.
+// -----------------------------------------------------------------------------
+
+#if defined(V8_ASSEMBLER_IS_MASM)
+
+// For MSVC builds we emit assembly in MASM syntax.
+// See https://docs.microsoft.com/en-us/cpp/assembler/masm/directives-reference.
+
+void PlatformEmbeddedFileWriterWin::SectionText() { fprintf(fp_, ".CODE\n"); }
+
+void PlatformEmbeddedFileWriterWin::SectionData() { fprintf(fp_, ".DATA\n"); }
+
+void PlatformEmbeddedFileWriterWin::SectionRoData() {
+  fprintf(fp_, ".CONST\n");
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareUint32(const char* name,
+                                                  uint32_t value) {
+  DeclareSymbolGlobal(name);
+  fprintf(fp_, "%s%s %s %d\n", SYMBOL_PREFIX, name, DirectiveAsString(kLong),
+          value);
+}
+
+void PlatformEmbeddedFileWriterWin::DeclarePointerToSymbol(const char* name,
+                                                           const char* target) {
+  DeclareSymbolGlobal(name);
+  fprintf(fp_, "%s%s %s %s%s\n", SYMBOL_PREFIX, name,
+          DirectiveAsString(PointerSizeDirective()), SYMBOL_PREFIX, target);
+}
+
+void PlatformEmbeddedFileWriterWin::StartPdataSection() {
+  fprintf(fp_, "OPTION DOTNAME\n");
+  fprintf(fp_, ".pdata SEGMENT DWORD READ ''\n");
+}
+
+void PlatformEmbeddedFileWriterWin::EndPdataSection() {
+  fprintf(fp_, ".pdata ENDS\n");
+}
+
+void PlatformEmbeddedFileWriterWin::StartXdataSection() {
+  fprintf(fp_, "OPTION DOTNAME\n");
+  fprintf(fp_, ".xdata SEGMENT DWORD READ ''\n");
+}
+
+void PlatformEmbeddedFileWriterWin::EndXdataSection() {
+  fprintf(fp_, ".xdata ENDS\n");
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareExternalFunction(const char* name) {
+  fprintf(fp_, "EXTERN %s : PROC\n", name);
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareRvaToSymbol(const char* name,
+                                                       uint64_t offset) {
+  if (offset > 0) {
+    fprintf(fp_, "DD IMAGEREL %s+%llu\n", name, offset);
+  } else {
+    fprintf(fp_, "DD IMAGEREL %s\n", name);
+  }
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareSymbolGlobal(const char* name) {
+  fprintf(fp_, "PUBLIC %s%s\n", SYMBOL_PREFIX, name);
+}
+
+void PlatformEmbeddedFileWriterWin::AlignToCodeAlignment() {
+  // Diverges from other platforms due to compile error
+  // 'invalid combination with segment alignment'.
+  fprintf(fp_, "ALIGN 4\n");
+}
+
+void PlatformEmbeddedFileWriterWin::AlignToDataAlignment() {
+  fprintf(fp_, "ALIGN 4\n");
+}
+
+void PlatformEmbeddedFileWriterWin::Comment(const char* string) {
+  fprintf(fp_, "; %s\n", string);
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareLabel(const char* name) {
+  fprintf(fp_, "%s%s LABEL %s\n", SYMBOL_PREFIX, name,
+          DirectiveAsString(kByte));
+}
+
+void PlatformEmbeddedFileWriterWin::SourceInfo(int fileid, const char* filename,
+                                               int line) {
+  // TODO(mvstanton): output source information for MSVC.
+  // Its syntax is #line <line> "<filename>"
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareFunctionBegin(const char* name) {
+  fprintf(fp_, "%s%s PROC\n", SYMBOL_PREFIX, name);
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareFunctionEnd(const char* name) {
+  fprintf(fp_, "%s%s ENDP\n", SYMBOL_PREFIX, name);
+}
+
+int PlatformEmbeddedFileWriterWin::HexLiteral(uint64_t value) {
+  return fprintf(fp_, "0%" PRIx64 "h", value);
+}
+
+void PlatformEmbeddedFileWriterWin::FilePrologue() {
+  if (target_arch_ != EmbeddedTargetArch::kX64) {
+    fprintf(fp_, ".MODEL FLAT\n");
+  }
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareExternalFilename(
+    int fileid, const char* filename) {}
+
+void PlatformEmbeddedFileWriterWin::FileEpilogue() { fprintf(fp_, "END\n"); }
+
+int PlatformEmbeddedFileWriterWin::IndentedDataDirective(
+    DataDirective directive) {
+  return fprintf(fp_, "  %s ", DirectiveAsString(directive));
+}
+
+// Windows, MSVC, arm/arm64.
+// -----------------------------------------------------------------------------
+
+#elif defined(V8_ASSEMBLER_IS_MARMASM)
+
+// The AARCH64 ABI requires instructions be 4-byte-aligned and Windows does
+// not have a stricter alignment requirement (see the TEXTAREA macro of
+// kxarm64.h in the Windows SDK), so code is 4-byte-aligned.
+// The data fields in the emitted assembly tend to be accessed with 8-byte
+// LDR instructions, so data is 8-byte-aligned.
+//
+// armasm64's warning A4228 states
+//     Alignment value exceeds AREA alignment; alignment not guaranteed
+// To ensure that ALIGN directives are honored, their values are defined as
+// equal to their corresponding AREA's ALIGN attributes.
+
+#define ARM64_DATA_ALIGNMENT_POWER (3)
+#define ARM64_DATA_ALIGNMENT (1 << ARM64_DATA_ALIGNMENT_POWER)
+#define ARM64_CODE_ALIGNMENT_POWER (2)
+#define ARM64_CODE_ALIGNMENT (1 << ARM64_CODE_ALIGNMENT_POWER)
+
+void PlatformEmbeddedFileWriterWin::SectionText() {
+  fprintf(fp_, "  AREA |.text|, CODE, ALIGN=%d, READONLY\n",
+          ARM64_CODE_ALIGNMENT_POWER);
+}
+
+void PlatformEmbeddedFileWriterWin::SectionData() {
+  fprintf(fp_, "  AREA |.data|, DATA, ALIGN=%d, READWRITE\n",
+          ARM64_DATA_ALIGNMENT_POWER);
+}
+
+void PlatformEmbeddedFileWriterWin::SectionRoData() {
+  fprintf(fp_, "  AREA |.rodata|, DATA, ALIGN=%d, READONLY\n",
+          ARM64_DATA_ALIGNMENT_POWER);
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareUint32(const char* name,
+                                                  uint32_t value) {
+  DeclareSymbolGlobal(name);
+  fprintf(fp_, "%s%s %s %d\n", SYMBOL_PREFIX, name, DirectiveAsString(kLong),
+          value);
+}
+
+void PlatformEmbeddedFileWriterWin::DeclarePointerToSymbol(const char* name,
+                                                           const char* target) {
+  DeclareSymbolGlobal(name);
+  fprintf(fp_, "%s%s %s %s%s\n", SYMBOL_PREFIX, name,
+          DirectiveAsString(PointerSizeDirective()), SYMBOL_PREFIX, target);
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareSymbolGlobal(const char* name) {
+  fprintf(fp_, "  EXPORT %s%s\n", SYMBOL_PREFIX, name);
+}
+
+void PlatformEmbeddedFileWriterWin::AlignToCodeAlignment() {
+  fprintf(fp_, "  ALIGN %d\n", ARM64_CODE_ALIGNMENT);
+}
+
+void PlatformEmbeddedFileWriterWin::AlignToDataAlignment() {
+  fprintf(fp_, "  ALIGN %d\n", ARM64_DATA_ALIGNMENT);
+}
+
+void PlatformEmbeddedFileWriterWin::Comment(const char* string) {
+  fprintf(fp_, "; %s\n", string);
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareLabel(const char* name) {
+  fprintf(fp_, "%s%s\n", SYMBOL_PREFIX, name);
+}
+
+void PlatformEmbeddedFileWriterWin::SourceInfo(int fileid, const char* filename,
+                                               int line) {
+  // TODO(mvstanton): output source information for MSVC.
+  // Its syntax is #line <line> "<filename>"
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareFunctionBegin(const char* name) {
+  fprintf(fp_, "%s%s FUNCTION\n", SYMBOL_PREFIX, name);
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareFunctionEnd(const char* name) {
+  fprintf(fp_, "  ENDFUNC\n");
+}
+
+int PlatformEmbeddedFileWriterWin::HexLiteral(uint64_t value) {
+  return fprintf(fp_, "0x%" PRIx64, value);
+}
+
+void PlatformEmbeddedFileWriterWin::FilePrologue() {}
+
+void PlatformEmbeddedFileWriterWin::DeclareExternalFilename(
+    int fileid, const char* filename) {}
+
+void PlatformEmbeddedFileWriterWin::FileEpilogue() { fprintf(fp_, "  END\n"); }
+
+int PlatformEmbeddedFileWriterWin::IndentedDataDirective(
+    DataDirective directive) {
+  return fprintf(fp_, "  %s ", DirectiveAsString(directive));
+}
+
+#undef ARM64_DATA_ALIGNMENT_POWER
+#undef ARM64_DATA_ALIGNMENT
+#undef ARM64_CODE_ALIGNMENT_POWER
+#undef ARM64_CODE_ALIGNMENT
+
+// All Windows builds without MSVC.
+// -----------------------------------------------------------------------------
+
+#else
+
+void PlatformEmbeddedFileWriterWin::SectionText() {
+  fprintf(fp_, ".section .text\n");
+}
+
+void PlatformEmbeddedFileWriterWin::SectionData() {
+  fprintf(fp_, ".section .data\n");
+}
+
+void PlatformEmbeddedFileWriterWin::SectionRoData() {
+  fprintf(fp_, ".section .rdata\n");
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareUint32(const char* name,
+                                                  uint32_t value) {
+  DeclareSymbolGlobal(name);
+  DeclareLabel(name);
+  IndentedDataDirective(kLong);
+  fprintf(fp_, "%d", value);
+  Newline();
+}
+
+void PlatformEmbeddedFileWriterWin::DeclarePointerToSymbol(const char* name,
+                                                           const char* target) {
+  DeclareSymbolGlobal(name);
+  DeclareLabel(name);
+  fprintf(fp_, "  %s %s%s\n", DirectiveAsString(PointerSizeDirective()),
+          SYMBOL_PREFIX, target);
+}
+
+void PlatformEmbeddedFileWriterWin::StartPdataSection() {
+  fprintf(fp_, ".section .pdata\n");
+}
+
+void PlatformEmbeddedFileWriterWin::EndPdataSection() {}
+
+void PlatformEmbeddedFileWriterWin::StartXdataSection() {
+  fprintf(fp_, ".section .xdata\n");
+}
+
+void PlatformEmbeddedFileWriterWin::EndXdataSection() {}
+
+void PlatformEmbeddedFileWriterWin::DeclareExternalFunction(const char* name) {}
+
+void PlatformEmbeddedFileWriterWin::DeclareRvaToSymbol(const char* name,
+                                                       uint64_t offset) {
+  if (offset > 0) {
+    fprintf(fp_, ".rva %s + %" PRIu64 "\n", name, offset);
+  } else {
+    fprintf(fp_, ".rva %s\n", name);
+  }
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareSymbolGlobal(const char* name) {
+  fprintf(fp_, ".global %s%s\n", SYMBOL_PREFIX, name);
+}
+
+void PlatformEmbeddedFileWriterWin::AlignToCodeAlignment() {
+  fprintf(fp_, ".balign 32\n");
+}
+
+void PlatformEmbeddedFileWriterWin::AlignToDataAlignment() {
+  // On Windows ARM64, s390, PPC and possibly more platforms, aligned load
+  // instructions are used to retrieve v8_Default_embedded_blob_ and/or
+  // v8_Default_embedded_blob_size_. The generated instructions require the
+  // load target to be aligned at 8 bytes (2^3).
+  fprintf(fp_, ".balign 8\n");
+}
+
+void PlatformEmbeddedFileWriterWin::Comment(const char* string) {
+  fprintf(fp_, "// %s\n", string);
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareLabel(const char* name) {
+  fprintf(fp_, "%s%s:\n", SYMBOL_PREFIX, name);
+}
+
+void PlatformEmbeddedFileWriterWin::SourceInfo(int fileid, const char* filename,
+                                               int line) {
+  fprintf(fp_, ".loc %d %d\n", fileid, line);
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareFunctionBegin(const char* name) {
+  DeclareLabel(name);
+
+  if (target_arch_ == EmbeddedTargetArch::kArm64) {
+    // Windows ARM64 assembly is in GAS syntax, but ".type" is invalid directive
+    // in PE/COFF for Windows.
+  } else {
+    // The directives for inserting debugging information on Windows come
+    // from the PE (Portable Executable) and COFF (Common Object File Format)
+    // standards. Documented here:
+    // https://docs.microsoft.com/en-us/windows/desktop/debug/pe-format
+    //
+    // .scl 2 means StorageClass external.
+    // .type 32 means Type Representation Function.
+    fprintf(fp_, ".def %s%s; .scl 2; .type 32; .endef;\n", SYMBOL_PREFIX, name);
+  }
+}
+
+void PlatformEmbeddedFileWriterWin::DeclareFunctionEnd(const char* name) {}
+
+int PlatformEmbeddedFileWriterWin::HexLiteral(uint64_t value) {
+  return fprintf(fp_, "0x%" PRIx64, value);
+}
+
+void PlatformEmbeddedFileWriterWin::FilePrologue() {}
+
+void PlatformEmbeddedFileWriterWin::DeclareExternalFilename(
+    int fileid, const char* filename) {
+  // Replace any Windows style paths (backslashes) with forward
+  // slashes.
+  std::string fixed_filename(filename);
+  std::replace(fixed_filename.begin(), fixed_filename.end(), '\\', '/');
+  fprintf(fp_, ".file %d \"%s\"\n", fileid, fixed_filename.c_str());
+}
+
+void PlatformEmbeddedFileWriterWin::FileEpilogue() {}
+
+int PlatformEmbeddedFileWriterWin::IndentedDataDirective(
+    DataDirective directive) {
+  return fprintf(fp_, "  %s ", DirectiveAsString(directive));
+}
+
+#endif
+
+#undef SYMBOL_PREFIX
+#undef V8_ASSEMBLER_IS_MASM
+#undef V8_ASSEMBLER_IS_MARMASM
+#undef V8_COMPILER_IS_MSVC
+
+}  // namespace internal
+}  // namespace v8
diff --git a/src/snapshot/embedded/platform-embedded-file-writer-win.h b/src/snapshot/embedded/platform-embedded-file-writer-win.h
new file mode 100644
index 0000000..5a0c3dc
--- /dev/null
+++ b/src/snapshot/embedded/platform-embedded-file-writer-win.h
@@ -0,0 +1,70 @@
+// Copyright 2019 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_PLATFORM_EMBEDDED_FILE_WRITER_WIN_H_
+#define V8_SNAPSHOT_EMBEDDED_PLATFORM_EMBEDDED_FILE_WRITER_WIN_H_
+
+#include "src/base/macros.h"
+#include "src/snapshot/embedded/platform-embedded-file-writer-base.h"
+
+namespace v8 {
+namespace internal {
+
+class PlatformEmbeddedFileWriterWin : public PlatformEmbeddedFileWriterBase {
+ public:
+  PlatformEmbeddedFileWriterWin(EmbeddedTargetArch target_arch,
+                                EmbeddedTargetOs target_os)
+      : target_arch_(target_arch), target_os_(target_os) {
+    USE(target_os_);
+    DCHECK_EQ(target_os_, EmbeddedTargetOs::kWin);
+  }
+
+  void SectionText() override;
+  void SectionData() override;
+  void SectionRoData() override;
+
+  void AlignToCodeAlignment() override;
+  void AlignToDataAlignment() override;
+
+  void DeclareUint32(const char* name, uint32_t value) override;
+  void DeclarePointerToSymbol(const char* name, const char* target) override;
+
+  void DeclareLabel(const char* name) override;
+
+  void SourceInfo(int fileid, const char* filename, int line) override;
+  void DeclareFunctionBegin(const char* name) override;
+  void DeclareFunctionEnd(const char* name) override;
+
+  int HexLiteral(uint64_t value) override;
+
+  void Comment(const char* string) override;
+
+  void FilePrologue() override;
+  void DeclareExternalFilename(int fileid, const char* filename) override;
+  void FileEpilogue() override;
+
+  int IndentedDataDirective(DataDirective directive) override;
+
+  void StartPdataSection();
+  void EndPdataSection();
+  void StartXdataSection();
+  void EndXdataSection();
+  void DeclareExternalFunction(const char* name);
+
+  // Emits an RVA (address relative to the module load address) specified as an
+  // offset from a given symbol.
+  void DeclareRvaToSymbol(const char* name, uint64_t offset = 0);
+
+ private:
+  void DeclareSymbolGlobal(const char* name);
+
+ private:
+  const EmbeddedTargetArch target_arch_;
+  const EmbeddedTargetOs target_os_;
+};
+
+}  // namespace internal
+}  // namespace v8
+
+#endif  // V8_SNAPSHOT_EMBEDDED_PLATFORM_EMBEDDED_FILE_WRITER_WIN_H_