Skip to content

Commit

Permalink
fixme: IsNearDeath has been removed upstream
Browse files Browse the repository at this point in the history
Adds a patch that reverts https://chromium-review.googlesource.com/c/v8/v8/+/1526195
in order to let native modules build.  nan has a strong dependency on
the IsNearDeath method.  This needs to be solved upstream in nan or V8.
  • Loading branch information
MarshallOfSound committed Mar 22, 2019
1 parent 6fac68d commit 73d7119
Show file tree
Hide file tree
Showing 10 changed files with 306 additions and 44 deletions.
1 change: 1 addition & 0 deletions patches/common/v8/.patches
Expand Up @@ -6,3 +6,4 @@ build-torque-with-x64-toolchain-on-arm.patch
do_not_run_arm_arm64_mksnapshot_binaries.patch
deps_provide_more_v8_backwards_compatibility.patch
dcheck.patch
fixme_revert_heap_api_remove_deprecated_apis.patch
6 changes: 3 additions & 3 deletions patches/common/v8/add_realloc.patch
Expand Up @@ -12,10 +12,10 @@ 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 4e9af49e6b2e00111b44b03ce2a9a66c2d7d5563..e19bdc0ca5a247d82370d7081491bfc3870ca81e 100644
index 6dee8ca634900af699ac1a54e10fc2a1ec4a7319..fd4e4f95022cb8e7332f9371ab478b8063cf048c 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -4695,6 +4695,13 @@ class V8_EXPORT ArrayBuffer : public Object {
@@ -4694,6 +4694,13 @@ class V8_EXPORT ArrayBuffer : public Object {
*/
virtual void* AllocateUninitialized(size_t length) = 0;

Expand All @@ -30,7 +30,7 @@ index 4e9af49e6b2e00111b44b03ce2a9a66c2d7d5563..e19bdc0ca5a247d82370d7081491bfc3
* 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.cc b/src/api.cc
index 5a06fd039026bb6de9d0076ca6eab5d823229095..39bea066c11597649a06a14b8575de83e18f65fa 100644
index a5bb14f935a0a96380cbaf9839a5063dbd420a16..b6071ee70e1f5f8c308118fc21fbab387129d07f 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -516,6 +516,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) {
Expand Down
Expand Up @@ -6,10 +6,10 @@ Subject: build-torque-with-x64-toolchain-on-arm.patch
torque binary has to be run during the build.

diff --git a/BUILD.gn b/BUILD.gn
index 5b3e0831c2657f4fa07adaa1de5fda6d2360c2ec..344a7fb5c5e54295fc7fd4f61780bdcf40bd6bd4 100644
index c2ec29b916155f36d8d181d82090afd857f4d041..f9b068f3d93f20e1377edc380c669c1df85bbce5 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -178,7 +178,9 @@ declare_args() {
@@ -181,7 +181,9 @@ declare_args() {
# the snapshot toolchain is the target toolchain and, hence, can't be used.
v8_generator_toolchain = v8_snapshot_toolchain
if (host_cpu == "x64" &&
Expand All @@ -20,7 +20,7 @@ index 5b3e0831c2657f4fa07adaa1de5fda6d2360c2ec..344a7fb5c5e54295fc7fd4f61780bdcf
v8_generator_toolchain = "//build/toolchain/linux:clang_x64"
}

@@ -3539,7 +3541,7 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
@@ -3573,7 +3575,7 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
}
}

Expand Down
6 changes: 3 additions & 3 deletions patches/common/v8/build_gn.patch
Expand Up @@ -5,10 +5,10 @@ Subject: build_gn.patch


diff --git a/BUILD.gn b/BUILD.gn
index af4cf7667e274462878580ddba56f4168d89f237..65a82149f400d65ffd5c3be68bc4306e80b3cff7 100644
index b843e32765a93fe50ccc78427558daeb3447c2a8..1eefb5b89c8a91ee3a9eb9f4a5b22cc499d97539 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -240,7 +240,7 @@ config("internal_config") {
@@ -246,7 +246,7 @@ config("internal_config") {
":v8_header_features",
]

Expand All @@ -17,7 +17,7 @@ index af4cf7667e274462878580ddba56f4168d89f237..65a82149f400d65ffd5c3be68bc4306e
defines += [ "BUILDING_V8_SHARED" ]
}
}
@@ -3524,6 +3524,8 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
@@ -3558,6 +3558,8 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {

configs = [ ":internal_config" ]

Expand Down
8 changes: 4 additions & 4 deletions patches/common/v8/dcheck.patch
Expand Up @@ -5,10 +5,10 @@ Subject: dcheck.patch


diff --git a/src/api.cc b/src/api.cc
index b14e53bc93102157841316d1fdbdb524a1a89c73..63a0ed79fb8dbc78db0ff9578ef1bb5cfc1663f5 100644
index a6c14a5be90679ed4d17fa04bb9feb30a05d42f9..8532ad08999316427add386696326b43dc1994d8 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -8628,7 +8628,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
@@ -8617,7 +8617,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {


void Isolate::RunMicrotasks() {
Expand All @@ -18,10 +18,10 @@ index b14e53bc93102157841316d1fdbdb524a1a89c73..63a0ed79fb8dbc78db0ff9578ef1bb5c
isolate->default_microtask_queue()->RunMicrotasks(isolate);
}
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 0462e9ee245cbfec985ae1a2ffe4f6699531e3aa..3c312c97f152846980073ab4187ac47fa388b46f 100644
index 18e357712e10060c70875a1c2e69b754a521efe1..eec4b79ead7c9cc980c7eaf100f103acc81b96f7 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -4848,9 +4848,9 @@ void Heap::TearDown() {
@@ -4881,9 +4881,9 @@ void Heap::TearDown() {
void Heap::AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback,
GCType gc_type, void* data) {
DCHECK_NOT_NULL(callback);
Expand Down
Expand Up @@ -20,10 +20,10 @@ Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>

diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index c7dc7520ebc17f63dbba74225000c84f6d3d0152..07d965d39ad08c9f0aa9af199ac4f0124c233bcd 100644
index 75d8167ca3dc5728de8a0901996794da6acf6d19..c2c3db1dc683085d33a754c401bfec31b9ac08d7 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -1321,7 +1321,7 @@ DEFINE_BOOL(log_function_events, false,
@@ -1337,7 +1337,7 @@ DEFINE_BOOL(log_function_events, false,
DEFINE_BOOL(prof, false,
"Log statistical profiling information (implies --log-code).")

Expand Down
Expand Up @@ -22,10 +22,10 @@ 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 e19bdc0ca5a247d82370d7081491bfc3870ca81e..2a67b22279edff6915a56d2e5e37f3415dde77e8 100644
index fd4e4f95022cb8e7332f9371ab478b8063cf048c..6a91f2571d1c0c7e92bff288da90a9550e5568ba 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1144,6 +1144,10 @@ class V8_EXPORT PrimitiveArray {
@@ -1141,6 +1141,10 @@ class V8_EXPORT PrimitiveArray {
public:
static Local<PrimitiveArray> New(Isolate* isolate, int length);
int Length() const;
Expand All @@ -36,7 +36,7 @@ index e19bdc0ca5a247d82370d7081491bfc3870ca81e..2a67b22279edff6915a56d2e5e37f341
void Set(Isolate* isolate, int index, Local<Primitive> item);
Local<Primitive> Get(Isolate* isolate, int index);
};
@@ -1847,6 +1851,8 @@ class V8_EXPORT StackTrace {
@@ -1849,6 +1853,8 @@ class V8_EXPORT StackTrace {
/**
* Returns a StackFrame at a particular index.
*/
Expand All @@ -45,7 +45,7 @@ index e19bdc0ca5a247d82370d7081491bfc3870ca81e..2a67b22279edff6915a56d2e5e37f341
Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;

/**
@@ -2547,6 +2553,13 @@ class V8_EXPORT Value : public Data {
@@ -2549,6 +2555,13 @@ class V8_EXPORT Value : public Data {
V8_DEPRECATE_SOON("Use maybe version",
Local<Int32> ToInt32(Isolate* isolate) const);

Expand All @@ -59,7 +59,7 @@ index e19bdc0ca5a247d82370d7081491bfc3870ca81e..2a67b22279edff6915a56d2e5e37f341
/**
* Attempts to convert a string to an array index.
* Returns an empty handle if the conversion fails.
@@ -2566,7 +2579,14 @@ class V8_EXPORT Value : public Data {
@@ -2568,7 +2581,14 @@ class V8_EXPORT Value : public Data {
Local<Context> context) const;
V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;

Expand All @@ -74,7 +74,7 @@ index e19bdc0ca5a247d82370d7081491bfc3870ca81e..2a67b22279edff6915a56d2e5e37f341
V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context,
Local<Value> that) const;
bool StrictEquals(Local<Value> that) const;
@@ -2673,6 +2693,8 @@ class V8_EXPORT String : public Name {
@@ -2675,6 +2695,8 @@ class V8_EXPORT String : public Name {
* Returns the number of bytes in the UTF-8 encoded
* representation of this string.
*/
Expand All @@ -83,7 +83,7 @@ index e19bdc0ca5a247d82370d7081491bfc3870ca81e..2a67b22279edff6915a56d2e5e37f341
int Utf8Length(Isolate* isolate) const;

/**
@@ -2729,12 +2751,23 @@ class V8_EXPORT String : public Name {
@@ -2731,12 +2753,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;
Expand All @@ -107,7 +107,7 @@ index e19bdc0ca5a247d82370d7081491bfc3870ca81e..2a67b22279edff6915a56d2e5e37f341

/**
* A zero length string.
@@ -2922,6 +2955,9 @@ class V8_EXPORT String : public Name {
@@ -2924,6 +2957,9 @@ class V8_EXPORT String : public Name {
*/
static Local<String> Concat(Isolate* isolate, Local<String> left,
Local<String> right);
Expand All @@ -117,7 +117,7 @@ index e19bdc0ca5a247d82370d7081491bfc3870ca81e..2a67b22279edff6915a56d2e5e37f341

/**
* Creates a new external string using the data defined in the given
@@ -2990,6 +3026,8 @@ class V8_EXPORT String : public Name {
@@ -2992,6 +3028,8 @@ class V8_EXPORT String : public Name {
*/
class V8_EXPORT Utf8Value {
public:
Expand All @@ -126,15 +126,15 @@ index e19bdc0ca5a247d82370d7081491bfc3870ca81e..2a67b22279edff6915a56d2e5e37f341
Utf8Value(Isolate* isolate, Local<v8::Value> obj);
~Utf8Value();
char* operator*() { return str_; }
@@ -3013,6 +3051,7 @@ class V8_EXPORT String : public Name {
@@ -3015,6 +3053,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_; }
@@ -5384,6 +5423,8 @@ class V8_EXPORT BooleanObject : public Object {
@@ -5385,6 +5424,8 @@ class V8_EXPORT BooleanObject : public Object {
class V8_EXPORT StringObject : public Object {
public:
static Local<Value> New(Isolate* isolate, Local<String> value);
Expand All @@ -143,7 +143,7 @@ index e19bdc0ca5a247d82370d7081491bfc3870ca81e..2a67b22279edff6915a56d2e5e37f341

Local<String> ValueOf() const;

@@ -10454,6 +10495,30 @@ template <class T> Value* Value::Cast(T* value) {
@@ -10476,6 +10517,30 @@ template <class T> Value* Value::Cast(T* value) {
}


Expand Down Expand Up @@ -175,10 +175,10 @@ index e19bdc0ca5a247d82370d7081491bfc3870ca81e..2a67b22279edff6915a56d2e5e37f341
#ifdef V8_ENABLE_CHECKS
CheckCast(value);
diff --git a/src/api.cc b/src/api.cc
index 39bea066c11597649a06a14b8575de83e18f65fa..b14e53bc93102157841316d1fdbdb524a1a89c73 100644
index b6071ee70e1f5f8c308118fc21fbab387129d07f..a6c14a5be90679ed4d17fa04bb9feb30a05d42f9 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -2227,6 +2227,10 @@ int PrimitiveArray::Length() const {
@@ -2220,6 +2220,10 @@ int PrimitiveArray::Length() const {
return array->length();
}

Expand All @@ -189,7 +189,7 @@ index 39bea066c11597649a06a14b8575de83e18f65fa..b14e53bc93102157841316d1fdbdb524
void PrimitiveArray::Set(Isolate* v8_isolate, int index,
Local<Primitive> item) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
@@ -2240,6 +2244,10 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index,
@@ -2233,6 +2237,10 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index,
array->set(index, *i_item);
}

Expand All @@ -200,7 +200,7 @@ index 39bea066c11597649a06a14b8575de83e18f65fa..b14e53bc93102157841316d1fdbdb524
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);
@@ -2945,6 +2953,10 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) {
@@ -2938,6 +2946,10 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) {

// --- S t a c k T r a c e ---

Expand All @@ -211,7 +211,7 @@ index 39bea066c11597649a06a14b8575de83e18f65fa..b14e53bc93102157841316d1fdbdb524
Local<StackFrame> StackTrace::GetFrame(Isolate* v8_isolate,
uint32_t index) const {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
@@ -3909,6 +3921,36 @@ void v8::RegExp::CheckCast(v8::Value* that) {
@@ -3902,6 +3914,36 @@ void v8::RegExp::CheckCast(v8::Value* that) {
}


Expand Down Expand Up @@ -248,7 +248,7 @@ index 39bea066c11597649a06a14b8575de83e18f65fa..b14e53bc93102157841316d1fdbdb524
Maybe<bool> Value::BooleanValue(Local<Context> context) const {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
return Just(Utils::OpenHandle(this)->BooleanValue(isolate));
@@ -3997,6 +4039,12 @@ MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const {
@@ -3990,6 +4032,12 @@ MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const {
}


Expand All @@ -261,7 +261,7 @@ index 39bea066c11597649a06a14b8575de83e18f65fa..b14e53bc93102157841316d1fdbdb524
Maybe<bool> Value::Equals(Local<Context> context, Local<Value> that) const {
i::Isolate* isolate = Utils::OpenHandle(*context)->GetIsolate();
auto self = Utils::OpenHandle(this);
@@ -5275,6 +5323,10 @@ bool String::ContainsOnlyOneByte() const {
@@ -5268,6 +5316,10 @@ bool String::ContainsOnlyOneByte() const {
return helper.Check(*str);
}

Expand All @@ -272,7 +272,7 @@ index 39bea066c11597649a06a14b8575de83e18f65fa..b14e53bc93102157841316d1fdbdb524
int String::Utf8Length(Isolate* isolate) const {
i::Handle<i::String> str = Utils::OpenHandle(this);
str = i::String::Flatten(reinterpret_cast<i::Isolate*>(isolate), str);
@@ -5427,6 +5479,14 @@ static int WriteUtf8Impl(i::Vector<const Char> string, char* write_start,
@@ -5420,6 +5472,14 @@ static int WriteUtf8Impl(i::Vector<const Char> string, char* write_start,
}
} // anonymous namespace

Expand All @@ -287,7 +287,7 @@ index 39bea066c11597649a06a14b8575de83e18f65fa..b14e53bc93102157841316d1fdbdb524
int String::WriteUtf8(Isolate* v8_isolate, char* buffer, int capacity,
int* nchars_ref, int options) const {
i::Handle<i::String> str = Utils::OpenHandle(this);
@@ -5467,6 +5527,18 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string,
@@ -5460,6 +5520,18 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string,
}


Expand All @@ -306,7 +306,7 @@ index 39bea066c11597649a06a14b8575de83e18f65fa..b14e53bc93102157841316d1fdbdb524
int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start,
int length, int options) const {
return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer,
@@ -6423,6 +6495,11 @@ MaybeLocal<String> String::NewFromTwoByte(Isolate* isolate,
@@ -6414,6 +6486,11 @@ MaybeLocal<String> String::NewFromTwoByte(Isolate* isolate,
return result;
}

Expand All @@ -318,7 +318,7 @@ index 39bea066c11597649a06a14b8575de83e18f65fa..b14e53bc93102157841316d1fdbdb524
Local<String> v8::String::Concat(Isolate* v8_isolate, Local<String> left,
Local<String> right) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
@@ -6705,6 +6782,11 @@ bool v8::BooleanObject::ValueOf() const {
@@ -6696,6 +6773,11 @@ bool v8::BooleanObject::ValueOf() const {
}


Expand All @@ -330,7 +330,7 @@ index 39bea066c11597649a06a14b8575de83e18f65fa..b14e53bc93102157841316d1fdbdb524
Local<v8::Value> v8::StringObject::New(Isolate* v8_isolate,
Local<String> value) {
i::Handle<i::String> string = Utils::OpenHandle(*value);
@@ -8951,6 +9033,9 @@ bool MicrotasksScope::IsRunningMicrotasks(Isolate* v8_isolate) {
@@ -8976,6 +9058,9 @@ bool MicrotasksScope::IsRunningMicrotasks(Isolate* v8_isolate) {
return microtask_queue->IsRunningMicrotasks();
}

Expand All @@ -340,7 +340,7 @@ index 39bea066c11597649a06a14b8575de83e18f65fa..b14e53bc93102157841316d1fdbdb524
String::Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> obj)
: str_(nullptr), length_(0) {
if (obj.IsEmpty()) return;
@@ -8970,6 +9055,9 @@ String::Utf8Value::~Utf8Value() {
@@ -8995,6 +9080,9 @@ String::Utf8Value::~Utf8Value() {
i::DeleteArray(str_);
}

Expand Down
Expand Up @@ -10,10 +10,10 @@ Electron does, so this patch makes sure that the build doesn't try to run
the mksnapshot binary if it was built for arm or arm64.

diff --git a/BUILD.gn b/BUILD.gn
index 344a7fb5c5e54295fc7fd4f61780bdcf40bd6bd4..bdb82a0d813cb5abd612dc937135478911da25f3 100644
index f9b068f3d93f20e1377edc380c669c1df85bbce5..d5373386a49d97991b839cc310096c8ea8ac9188 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1316,9 +1316,19 @@ if (v8_use_snapshot && v8_use_external_startup_data) {
@@ -1347,9 +1347,19 @@ if (v8_use_snapshot && v8_use_external_startup_data) {
]
public_deps = [
":natives_blob",
Expand Down
4 changes: 2 additions & 2 deletions patches/common/v8/expose_mksnapshot.patch
Expand Up @@ -6,10 +6,10 @@ Subject: expose_mksnapshot.patch
Needed in order to build mksnapshot on arm.

diff --git a/BUILD.gn b/BUILD.gn
index 65a82149f400d65ffd5c3be68bc4306e80b3cff7..5b3e0831c2657f4fa07adaa1de5fda6d2360c2ec 100644
index 1eefb5b89c8a91ee3a9eb9f4a5b22cc499d97539..c2ec29b916155f36d8d181d82090afd857f4d041 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -3514,8 +3514,6 @@ if (current_toolchain == v8_generator_toolchain) {
@@ -3548,8 +3548,6 @@ if (current_toolchain == v8_generator_toolchain) {

if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
v8_executable("mksnapshot") {
Expand Down

0 comments on commit 73d7119

Please sign in to comment.