From dc3de67047032343d89193fc87267e64ea3d325e Mon Sep 17 00:00:00 2001 From: scottmg Date: Sun, 11 Jun 2017 07:34:32 -0700 Subject: [PATCH] Stubbed out linking on Fuchsia Follows https://codereview.chromium.org/2931143002/. Sufficient to link d8 with target_os="fuchsia" in Chrome. No implementations of platform functions yet, just stubs. BUG=chromium:731217 Review-Url: https://codereview.chromium.org/2932053004 Cr-Commit-Position: refs/heads/master@{#45832} --- BUILD.gn | 5 ++ src/base/debug/stack_trace_fuchsia.cc | 38 ++++++++++++ src/base/platform/platform-fuchsia.cc | 85 +++++++++++++++++++++++++++ src/v8.gyp | 6 ++ 4 files changed, 134 insertions(+) create mode 100644 src/base/debug/stack_trace_fuchsia.cc create mode 100644 src/base/platform/platform-fuchsia.cc diff --git a/BUILD.gn b/BUILD.gn index f80ccaa164..a03783884e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -2597,6 +2597,11 @@ v8_component("v8_libbase") { "src/base/platform/platform-linux.cc", ] } + } else if (is_fuchsia) { + sources += [ + "src/base/debug/stack_trace_fuchsia.cc", + "src/base/platform/platform-fuchsia.cc", + ] } else if (is_mac) { sources += [ "src/base/debug/stack_trace_posix.cc", diff --git a/src/base/debug/stack_trace_fuchsia.cc b/src/base/debug/stack_trace_fuchsia.cc new file mode 100644 index 0000000000..4ad594b9e8 --- /dev/null +++ b/src/base/debug/stack_trace_fuchsia.cc @@ -0,0 +1,38 @@ +// Copyright 2017 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/base/debug/stack_trace.h" + +#include +#include + +#include "src/base/platform/platform.h" + +namespace v8 { +namespace base { +namespace debug { + +bool EnableInProcessStackDumping() { + CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217. + return false; +} + +void DisableSignalStackDump() {} + +StackTrace::StackTrace() {} + +void StackTrace::Print() const { + std::string backtrace = ToString(); + OS::Print("%s\n", backtrace.c_str()); +} + +void StackTrace::OutputToStream(std::ostream* os) const { + for (size_t i = 0; i < count_; ++i) { + *os << "#" << std::setw(2) << i << trace_[i] << "\n"; + } +} + +} // namespace debug +} // namespace base +} // namespace v8 diff --git a/src/base/platform/platform-fuchsia.cc b/src/base/platform/platform-fuchsia.cc new file mode 100644 index 0000000000..149ca037e4 --- /dev/null +++ b/src/base/platform/platform-fuchsia.cc @@ -0,0 +1,85 @@ +// Copyright 2017 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/base/macros.h" +#include "src/base/platform/platform-posix.h" +#include "src/base/platform/platform.h" + +namespace v8 { +namespace base { + +TimezoneCache* OS::CreateTimezoneCache() { return new PosixTimezoneCache(); } + +std::vector OS::GetSharedLibraryAddresses() { + CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217. + return std::vector(); +} + +void OS::SignalCodeMovingGC() { + CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217. +} + +VirtualMemory::VirtualMemory() : address_(NULL), size_(0) {} + +VirtualMemory::VirtualMemory(size_t size) + : address_(ReserveRegion(size)), size_(size) { + CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217. +} + +VirtualMemory::VirtualMemory(size_t size, size_t alignment) + : address_(NULL), size_(0) {} + +VirtualMemory::~VirtualMemory() {} + +bool VirtualMemory::IsReserved() { return false; } + +void VirtualMemory::Reset() {} + +bool VirtualMemory::Commit(void* address, size_t size, bool is_executable) { + return false; +} + +bool VirtualMemory::Uncommit(void* address, size_t size) { return false; } + +bool VirtualMemory::Guard(void* address) { return false; } + +// static +void* VirtualMemory::ReserveRegion(size_t size) { + CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217. + return NULL; +} + +// static +bool VirtualMemory::CommitRegion(void* base, size_t size, bool is_executable) { + CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217. + return false; +} + +// static +bool VirtualMemory::UncommitRegion(void* base, size_t size) { + CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217. + return false; +} + +// static +bool VirtualMemory::ReleasePartialRegion(void* base, size_t size, + void* free_start, size_t free_size) { + CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217. + return false; +} + +// static +bool VirtualMemory::ReleaseRegion(void* base, size_t size) { + CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217. + return false; +} + +// static +bool VirtualMemory::HasLazyCommits() { + CHECK(false); // TODO(fuchsia): Port, https://crbug.com/731217. + return false; +} + +} // namespace base +} // namespace v8 diff --git a/src/v8.gyp b/src/v8.gyp index 0da448dd13..bdb0da77c5 100644 --- a/src/v8.gyp +++ b/src/v8.gyp @@ -2203,6 +2203,12 @@ 'base/platform/platform-posix.cc' ]}, ], + ['OS=="fuchsia"', { + 'sources': [ + 'base/debug/stack_trace_fuchsia.cc', + 'base/platform/platform-fuchsia.cc', + ]}, + ], ['OS=="solaris"', { 'link_settings': { 'libraries': [