chromium/v8/src/snapshot/embedded/platform-embedded-file-writer-base.h

// 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_BASE_H_
#define V8_SNAPSHOT_EMBEDDED_PLATFORM_EMBEDDED_FILE_WRITER_BASE_H_

#include <cinttypes>
#include <cstdio>  // For FILE.
#include <memory>

#if V8_ENABLE_DRUMBRAKE
#include <string>
#endif  // V8_ENABLE_DRUMBRAKE

namespace v8 {
namespace internal {

class EmbeddedData;

enum DataDirective {};

DataDirective PointerSizeDirective();
int DataDirectiveSize(DataDirective directive);

enum class EmbeddedTargetOs {};

enum class EmbeddedTargetArch {};

// The platform-dependent logic for emitting assembly code for the generated
// embedded.S file.
class PlatformEmbeddedFileWriterBase {};

// The factory function. Returns the appropriate platform-specific instance.
std::unique_ptr<PlatformEmbeddedFileWriterBase> NewPlatformEmbeddedFileWriter(
    const char* target_arch, const char* target_os);

#if V8_ENABLE_DRUMBRAKE
inline bool IsDrumBrakeInstructionHandler(const char* name) {
  std::string builtin_name(name);
  return builtin_name.find("Builtins_r2r_") == 0 ||
         builtin_name.find("Builtins_r2s_") == 0 ||
         builtin_name.find("Builtins_s2r_") == 0 ||
         builtin_name.find("Builtins_s2s_") == 0;
}
#endif  // V8_ENABLE_DRUMBRAKE

}  // namespace internal
}  // namespace v8

#endif  // V8_SNAPSHOT_EMBEDDED_PLATFORM_EMBEDDED_FILE_WRITER_BASE_H_