Skip to content

Commit

Permalink
Patch v8/src/heap/third-party
Browse files Browse the repository at this point in the history
Provide a stub `third_party_heap::Heap` implementation to work around
linker erors with Visual Studio.

Refs: #10
  • Loading branch information
bnoordhuis committed Apr 21, 2020
1 parent a971abe commit fe73b9b
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 0 deletions.
72 changes: 72 additions & 0 deletions patches/0002-Patch-v8-src-heap-third-party.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
From 3412c509ea1cda47fc598f28ebecd3cec3a9cce6 Mon Sep 17 00:00:00 2001
From: Ben Noordhuis <[email protected]>
Date: Tue, 21 Apr 2020 18:15:06 +0200
Subject: [PATCH] Patch v8/src/heap/third-party

Provide a stub `third_party_heap::Heap` implementation to work around
linker erors with Visual Studio.

Refs: https://github.com/bnoordhuis/v8-cmake/issues/10
---
v8/src/heap/third-party/heap-api-stub.cc | 49 ++++++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 v8/src/heap/third-party/heap-api-stub.cc

diff --git a/v8/src/heap/third-party/heap-api-stub.cc b/v8/src/heap/third-party/heap-api-stub.cc
new file mode 100644
index 00000000..ff3c09f6
--- /dev/null
+++ b/v8/src/heap/third-party/heap-api-stub.cc
@@ -0,0 +1,49 @@
+// Copyright 2020 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/heap/third-party/heap-api.h"
+#include "src/execution/isolate-utils-inl.h"
+#include "src/heap/heap-inl.h"
+
+// Work around Visual Studio linker errors when V8_ENABLE_THIRD_PARTY_HEAP
+// is disabled.
+#ifndef V8_ENABLE_THIRD_PARTY_HEAP
+
+namespace v8 {
+namespace internal {
+
+Isolate* Heap::GetIsolateFromWritableObject(HeapObject object) {
+ return GetHeapFromWritableObject(object)->isolate();
+}
+
+} // namespace internal
+} // namespace v8
+
+namespace v8 {
+namespace internal {
+namespace third_party_heap {
+
+// static
+std::unique_ptr<Heap> Heap::New(v8::Isolate*) { return nullptr; }
+
+// static
+v8::Isolate* Heap::GetIsolate(Address) { return nullptr; }
+
+AllocationResult Heap::Allocate(size_t) {
+ return AllocationResult();
+}
+
+AllocationResult Heap::AllocateCode(size_t) {
+ return AllocationResult();
+}
+
+Address Heap::GetObjectFromInnerPointer(Address) { return 0; }
+
+void Heap::CollectGarbage() {}
+
+} // namespace third_party_heap
+} // namespace internal
+} // namespace v8
+
+#endif // !defined(V8_ENABLE_THIRD_PARTY_HEAP)
--
2.20.1

49 changes: 49 additions & 0 deletions v8/src/heap/third-party/heap-api-stub.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright 2020 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/heap/third-party/heap-api.h"
#include "src/execution/isolate-utils-inl.h"
#include "src/heap/heap-inl.h"

// Work around Visual Studio linker errors when V8_ENABLE_THIRD_PARTY_HEAP
// is disabled.
#ifndef V8_ENABLE_THIRD_PARTY_HEAP

namespace v8 {
namespace internal {

Isolate* Heap::GetIsolateFromWritableObject(HeapObject object) {
return GetHeapFromWritableObject(object)->isolate();
}

} // namespace internal
} // namespace v8

namespace v8 {
namespace internal {
namespace third_party_heap {

// static
std::unique_ptr<Heap> Heap::New(v8::Isolate*) { return nullptr; }

// static
v8::Isolate* Heap::GetIsolate(Address) { return nullptr; }

AllocationResult Heap::Allocate(size_t) {
return AllocationResult();
}

AllocationResult Heap::AllocateCode(size_t) {
return AllocationResult();
}

Address Heap::GetObjectFromInnerPointer(Address) { return 0; }

void Heap::CollectGarbage() {}

} // namespace third_party_heap
} // namespace internal
} // namespace v8

#endif // !defined(V8_ENABLE_THIRD_PARTY_HEAP)

0 comments on commit fe73b9b

Please sign in to comment.