11cb0ef41Sopenharmony_ci// Copyright 2019 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_PLATFORM_EMBEDDED_FILE_WRITER_GENERIC_H_
61cb0ef41Sopenharmony_ci#define V8_SNAPSHOT_EMBEDDED_PLATFORM_EMBEDDED_FILE_WRITER_GENERIC_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include "src/base/macros.h"
91cb0ef41Sopenharmony_ci#include "src/common/globals.h"  // For V8_OS_WIN_X64
101cb0ef41Sopenharmony_ci#include "src/snapshot/embedded/platform-embedded-file-writer-base.h"
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_cinamespace v8 {
131cb0ef41Sopenharmony_cinamespace internal {
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ciclass PlatformEmbeddedFileWriterGeneric
161cb0ef41Sopenharmony_ci    : public PlatformEmbeddedFileWriterBase {
171cb0ef41Sopenharmony_ci public:
181cb0ef41Sopenharmony_ci  PlatformEmbeddedFileWriterGeneric(EmbeddedTargetArch target_arch,
191cb0ef41Sopenharmony_ci                                    EmbeddedTargetOs target_os)
201cb0ef41Sopenharmony_ci      : target_arch_(target_arch), target_os_(target_os) {
211cb0ef41Sopenharmony_ci    DCHECK(target_os_ == EmbeddedTargetOs::kChromeOS ||
221cb0ef41Sopenharmony_ci           target_os_ == EmbeddedTargetOs::kFuchsia ||
231cb0ef41Sopenharmony_ci           target_os_ == EmbeddedTargetOs::kGeneric);
241cb0ef41Sopenharmony_ci  }
251cb0ef41Sopenharmony_ci
261cb0ef41Sopenharmony_ci  void SectionText() override;
271cb0ef41Sopenharmony_ci  void SectionData() override;
281cb0ef41Sopenharmony_ci  void SectionRoData() override;
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci  void AlignToCodeAlignment() override;
311cb0ef41Sopenharmony_ci  void AlignToDataAlignment() override;
321cb0ef41Sopenharmony_ci
331cb0ef41Sopenharmony_ci  void DeclareUint32(const char* name, uint32_t value) override;
341cb0ef41Sopenharmony_ci  void DeclarePointerToSymbol(const char* name, const char* target) override;
351cb0ef41Sopenharmony_ci
361cb0ef41Sopenharmony_ci  void DeclareSymbolGlobal(const char* name) override;
371cb0ef41Sopenharmony_ci  void DeclareLabel(const char* name) override;
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_ci  void SourceInfo(int fileid, const char* filename, int line) override;
401cb0ef41Sopenharmony_ci  void DeclareFunctionBegin(const char* name, uint32_t size) override;
411cb0ef41Sopenharmony_ci  void DeclareFunctionEnd(const char* name) override;
421cb0ef41Sopenharmony_ci
431cb0ef41Sopenharmony_ci  void Comment(const char* string) override;
441cb0ef41Sopenharmony_ci
451cb0ef41Sopenharmony_ci  void FilePrologue() override;
461cb0ef41Sopenharmony_ci  void DeclareExternalFilename(int fileid, const char* filename) override;
471cb0ef41Sopenharmony_ci  void FileEpilogue() override;
481cb0ef41Sopenharmony_ci
491cb0ef41Sopenharmony_ci  int IndentedDataDirective(DataDirective directive) override;
501cb0ef41Sopenharmony_ci
511cb0ef41Sopenharmony_ci  DataDirective ByteChunkDataDirective() const override;
521cb0ef41Sopenharmony_ci
531cb0ef41Sopenharmony_ci private:
541cb0ef41Sopenharmony_ci  const EmbeddedTargetArch target_arch_;
551cb0ef41Sopenharmony_ci  const EmbeddedTargetOs target_os_;
561cb0ef41Sopenharmony_ci};
571cb0ef41Sopenharmony_ci
581cb0ef41Sopenharmony_ci}  // namespace internal
591cb0ef41Sopenharmony_ci}  // namespace v8
601cb0ef41Sopenharmony_ci
611cb0ef41Sopenharmony_ci#endif  // V8_SNAPSHOT_EMBEDDED_PLATFORM_EMBEDDED_FILE_WRITER_GENERIC_H_
62