chore: remove mips64el patches as they've largely been upstreamed (#18628)
This commit is contained in:
parent
a45afddb75
commit
4b9da4dd0e
112 changed files with 10 additions and 73370 deletions
8
patches/v8/.patches
Normal file
8
patches/v8/.patches
Normal file
|
@ -0,0 +1,8 @@
|
|||
add_realloc.patch
|
||||
build_gn.patch
|
||||
expose_mksnapshot.patch
|
||||
deps_provide_more_v8_backwards_compatibility.patch
|
||||
dcheck.patch
|
||||
export_symbols_needed_for_windows_build.patch
|
||||
workaround_an_undefined_symbol_error.patch
|
||||
do_not_export_private_v8_symbols_on_windows.patch
|
27
patches/v8/README.md
Normal file
27
patches/v8/README.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
### Exporting node's patches to v8
|
||||
|
||||
```cmd
|
||||
$ cd third_party/electron_node
|
||||
$ CURRENT_NODE_VERSION=vX.Y.Z # e.g. v10.11.0
|
||||
|
||||
# Find the last commit with the message "deps: update V8 to <some version>"
|
||||
# This commit corresponds to node resetting V8 to its pristine upstream
|
||||
# state at the stated version.
|
||||
$ LAST_V8_UPDATE="$(git log --grep='^deps: update V8' --format='%H' -1 deps/v8)"
|
||||
|
||||
# This creates a patch file containing all changes in deps/v8 from
|
||||
# $LAST_V8_UPDATE up to the current node version, formatted in a way that
|
||||
# it will apply cleanly to the V8 repository (i.e. with `deps/v8`
|
||||
# stripped off the path and excluding the v8/gypfiles directory, which
|
||||
# isn't present in V8.
|
||||
$ git format-patch \
|
||||
--relative=deps/v8 \
|
||||
$LAST_V8_UPDATE..$CURRENT_NODE_VERSION \
|
||||
deps/v8 \
|
||||
':(exclude)deps/v8/gypfiles' \
|
||||
--stdout
|
||||
```
|
||||
|
||||
When upgrading to a new version of node, make sure to match node's patches to
|
||||
v8 by removing all the `deps_*` patches and re-exporting node's v8 patches
|
||||
using the process above.
|
46
patches/v8/add_realloc.patch
Normal file
46
patches/v8/add_realloc.patch
Normal file
|
@ -0,0 +1,46 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Mon, 22 Oct 2018 10:47:11 -0700
|
||||
Subject: add_realloc.patch
|
||||
|
||||
Blink overrides ArrayBuffer's allocator with its own one, while Node simply
|
||||
uses malloc and free, so we need to use v8's allocator in Node. As part of the
|
||||
10.6.0 upgrade, we needed to make SerializerDelegate accept an allocator
|
||||
argument in its constructor, and override ReallocateBufferMemory and
|
||||
FreeBufferMemory to use the allocator. We cannot simply allocate and then memcpy
|
||||
when we override ReallocateBufferMemory, so we therefore need to implement
|
||||
Realloc on the v8 side.
|
||||
|
||||
diff --git a/include/v8.h b/include/v8.h
|
||||
index c54b088404229dccf015e20b6a5bab19d3d94e69..cc603dc4aae69de4b09f06ed0bca48cdae8eebd3 100644
|
||||
--- a/include/v8.h
|
||||
+++ b/include/v8.h
|
||||
@@ -4624,6 +4624,13 @@ class V8_EXPORT ArrayBuffer : public Object {
|
||||
*/
|
||||
virtual void* AllocateUninitialized(size_t length) = 0;
|
||||
|
||||
+ /**
|
||||
+ * Free the memory block of size |length|, pointed to by |data|.
|
||||
+ * That memory must be previously allocated by |Allocate| and not yet freed
|
||||
+ * with a call to |Free| or |Realloc|
|
||||
+ */
|
||||
+ virtual void* Realloc(void* data, size_t length);
|
||||
+
|
||||
/**
|
||||
* Free the memory block of size |length|, pointed to by |data|.
|
||||
* That memory is guaranteed to be previously allocated by |Allocate|.
|
||||
diff --git a/src/api/api.cc b/src/api/api.cc
|
||||
index 9b2c117e1ae756e3c9d3f3b0dc36a7b348c53b51..6a501f67ebf900ee30d55bd05ccc58845d71f418 100644
|
||||
--- a/src/api/api.cc
|
||||
+++ b/src/api/api.cc
|
||||
@@ -515,6 +515,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) {
|
||||
i::V8::SetSnapshotBlob(snapshot_blob);
|
||||
}
|
||||
|
||||
+void* v8::ArrayBuffer::Allocator::Realloc(void* data, size_t length) {
|
||||
+ UNIMPLEMENTED();
|
||||
+}
|
||||
+
|
||||
namespace {
|
||||
|
||||
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
|
37
patches/v8/build_gn.patch
Normal file
37
patches/v8/build_gn.patch
Normal file
|
@ -0,0 +1,37 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Apthorp <nornagon@nornagon.net>
|
||||
Date: Tue, 16 Apr 2019 10:43:04 -0700
|
||||
Subject: build_gn.patch
|
||||
|
||||
|
||||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
index cf089979d1446b7628ce3a7e634e4e4d2267024e..fc4571440d5e7b8af281b01d9a66cd563f5ab03d 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -269,7 +269,7 @@ config("internal_config") {
|
||||
":v8_header_features",
|
||||
]
|
||||
|
||||
- if (is_component_build) {
|
||||
+ if (is_component_build || is_electron_build) {
|
||||
defines += [ "BUILDING_V8_SHARED" ]
|
||||
}
|
||||
}
|
||||
@@ -3788,7 +3788,7 @@ if (current_toolchain == v8_generator_toolchain) {
|
||||
"src/interpreter/bytecodes.h",
|
||||
]
|
||||
|
||||
- configs = [ ":internal_config" ]
|
||||
+ configs = [ ":internal_config_base" ]
|
||||
|
||||
deps = [
|
||||
":v8_libbase",
|
||||
@@ -3819,6 +3819,8 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
|
||||
|
||||
configs = [ ":internal_config" ]
|
||||
|
||||
+ configs += [ "//electron/build/config:build_time_executable" ]
|
||||
+
|
||||
deps = [
|
||||
":v8_base_without_compiler",
|
||||
":v8_compiler_for_mksnapshot",
|
36
patches/v8/dcheck.patch
Normal file
36
patches/v8/dcheck.patch
Normal file
|
@ -0,0 +1,36 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ales Pergl <alpergl@microsoft.com>
|
||||
Date: Mon, 22 Oct 2018 10:47:12 -0700
|
||||
Subject: dcheck.patch
|
||||
|
||||
|
||||
diff --git a/src/api/api.cc b/src/api/api.cc
|
||||
index 1b39655a1221b3df0012f5cc26697841d2c100d6..a6ea06b358f4ff21b3f4313c82b4ec52ca5513b8 100644
|
||||
--- a/src/api/api.cc
|
||||
+++ b/src/api/api.cc
|
||||
@@ -8236,7 +8236,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
|
||||
}
|
||||
|
||||
void Isolate::RunMicrotasks() {
|
||||
- DCHECK_NE(MicrotasksPolicy::kScoped, GetMicrotasksPolicy());
|
||||
+ // DCHECK_NE(MicrotasksPolicy::kScoped, GetMicrotasksPolicy());
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
||||
isolate->default_microtask_queue()->RunMicrotasks(isolate);
|
||||
}
|
||||
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
|
||||
index 209832dddc21b3c7ef3ab6d8586572b5eaf5f337..7416eda8db13019d8db54bf1a54a9ae4e15982d1 100644
|
||||
--- a/src/heap/heap.cc
|
||||
+++ b/src/heap/heap.cc
|
||||
@@ -5080,9 +5080,9 @@ void Heap::TearDown() {
|
||||
void Heap::AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback,
|
||||
GCType gc_type, void* data) {
|
||||
DCHECK_NOT_NULL(callback);
|
||||
- DCHECK(gc_prologue_callbacks_.end() ==
|
||||
- std::find(gc_prologue_callbacks_.begin(), gc_prologue_callbacks_.end(),
|
||||
- GCCallbackTuple(callback, gc_type, data)));
|
||||
+// DCHECK(gc_prologue_callbacks_.end() ==
|
||||
+// std::find(gc_prologue_callbacks_.begin(), gc_prologue_callbacks_.end(),
|
||||
+// GCCallbackTuple(callback, gc_type, data)));
|
||||
gc_prologue_callbacks_.emplace_back(callback, gc_type, data);
|
||||
}
|
||||
|
346
patches/v8/deps_provide_more_v8_backwards_compatibility.patch
Normal file
346
patches/v8/deps_provide_more_v8_backwards_compatibility.patch
Normal file
|
@ -0,0 +1,346 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Anna Henningsen <anna@addaleax.net>
|
||||
Date: Fri, 28 Sep 2018 22:43:38 -0400
|
||||
Subject: deps: provide more V8 backwards compatibility
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Add back a number deprecated APIs, using shims that
|
||||
should work well enough at least for the duration of Node 11
|
||||
and do not come with significant maintenance overhead.
|
||||
|
||||
Refs: https://github.com/nodejs/node/issues/23122
|
||||
|
||||
PR-URL: https://github.com/nodejs/node/pull/23158
|
||||
Reviewed-By: Rich Trott <rtrott@gmail.com>
|
||||
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
|
||||
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
|
||||
Reviewed-By: James M Snell <jasnell@gmail.com>
|
||||
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
|
||||
Reviewed-By: Yang Guo <yangguo@chromium.org>
|
||||
Reviewed-By: Michaël Zasso <targos@protonmail.com>
|
||||
|
||||
diff --git a/include/v8.h b/include/v8.h
|
||||
index cc603dc4aae69de4b09f06ed0bca48cdae8eebd3..c59b0fa69880c237e3b60f190160d8b94862bf36 100644
|
||||
--- a/include/v8.h
|
||||
+++ b/include/v8.h
|
||||
@@ -1108,6 +1108,10 @@ class V8_EXPORT PrimitiveArray {
|
||||
public:
|
||||
static Local<PrimitiveArray> New(Isolate* isolate, int length);
|
||||
int Length() const;
|
||||
+ V8_DEPRECATED("Use Isolate* version",
|
||||
+ void Set(int index, Local<Primitive> item));
|
||||
+ V8_DEPRECATED("Use Isolate* version",
|
||||
+ Local<Primitive> Get(int index));
|
||||
void Set(Isolate* isolate, int index, Local<Primitive> item);
|
||||
Local<Primitive> Get(Isolate* isolate, int index);
|
||||
};
|
||||
@@ -1816,6 +1820,8 @@ class V8_EXPORT StackTrace {
|
||||
/**
|
||||
* Returns a StackFrame at a particular index.
|
||||
*/
|
||||
+ V8_DEPRECATED("Use Isolate version",
|
||||
+ Local<StackFrame> GetFrame(uint32_t index) const);
|
||||
Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;
|
||||
|
||||
/**
|
||||
@@ -2509,6 +2515,13 @@ class V8_EXPORT Value : public Data {
|
||||
|
||||
Local<Boolean> ToBoolean(Isolate* isolate) const;
|
||||
|
||||
+ inline V8_DEPRECATED("Use maybe version",
|
||||
+ Local<Boolean> ToBoolean() const);
|
||||
+ inline V8_DEPRECATED("Use maybe version", Local<String> ToString() const);
|
||||
+ inline V8_DEPRECATED("Use maybe version", Local<Object> ToObject() const);
|
||||
+ inline V8_DEPRECATED("Use maybe version",
|
||||
+ Local<Integer> ToInteger() const);
|
||||
+
|
||||
/**
|
||||
* Attempts to convert a string to an array index.
|
||||
* Returns an empty handle if the conversion fails.
|
||||
@@ -2525,7 +2538,14 @@ class V8_EXPORT Value : public Data {
|
||||
Local<Context> context) const;
|
||||
V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
|
||||
|
||||
+ V8_DEPRECATED("Use maybe version", bool BooleanValue() const);
|
||||
+ V8_DEPRECATED("Use maybe version", double NumberValue() const);
|
||||
+ V8_DEPRECATED("Use maybe version", int64_t IntegerValue() const);
|
||||
+ V8_DEPRECATED("Use maybe version", uint32_t Uint32Value() const);
|
||||
+ V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
|
||||
+
|
||||
/** JS == */
|
||||
+ V8_DEPRECATED("Use maybe version", bool Equals(Local<Value> that) const);
|
||||
V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context,
|
||||
Local<Value> that) const;
|
||||
bool StrictEquals(Local<Value> that) const;
|
||||
@@ -2632,6 +2652,8 @@ class V8_EXPORT String : public Name {
|
||||
* Returns the number of bytes in the UTF-8 encoded
|
||||
* representation of this string.
|
||||
*/
|
||||
+ V8_DEPRECATED("Use Isolate version instead", int Utf8Length() const);
|
||||
+
|
||||
int Utf8Length(Isolate* isolate) const;
|
||||
|
||||
/**
|
||||
@@ -2688,12 +2710,23 @@ class V8_EXPORT String : public Name {
|
||||
// 16-bit character codes.
|
||||
int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1,
|
||||
int options = NO_OPTIONS) const;
|
||||
+ V8_DEPRECATED("Use Isolate* version",
|
||||
+ int Write(uint16_t* buffer, int start = 0, int length = -1,
|
||||
+ int options = NO_OPTIONS) const);
|
||||
// One byte characters.
|
||||
int WriteOneByte(Isolate* isolate, uint8_t* buffer, int start = 0,
|
||||
int length = -1, int options = NO_OPTIONS) const;
|
||||
+ V8_DEPRECATED("Use Isolate* version",
|
||||
+ int WriteOneByte(uint8_t* buffer, int start = 0,
|
||||
+ int length = -1, int options = NO_OPTIONS)
|
||||
+ const);
|
||||
// UTF-8 encoded characters.
|
||||
int WriteUtf8(Isolate* isolate, char* buffer, int length = -1,
|
||||
int* nchars_ref = nullptr, int options = NO_OPTIONS) const;
|
||||
+ V8_DEPRECATED("Use Isolate* version",
|
||||
+ int WriteUtf8(char* buffer, int length = -1,
|
||||
+ int* nchars_ref = nullptr,
|
||||
+ int options = NO_OPTIONS) const);
|
||||
|
||||
/**
|
||||
* A zero length string.
|
||||
@@ -2861,6 +2894,9 @@ class V8_EXPORT String : public Name {
|
||||
*/
|
||||
static Local<String> Concat(Isolate* isolate, Local<String> left,
|
||||
Local<String> right);
|
||||
+ static V8_DEPRECATED("Use Isolate* version",
|
||||
+ Local<String> Concat(Local<String> left,
|
||||
+ Local<String> right));
|
||||
|
||||
/**
|
||||
* Creates a new external string using the data defined in the given
|
||||
@@ -2925,6 +2961,8 @@ class V8_EXPORT String : public Name {
|
||||
*/
|
||||
class V8_EXPORT Utf8Value {
|
||||
public:
|
||||
+ V8_DEPRECATED("Use Isolate version",
|
||||
+ explicit Utf8Value(Local<v8::Value> obj));
|
||||
Utf8Value(Isolate* isolate, Local<v8::Value> obj);
|
||||
~Utf8Value();
|
||||
char* operator*() { return str_; }
|
||||
@@ -2948,6 +2986,7 @@ class V8_EXPORT String : public Name {
|
||||
*/
|
||||
class V8_EXPORT Value {
|
||||
public:
|
||||
+ V8_DEPRECATED("Use Isolate version", explicit Value(Local<v8::Value> obj));
|
||||
Value(Isolate* isolate, Local<v8::Value> obj);
|
||||
~Value();
|
||||
uint16_t* operator*() { return str_; }
|
||||
@@ -5281,6 +5320,8 @@ class V8_EXPORT BooleanObject : public Object {
|
||||
class V8_EXPORT StringObject : public Object {
|
||||
public:
|
||||
static Local<Value> New(Isolate* isolate, Local<String> value);
|
||||
+ V8_DEPRECATED("Use Isolate* version",
|
||||
+ static Local<Value> New(Local<String> value));
|
||||
|
||||
Local<String> ValueOf() const;
|
||||
|
||||
@@ -10384,6 +10425,29 @@ template <class T> Value* Value::Cast(T* value) {
|
||||
}
|
||||
|
||||
|
||||
+Local<Boolean> Value::ToBoolean() const {
|
||||
+ return ToBoolean(Isolate::GetCurrent());
|
||||
+}
|
||||
+
|
||||
+
|
||||
+Local<String> Value::ToString() const {
|
||||
+ return ToString(Isolate::GetCurrent()->GetCurrentContext())
|
||||
+ .FromMaybe(Local<String>());
|
||||
+}
|
||||
+
|
||||
+
|
||||
+Local<Object> Value::ToObject() const {
|
||||
+ return ToObject(Isolate::GetCurrent()->GetCurrentContext())
|
||||
+ .FromMaybe(Local<Object>());
|
||||
+}
|
||||
+
|
||||
+
|
||||
+Local<Integer> Value::ToInteger() const {
|
||||
+ return ToInteger(Isolate::GetCurrent()->GetCurrentContext())
|
||||
+ .FromMaybe(Local<Integer>());
|
||||
+}
|
||||
+
|
||||
+
|
||||
Boolean* Boolean::Cast(v8::Value* value) {
|
||||
#ifdef V8_ENABLE_CHECKS
|
||||
CheckCast(value);
|
||||
diff --git a/src/api/api.cc b/src/api/api.cc
|
||||
index 6a501f67ebf900ee30d55bd05ccc58845d71f418..1b39655a1221b3df0012f5cc26697841d2c100d6 100644
|
||||
--- a/src/api/api.cc
|
||||
+++ b/src/api/api.cc
|
||||
@@ -2171,6 +2171,10 @@ int PrimitiveArray::Length() const {
|
||||
return array->length();
|
||||
}
|
||||
|
||||
+void PrimitiveArray::Set(int index, Local<Primitive> item) {
|
||||
+ return Set(Isolate::GetCurrent(), index, item);
|
||||
+}
|
||||
+
|
||||
void PrimitiveArray::Set(Isolate* v8_isolate, int index,
|
||||
Local<Primitive> item) {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
||||
@@ -2184,6 +2188,10 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index,
|
||||
array->set(index, *i_item);
|
||||
}
|
||||
|
||||
+Local<Primitive> PrimitiveArray::Get(int index) {
|
||||
+ return Get(Isolate::GetCurrent(), index);
|
||||
+}
|
||||
+
|
||||
Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
||||
i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
|
||||
@@ -2867,6 +2875,10 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) {
|
||||
|
||||
// --- S t a c k T r a c e ---
|
||||
|
||||
+Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
|
||||
+ return GetFrame(Isolate::GetCurrent(), index);
|
||||
+}
|
||||
+
|
||||
Local<StackFrame> StackTrace::GetFrame(Isolate* v8_isolate,
|
||||
uint32_t index) const {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
||||
@@ -3453,6 +3465,34 @@ MaybeLocal<BigInt> Value::ToBigInt(Local<Context> context) const {
|
||||
RETURN_ESCAPED(result);
|
||||
}
|
||||
|
||||
+bool Value::BooleanValue() const {
|
||||
+ return BooleanValue(Isolate::GetCurrent());
|
||||
+}
|
||||
+
|
||||
+
|
||||
+double Value::NumberValue() const {
|
||||
+ return NumberValue(Isolate::GetCurrent()->GetCurrentContext())
|
||||
+ .FromMaybe(std::numeric_limits<double>::quiet_NaN());
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int64_t Value::IntegerValue() const {
|
||||
+ return NumberValue(Isolate::GetCurrent()->GetCurrentContext())
|
||||
+ .FromMaybe(0);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+uint32_t Value::Uint32Value() const {
|
||||
+ return Uint32Value(Isolate::GetCurrent()->GetCurrentContext())
|
||||
+ .FromMaybe(0);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int32_t Value::Int32Value() const {
|
||||
+ return Int32Value(Isolate::GetCurrent()->GetCurrentContext())
|
||||
+ .FromMaybe(0);
|
||||
+}
|
||||
+
|
||||
bool Value::BooleanValue(Isolate* v8_isolate) const {
|
||||
return Utils::OpenHandle(this)->BooleanValue(
|
||||
reinterpret_cast<i::Isolate*>(v8_isolate));
|
||||
@@ -3801,6 +3841,11 @@ MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const {
|
||||
return Local<Uint32>();
|
||||
}
|
||||
|
||||
+bool Value::Equals(Local<Value> that) const {
|
||||
+ return Equals(Isolate::GetCurrent()->GetCurrentContext(), that)
|
||||
+ .FromMaybe(false);
|
||||
+}
|
||||
+
|
||||
Maybe<bool> Value::Equals(Local<Context> context, Local<Value> that) const {
|
||||
i::Isolate* isolate = Utils::OpenHandle(*context)->GetIsolate();
|
||||
auto self = Utils::OpenHandle(this);
|
||||
@@ -5033,6 +5078,10 @@ bool String::ContainsOnlyOneByte() const {
|
||||
return helper.Check(*str);
|
||||
}
|
||||
|
||||
+int String::Utf8Length() const {
|
||||
+ return Utf8Length(Isolate::GetCurrent());
|
||||
+}
|
||||
+
|
||||
int String::Utf8Length(Isolate* isolate) const {
|
||||
i::Handle<i::String> str = Utils::OpenHandle(this);
|
||||
str = i::String::Flatten(reinterpret_cast<i::Isolate*>(isolate), str);
|
||||
@@ -5185,6 +5234,14 @@ static int WriteUtf8Impl(i::Vector<const Char> string, char* write_start,
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
+
|
||||
+int String::WriteUtf8(char* buffer, int capacity,
|
||||
+ int* nchars_ref, int options) const {
|
||||
+ return WriteUtf8(Isolate::GetCurrent(),
|
||||
+ buffer, capacity, nchars_ref, options);
|
||||
+}
|
||||
+
|
||||
+
|
||||
int String::WriteUtf8(Isolate* v8_isolate, char* buffer, int capacity,
|
||||
int* nchars_ref, int options) const {
|
||||
i::Handle<i::String> str = Utils::OpenHandle(this);
|
||||
@@ -5223,6 +5280,17 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string,
|
||||
return end - start;
|
||||
}
|
||||
|
||||
+int String::WriteOneByte(uint8_t* buffer, int start,
|
||||
+ int length, int options) const {
|
||||
+ return WriteOneByte(Isolate::GetCurrent(), buffer, start, length, options);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int String::Write(uint16_t* buffer, int start, int length,
|
||||
+ int options) const {
|
||||
+ return Write(Isolate::GetCurrent(), buffer, start, length, options);
|
||||
+}
|
||||
+
|
||||
int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start,
|
||||
int length, int options) const {
|
||||
return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer,
|
||||
@@ -6132,6 +6200,11 @@ MaybeLocal<String> String::NewFromTwoByte(Isolate* isolate,
|
||||
return result;
|
||||
}
|
||||
|
||||
+Local<String> v8::String::Concat(Local<String> left,
|
||||
+ Local<String> right) {
|
||||
+ return Concat(Isolate::GetCurrent(), left, right);
|
||||
+}
|
||||
+
|
||||
Local<String> v8::String::Concat(Isolate* v8_isolate, Local<String> left,
|
||||
Local<String> right) {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
||||
@@ -6401,6 +6474,10 @@ bool v8::BooleanObject::ValueOf() const {
|
||||
return jsvalue->value().IsTrue(isolate);
|
||||
}
|
||||
|
||||
+Local<v8::Value> v8::StringObject::New(Local<String> value) {
|
||||
+ return New(Isolate::GetCurrent(), value);
|
||||
+}
|
||||
+
|
||||
Local<v8::Value> v8::StringObject::New(Isolate* v8_isolate,
|
||||
Local<String> value) {
|
||||
i::Handle<i::String> string = Utils::OpenHandle(*value);
|
||||
@@ -8589,6 +8666,9 @@ bool MicrotasksScope::IsRunningMicrotasks(Isolate* v8_isolate) {
|
||||
return microtask_queue->IsRunningMicrotasks();
|
||||
}
|
||||
|
||||
+String::Utf8Value::Utf8Value(v8::Local<v8::Value> obj)
|
||||
+ : Utf8Value(Isolate::GetCurrent(), obj) {}
|
||||
+
|
||||
String::Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> obj)
|
||||
: str_(nullptr), length_(0) {
|
||||
if (obj.IsEmpty()) return;
|
||||
@@ -8606,6 +8686,9 @@ String::Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> obj)
|
||||
|
||||
String::Utf8Value::~Utf8Value() { i::DeleteArray(str_); }
|
||||
|
||||
+String::Value::Value(v8::Local<v8::Value> obj)
|
||||
+ : Value(Isolate::GetCurrent(), obj) {}
|
||||
+
|
||||
String::Value::Value(v8::Isolate* isolate, v8::Local<v8::Value> obj)
|
||||
: str_(nullptr), length_(0) {
|
||||
if (obj.IsEmpty()) return;
|
52
patches/v8/do_not_export_private_v8_symbols_on_windows.patch
Normal file
52
patches/v8/do_not_export_private_v8_symbols_on_windows.patch
Normal file
|
@ -0,0 +1,52 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tomas Rycl <torycl@microsoft.com>
|
||||
Date: Mon, 13 May 2019 15:48:48 +0200
|
||||
Subject: Do not export private V8 symbols on Windows
|
||||
|
||||
This change stops private V8 symbols and internal crt methods being exported.
|
||||
It fixes an issue where native node modules can import
|
||||
incorrect CRT methods and crash on Windows.
|
||||
It also reduces size of node.lib by 75%.
|
||||
|
||||
This patch can be safely removed if, when it is removed, `node.lib` does not
|
||||
contain any standard C++ library exports (e.g. `std::ostringstream`).
|
||||
|
||||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
index 315c7079ed488461a456aff799b4d1f17b896150..0f668eae73686c02a7133df31a79e8a0a7b77707 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -273,6 +273,10 @@ config("internal_config") {
|
||||
":v8_header_features",
|
||||
]
|
||||
|
||||
+ if (!is_component_build && is_electron_build) {
|
||||
+ defines += [ "HIDE_PRIVATE_SYMBOLS" ]
|
||||
+ }
|
||||
+
|
||||
if (is_component_build || is_electron_build) {
|
||||
defines += [ "BUILDING_V8_SHARED" ]
|
||||
}
|
||||
diff --git a/src/base/macros.h b/src/base/macros.h
|
||||
index ad70e9820ddb4a63639ca7738c1836cb87766db5..d40be9b57294583f74594d88d9b7d7b937b2db3c 100644
|
||||
--- a/src/base/macros.h
|
||||
+++ b/src/base/macros.h
|
||||
@@ -414,13 +414,17 @@ bool is_inbounds(float_t v) {
|
||||
#ifdef V8_OS_WIN
|
||||
|
||||
// Setup for Windows shared library export.
|
||||
+#if defined(HIDE_PRIVATE_SYMBOLS)
|
||||
+#define V8_EXPORT_PRIVATE
|
||||
+#else //if !defined(HIDE_PRIVATE_SYMBOLS)
|
||||
#ifdef BUILDING_V8_SHARED
|
||||
#define V8_EXPORT_PRIVATE __declspec(dllexport)
|
||||
#elif USING_V8_SHARED
|
||||
#define V8_EXPORT_PRIVATE __declspec(dllimport)
|
||||
-#else
|
||||
+#else //!(BUILDING_V8_SHARED || USING_V8_SHARED)
|
||||
#define V8_EXPORT_PRIVATE
|
||||
-#endif // BUILDING_V8_SHARED
|
||||
+#endif
|
||||
+#endif
|
||||
|
||||
#else // V8_OS_WIN
|
||||
|
33
patches/v8/export_symbols_needed_for_windows_build.patch
Normal file
33
patches/v8/export_symbols_needed_for_windows_build.patch
Normal file
|
@ -0,0 +1,33 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Apthorp <jeremya@chromium.org>
|
||||
Date: Mon, 15 Apr 2019 18:12:08 -0700
|
||||
Subject: Export symbols needed for Windows build
|
||||
|
||||
These symbols are required to build v8 with BUILD_V8_SHARED on Windows.
|
||||
|
||||
diff --git a/src/objects/objects.h b/src/objects/objects.h
|
||||
index 857f3ed0f6d537cd648f23f04a0ab4c28cce1f96..14c73a0425b4e1e677426eee929910add5615201 100644
|
||||
--- a/src/objects/objects.h
|
||||
+++ b/src/objects/objects.h
|
||||
@@ -791,7 +791,7 @@ enum class KeyCollectionMode {
|
||||
// Utility superclass for stack-allocated objects that must be updated
|
||||
// on gc. It provides two ways for the gc to update instances, either
|
||||
// iterating or updating after gc.
|
||||
-class Relocatable {
|
||||
+class V8_EXPORT_PRIVATE Relocatable {
|
||||
public:
|
||||
explicit inline Relocatable(Isolate* isolate);
|
||||
inline virtual ~Relocatable();
|
||||
diff --git a/src/objects/ordered-hash-table.h b/src/objects/ordered-hash-table.h
|
||||
index a83109ed90fa4544939c3825c3a78856f41128a6..06459f407fb99218490a132bd1c5df859cbf2b3c 100644
|
||||
--- a/src/objects/ordered-hash-table.h
|
||||
+++ b/src/objects/ordered-hash-table.h
|
||||
@@ -60,7 +60,7 @@ namespace internal {
|
||||
// of the removed holes.
|
||||
// [kPrefixSize + 3 + NumberOfRemovedHoles()..length]: Not used
|
||||
template <class Derived, int entrysize>
|
||||
-class OrderedHashTable : public FixedArray {
|
||||
+class V8_EXPORT_PRIVATE OrderedHashTable : public FixedArray {
|
||||
public:
|
||||
// Returns an OrderedHashTable (possibly |table|) with enough space
|
||||
// to add at least one new element.
|
20
patches/v8/expose_mksnapshot.patch
Normal file
20
patches/v8/expose_mksnapshot.patch
Normal file
|
@ -0,0 +1,20 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Mon, 22 Oct 2018 10:47:13 -0700
|
||||
Subject: expose_mksnapshot.patch
|
||||
|
||||
Needed in order to target mksnapshot for mksnapshot zip.
|
||||
|
||||
diff --git a/BUILD.gn b/BUILD.gn
|
||||
index fc4571440d5e7b8af281b01d9a66cd563f5ab03d..2d35a0b051f4130485c783807132ddcc543f4de4 100644
|
||||
--- a/BUILD.gn
|
||||
+++ b/BUILD.gn
|
||||
@@ -3799,8 +3799,6 @@ if (current_toolchain == v8_generator_toolchain) {
|
||||
|
||||
if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
|
||||
v8_executable("mksnapshot") {
|
||||
- visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||
-
|
||||
sources = [
|
||||
"src/snapshot/embedded/embedded-file-writer.cc",
|
||||
"src/snapshot/embedded/embedded-file-writer.h",
|
75
patches/v8/workaround_an_undefined_symbol_error.patch
Normal file
75
patches/v8/workaround_an_undefined_symbol_error.patch
Normal file
|
@ -0,0 +1,75 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Townsend <richard.townsend@arm.com>
|
||||
Date: Wed, 24 Apr 2019 13:57:36 +0100
|
||||
Subject: Workaround an undefined symbol error
|
||||
|
||||
Previously, builds configured with dcheck_always_on=true would error
|
||||
with messages like this in the log:
|
||||
lld-link: error: undefined symbol: public: bool __cdecl
|
||||
v8::internal::CPURegister::IsZero(void) const
|
||||
|
||||
By moving some functions out of the the arm64-assembler header file,
|
||||
this error no longer seems to happen.
|
||||
|
||||
diff --git a/src/codegen/arm64/assembler-arm64.cc b/src/codegen/arm64/assembler-arm64.cc
|
||||
index 1806f82b461a5f7368281bcd3741fd8195a20f11..53da75760ba31bed3e3cf19397474b353bc83fdf 100644
|
||||
--- a/src/codegen/arm64/assembler-arm64.cc
|
||||
+++ b/src/codegen/arm64/assembler-arm64.cc
|
||||
@@ -3786,6 +3786,22 @@ void Assembler::MoveWide(const Register& rd, uint64_t imm, int shift,
|
||||
ImmMoveWide(static_cast<int>(imm)) | ShiftMoveWide(shift));
|
||||
}
|
||||
|
||||
+Instr Assembler::RmNot31(CPURegister rm) {
|
||||
+ DCHECK_NE(rm.code(), kSPRegInternalCode);
|
||||
+ DCHECK(!rm.IsZero());
|
||||
+ return Rm(rm);
|
||||
+}
|
||||
+
|
||||
+Instr Assembler::RdSP(Register rd) {
|
||||
+ DCHECK(!rd.IsZero());
|
||||
+ return (rd.code() & kRegCodeMask) << Rd_offset;
|
||||
+}
|
||||
+
|
||||
+Instr Assembler::RnSP(Register rn) {
|
||||
+ DCHECK(!rn.IsZero());
|
||||
+ return (rn.code() & kRegCodeMask) << Rn_offset;
|
||||
+}
|
||||
+
|
||||
void Assembler::AddSub(const Register& rd, const Register& rn,
|
||||
const Operand& operand, FlagsUpdate S, AddSubOp op) {
|
||||
DCHECK_EQ(rd.SizeInBits(), rn.SizeInBits());
|
||||
diff --git a/src/codegen/arm64/assembler-arm64.h b/src/codegen/arm64/assembler-arm64.h
|
||||
index 04cd4222417f5ac88f3c5f3278c45f1d128c7c8c..fb5feb23074ac888e85a3676c1cbbb63126e72d5 100644
|
||||
--- a/src/codegen/arm64/assembler-arm64.h
|
||||
+++ b/src/codegen/arm64/assembler-arm64.h
|
||||
@@ -2148,11 +2148,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
|
||||
return rm.code() << Rm_offset;
|
||||
}
|
||||
|
||||
- static Instr RmNot31(CPURegister rm) {
|
||||
- DCHECK_NE(rm.code(), kSPRegInternalCode);
|
||||
- DCHECK(!rm.IsZero());
|
||||
- return Rm(rm);
|
||||
- }
|
||||
+ static Instr RmNot31(CPURegister rm);
|
||||
|
||||
static Instr Ra(CPURegister ra) {
|
||||
DCHECK_NE(ra.code(), kSPRegInternalCode);
|
||||
@@ -2176,15 +2172,8 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
|
||||
|
||||
// These encoding functions allow the stack pointer to be encoded, and
|
||||
// disallow the zero register.
|
||||
- static Instr RdSP(Register rd) {
|
||||
- DCHECK(!rd.IsZero());
|
||||
- return (rd.code() & kRegCodeMask) << Rd_offset;
|
||||
- }
|
||||
-
|
||||
- static Instr RnSP(Register rn) {
|
||||
- DCHECK(!rn.IsZero());
|
||||
- return (rn.code() & kRegCodeMask) << Rn_offset;
|
||||
- }
|
||||
+ static Instr RdSP(Register rd);
|
||||
+ static Instr RnSP(Register rn);
|
||||
|
||||
// Flags encoding.
|
||||
inline static Instr Flags(FlagsUpdate S);
|
Loading…
Add table
Add a link
Reference in a new issue