From 457b7bf24f26a4b2005037c06ae90a58d6616edc Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Thu, 14 Nov 2019 05:50:25 +0000 Subject: [PATCH] chore: remove outdated v8 compat patch (#21115) This was only intended to last the duration of Node.js v11, and we are not on v12 so this should no longer be necessary --- patches/v8/.patches | 1 - ...vide_more_v8_backwards_compatibility.patch | 347 ------------------ 2 files changed, 348 deletions(-) delete mode 100644 patches/v8/deps_provide_more_v8_backwards_compatibility.patch diff --git a/patches/v8/.patches b/patches/v8/.patches index 386f0c15d295..2d2d86930a6d 100644 --- a/patches/v8/.patches +++ b/patches/v8/.patches @@ -1,7 +1,6 @@ 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 diff --git a/patches/v8/deps_provide_more_v8_backwards_compatibility.patch b/patches/v8/deps_provide_more_v8_backwards_compatibility.patch deleted file mode 100644 index 3a190426b18f..000000000000 --- a/patches/v8/deps_provide_more_v8_backwards_compatibility.patch +++ /dev/null @@ -1,347 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Anna Henningsen -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 -Reviewed-By: Joyee Cheung -Reviewed-By: Colin Ihrig -Reviewed-By: James M Snell -Reviewed-By: Sakthipriyan Vairamani -Reviewed-By: Yang Guo -Reviewed-By: Michaƫl Zasso - -diff --git a/include/v8.h b/include/v8.h -index fe86e1a17f2cad844ef92f45a8da6e7fee4eba49..3450677471b7276b631ea12a4cd39514c8105b46 100644 ---- a/include/v8.h -+++ b/include/v8.h -@@ -1330,6 +1330,10 @@ class V8_EXPORT PrimitiveArray { - public: - static Local New(Isolate* isolate, int length); - int Length() const; -+ V8_DEPRECATED("Use Isolate* version") -+ void Set(int index, Local item); -+ V8_DEPRECATED("Use Isolate* version") -+ Local Get(int index); - void Set(Isolate* isolate, int index, Local item); - Local Get(Isolate* isolate, int index); - }; -@@ -2078,6 +2082,8 @@ class V8_EXPORT StackTrace { - /** - * Returns a StackFrame at a particular index. - */ -+ V8_DEPRECATED("Use Isolate version") -+ Local GetFrame(uint32_t index) const; - Local GetFrame(Isolate* isolate, uint32_t index) const; - - /** -@@ -2774,6 +2780,15 @@ class V8_EXPORT Value : public Data { - - Local ToBoolean(Isolate* isolate) const; - -+ V8_DEPRECATED("Use maybe version") -+ inline Local ToBoolean() const; -+ V8_DEPRECATED("Use maybe version") -+ inline Local ToString() const; -+ V8_DEPRECATED("Use maybe version") -+ inline Local ToObject() const; -+ V8_DEPRECATED("Use maybe version") -+ inline Local ToInteger() const; -+ - /** - * Attempts to convert a string to an array index. - * Returns an empty handle if the conversion fails. -@@ -2790,7 +2805,14 @@ class V8_EXPORT Value : public Data { - Local context) const; - V8_WARN_UNUSED_RESULT Maybe Int32Value(Local 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 that) const; - V8_WARN_UNUSED_RESULT Maybe Equals(Local context, - Local that) const; - bool StrictEquals(Local that) const; -@@ -2897,6 +2919,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; - - /** -@@ -2953,12 +2977,22 @@ 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. -@@ -3126,6 +3160,8 @@ class V8_EXPORT String : public Name { - */ - static Local Concat(Isolate* isolate, Local left, - Local right); -+ V8_DEPRECATED("Use Isolate* version") -+ static Local Concat(Local left, Local right); - - /** - * Creates a new external string using the data defined in the given -@@ -3190,6 +3226,8 @@ class V8_EXPORT String : public Name { - */ - class V8_EXPORT Utf8Value { - public: -+ V8_DEPRECATED("Use Isolate version") -+ explicit Utf8Value(Local obj); - Utf8Value(Isolate* isolate, Local obj); - ~Utf8Value(); - char* operator*() { return str_; } -@@ -3213,6 +3251,8 @@ class V8_EXPORT String : public Name { - */ - class V8_EXPORT Value { - public: -+ V8_DEPRECATED("Use Isolate version") -+ explicit Value(Local obj); - Value(Isolate* isolate, Local obj); - ~Value(); - uint16_t* operator*() { return str_; } -@@ -5689,6 +5729,8 @@ class V8_EXPORT BooleanObject : public Object { - class V8_EXPORT StringObject : public Object { - public: - static Local New(Isolate* isolate, Local value); -+ V8_DEPRECATED("Use Isolate* version") -+ static Local New(Local value); - - Local ValueOf() const; - -@@ -11131,6 +11173,29 @@ template Value* Value::Cast(T* value) { - } - - -+Local Value::ToBoolean() const { -+ return ToBoolean(Isolate::GetCurrent()); -+} -+ -+ -+Local Value::ToString() const { -+ return ToString(Isolate::GetCurrent()->GetCurrentContext()) -+ .FromMaybe(Local()); -+} -+ -+ -+Local Value::ToObject() const { -+ return ToObject(Isolate::GetCurrent()->GetCurrentContext()) -+ .FromMaybe(Local()); -+} -+ -+ -+Local Value::ToInteger() const { -+ return ToInteger(Isolate::GetCurrent()->GetCurrentContext()) -+ .FromMaybe(Local()); -+} -+ -+ - 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 f6f2ba988d95660637f6733dafdd12db7acaa992..d753abd5d2d7e788b7dd96a200d5be0d85f87fe3 100644 ---- a/src/api/api.cc -+++ b/src/api/api.cc -@@ -2199,6 +2199,10 @@ int PrimitiveArray::Length() const { - return array->length(); - } - -+void PrimitiveArray::Set(int index, Local item) { -+ return Set(Isolate::GetCurrent(), index, item); -+} -+ - void PrimitiveArray::Set(Isolate* v8_isolate, int index, - Local item) { - i::Isolate* isolate = reinterpret_cast(v8_isolate); -@@ -2212,6 +2216,10 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index, - array->set(index, *i_item); - } - -+Local PrimitiveArray::Get(int index) { -+ return Get(Isolate::GetCurrent(), index); -+} -+ - Local PrimitiveArray::Get(Isolate* v8_isolate, int index) { - i::Isolate* isolate = reinterpret_cast(v8_isolate); - i::Handle array = Utils::OpenHandle(this); -@@ -2975,6 +2983,10 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) { - - // --- S t a c k T r a c e --- - -+Local StackTrace::GetFrame(uint32_t index) const { -+ return GetFrame(Isolate::GetCurrent(), index); -+} -+ - Local StackTrace::GetFrame(Isolate* v8_isolate, - uint32_t index) const { - i::Isolate* isolate = reinterpret_cast(v8_isolate); -@@ -3562,6 +3574,34 @@ MaybeLocal Value::ToBigInt(Local 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::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(v8_isolate)); -@@ -3951,6 +3991,11 @@ MaybeLocal Value::ToArrayIndex(Local context) const { - return Local(); - } - -+bool Value::Equals(Local that) const { -+ return Equals(Isolate::GetCurrent()->GetCurrentContext(), that) -+ .FromMaybe(false); -+} -+ - Maybe Value::Equals(Local context, Local that) const { - i::Isolate* isolate = Utils::OpenHandle(*context)->GetIsolate(); - auto self = Utils::OpenHandle(this); -@@ -5168,6 +5213,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 str = Utils::OpenHandle(this); - str = i::String::Flatten(reinterpret_cast(isolate), str); -@@ -5320,6 +5369,14 @@ static int WriteUtf8Impl(i::Vector 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 str = Utils::OpenHandle(this); -@@ -5358,6 +5415,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(isolate), this, buffer, -@@ -6269,6 +6337,11 @@ MaybeLocal String::NewFromTwoByte(Isolate* isolate, - return result; - } - -+Local v8::String::Concat(Local left, -+ Local right) { -+ return Concat(Isolate::GetCurrent(), left, right); -+} -+ - Local v8::String::Concat(Isolate* v8_isolate, Local left, - Local right) { - i::Isolate* isolate = reinterpret_cast(v8_isolate); -@@ -6539,6 +6612,10 @@ bool v8::BooleanObject::ValueOf() const { - return js_primitive_wrapper->value().IsTrue(isolate); - } - -+Local v8::StringObject::New(Local value) { -+ return New(Isolate::GetCurrent(), value); -+} -+ - Local v8::StringObject::New(Isolate* v8_isolate, - Local value) { - i::Handle string = Utils::OpenHandle(*value); -@@ -9078,6 +9155,9 @@ bool MicrotasksScope::IsRunningMicrotasks(Isolate* v8_isolate) { - return microtask_queue->IsRunningMicrotasks(); - } - -+String::Utf8Value::Utf8Value(v8::Local obj) -+ : Utf8Value(Isolate::GetCurrent(), obj) {} -+ - String::Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local obj) - : str_(nullptr), length_(0) { - if (obj.IsEmpty()) return; -@@ -9095,6 +9175,9 @@ String::Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local obj) - - String::Utf8Value::~Utf8Value() { i::DeleteArray(str_); } - -+String::Value::Value(v8::Local obj) -+ : Value(Isolate::GetCurrent(), obj) {} -+ - String::Value::Value(v8::Isolate* isolate, v8::Local obj) - : str_(nullptr), length_(0) { - if (obj.IsEmpty()) return;