Commit a52858dc authored by John Xu's avatar John Xu Committed by V8 LUCI CQ

Introduce Starboard snapshot writer

Cobalt is a V8 embedder and it has its own platform abstraction. So
to V8 the OS name is "Starboard" instead of Win/Linux/Android even
though the real OS is one of them. To select the right embedded file
writer for Cobalt, we need some customizations in
platform-embedded-file-writer-base.*.

Bug: v8:10927
Change-Id: I6dadb4690ade0b4aebec14bc87fdc6d71c03b3bb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2963804
Auto-Submit: John Xu <johnx@google.com>
Commit-Queue: John Xu <johnx@google.com>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75170}
parent 91ddeb06
......@@ -141,6 +141,8 @@ EmbeddedTargetOs ToEmbeddedTargetOs(const char* s) {
return EmbeddedTargetOs::kMac;
} else if (string == "win") {
return EmbeddedTargetOs::kWin;
} else if (string == "starboard") {
return EmbeddedTargetOs::kStarboard;
} else {
return EmbeddedTargetOs::kGeneric;
}
......@@ -153,6 +155,27 @@ std::unique_ptr<PlatformEmbeddedFileWriterBase> NewPlatformEmbeddedFileWriter(
auto embedded_target_arch = ToEmbeddedTargetArch(target_arch);
auto embedded_target_os = ToEmbeddedTargetOs(target_os);
if (embedded_target_os == EmbeddedTargetOs::kStarboard) {
// target OS is "Starboard" for all starboard build so we need to
// use host OS macros to decide which writer to use.
// Cobalt also has Windows-based Posix target platform,
// in which case generic writer should be used.
switch (DefaultEmbeddedTargetOs()) {
case EmbeddedTargetOs::kMac:
#if defined(V8_TARGET_OS_WIN)
case EmbeddedTargetOs::kWin:
// V8_TARGET_OS_WIN is used to enable WINDOWS-specific assembly code,
// for windows-hosted non-windows targets, we should still fallback to
// the generic writer.
#endif
embedded_target_os = DefaultEmbeddedTargetOs();
break;
default:
// In the block below, we will use WriterGeneric for other cases.
break;
}
}
if (embedded_target_os == EmbeddedTargetOs::kAIX) {
return std::make_unique<PlatformEmbeddedFileWriterAIX>(embedded_target_arch,
embedded_target_os);
......
......@@ -32,6 +32,7 @@ enum class EmbeddedTargetOs {
kFuchsia,
kMac,
kWin,
kStarboard,
kGeneric, // Everything not covered above falls in here.
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment