chore: remove v8 reverts now that nan is updated (#18130)
This commit is contained in:
parent
cb13d7a0a8
commit
99d4537075
8 changed files with 39 additions and 1605 deletions
|
@ -1,11 +1,8 @@
|
|||
add_realloc.patch
|
||||
build_gn.patch
|
||||
expose_mksnapshot.patch
|
||||
revert_api_remove_deprecated_conversion_functions.patch
|
||||
deps_provide_more_v8_backwards_compatibility.patch
|
||||
dcheck.patch
|
||||
revert_reland_api_heap_remove_deprecated_persistent_apis.patch
|
||||
fixme_revert_heap_api_remove_deprecated_apis.patch
|
||||
revert_cctest_add_v8_export_private_to_arm_arm64_ports.patch
|
||||
export_symbols_needed_for_windows_build.patch
|
||||
workaround_an_undefined_symbol_error.patch
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: dcheck.patch
|
|||
|
||||
|
||||
diff --git a/src/api.cc b/src/api.cc
|
||||
index a91a11b9dedf375b7d3950dfd6eab3f63b23e0ca..1102e5d9ca745ec57257379acef92a17d374362d 100644
|
||||
index 679f7db6724976ae960182e838133d672c17f312..bd7cfa48aa219263551b7a9e523ae82324cac492 100644
|
||||
--- a/src/api.cc
|
||||
+++ b/src/api.cc
|
||||
@@ -8633,7 +8633,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
|
||||
@@ -8592,7 +8592,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
|
||||
|
||||
|
||||
void Isolate::RunMicrotasks() {
|
||||
|
@ -18,10 +18,10 @@ index a91a11b9dedf375b7d3950dfd6eab3f63b23e0ca..1102e5d9ca745ec57257379acef92a17
|
|||
isolate->default_microtask_queue()->RunMicrotasks(isolate);
|
||||
}
|
||||
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
|
||||
index c1bbe6ee3e8fd8e93a49200e3369be98b340a889..0750431050b07ac38c8f9c341ea4ec13ad5a2586 100644
|
||||
index 4e1b1b8429b42f9d6b20faf60e45911656699021..c734ef5cb206a2d74c64f385ec45cb45fe38cef1 100644
|
||||
--- a/src/heap/heap.cc
|
||||
+++ b/src/heap/heap.cc
|
||||
@@ -4943,9 +4943,9 @@ void Heap::TearDown() {
|
||||
@@ -4944,9 +4944,9 @@ void Heap::TearDown() {
|
||||
void Heap::AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback,
|
||||
GCType gc_type, void* data) {
|
||||
DCHECK_NOT_NULL(callback);
|
||||
|
|
|
@ -22,7 +22,7 @@ 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 4a3b94897f01f7d770770abc26b030f54060d3de..26ac2cb01da36529e99dcd5cc878523601addc0d 100644
|
||||
index 0e21793b1214c681770b72f64b9f0d6188c6a385..b5af3e191886db921ae811ef5f5db4aab39d6533 100644
|
||||
--- a/include/v8.h
|
||||
+++ b/include/v8.h
|
||||
@@ -1109,6 +1109,10 @@ class V8_EXPORT PrimitiveArray {
|
||||
|
@ -45,9 +45,9 @@ index 4a3b94897f01f7d770770abc26b030f54060d3de..26ac2cb01da36529e99dcd5cc8785236
|
|||
Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;
|
||||
|
||||
/**
|
||||
@@ -2518,6 +2524,13 @@ class V8_EXPORT Value : public Data {
|
||||
V8_DEPRECATED("Use maybe version",
|
||||
Local<Int32> ToInt32(Isolate* isolate) const);
|
||||
@@ -2505,6 +2511,13 @@ class V8_EXPORT Value : public Data {
|
||||
|
||||
Local<Boolean> ToBoolean(Isolate* isolate) const;
|
||||
|
||||
+ inline V8_DEPRECATED("Use maybe version",
|
||||
+ Local<Boolean> ToBoolean() const);
|
||||
|
@ -59,7 +59,7 @@ index 4a3b94897f01f7d770770abc26b030f54060d3de..26ac2cb01da36529e99dcd5cc8785236
|
|||
/**
|
||||
* Attempts to convert a string to an array index.
|
||||
* Returns an empty handle if the conversion fails.
|
||||
@@ -2537,7 +2550,14 @@ class V8_EXPORT Value : public Data {
|
||||
@@ -2521,7 +2534,14 @@ class V8_EXPORT Value : public Data {
|
||||
Local<Context> context) const;
|
||||
V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
|
||||
|
||||
|
@ -74,7 +74,7 @@ index 4a3b94897f01f7d770770abc26b030f54060d3de..26ac2cb01da36529e99dcd5cc8785236
|
|||
V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context,
|
||||
Local<Value> that) const;
|
||||
bool StrictEquals(Local<Value> that) const;
|
||||
@@ -2644,6 +2664,8 @@ class V8_EXPORT String : public Name {
|
||||
@@ -2628,6 +2648,8 @@ class V8_EXPORT String : public Name {
|
||||
* Returns the number of bytes in the UTF-8 encoded
|
||||
* representation of this string.
|
||||
*/
|
||||
|
@ -83,7 +83,7 @@ index 4a3b94897f01f7d770770abc26b030f54060d3de..26ac2cb01da36529e99dcd5cc8785236
|
|||
int Utf8Length(Isolate* isolate) const;
|
||||
|
||||
/**
|
||||
@@ -2700,12 +2722,23 @@ class V8_EXPORT String : public Name {
|
||||
@@ -2684,12 +2706,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;
|
||||
|
@ -107,7 +107,7 @@ index 4a3b94897f01f7d770770abc26b030f54060d3de..26ac2cb01da36529e99dcd5cc8785236
|
|||
|
||||
/**
|
||||
* A zero length string.
|
||||
@@ -2893,6 +2926,9 @@ class V8_EXPORT String : public Name {
|
||||
@@ -2877,6 +2910,9 @@ class V8_EXPORT String : public Name {
|
||||
*/
|
||||
static Local<String> Concat(Isolate* isolate, Local<String> left,
|
||||
Local<String> right);
|
||||
|
@ -117,7 +117,7 @@ index 4a3b94897f01f7d770770abc26b030f54060d3de..26ac2cb01da36529e99dcd5cc8785236
|
|||
|
||||
/**
|
||||
* Creates a new external string using the data defined in the given
|
||||
@@ -2961,6 +2997,8 @@ class V8_EXPORT String : public Name {
|
||||
@@ -2945,6 +2981,8 @@ class V8_EXPORT String : public Name {
|
||||
*/
|
||||
class V8_EXPORT Utf8Value {
|
||||
public:
|
||||
|
@ -126,7 +126,7 @@ index 4a3b94897f01f7d770770abc26b030f54060d3de..26ac2cb01da36529e99dcd5cc8785236
|
|||
Utf8Value(Isolate* isolate, Local<v8::Value> obj);
|
||||
~Utf8Value();
|
||||
char* operator*() { return str_; }
|
||||
@@ -2984,6 +3022,7 @@ class V8_EXPORT String : public Name {
|
||||
@@ -2968,6 +3006,7 @@ class V8_EXPORT String : public Name {
|
||||
*/
|
||||
class V8_EXPORT Value {
|
||||
public:
|
||||
|
@ -134,7 +134,7 @@ index 4a3b94897f01f7d770770abc26b030f54060d3de..26ac2cb01da36529e99dcd5cc8785236
|
|||
Value(Isolate* isolate, Local<v8::Value> obj);
|
||||
~Value();
|
||||
uint16_t* operator*() { return str_; }
|
||||
@@ -5352,6 +5391,8 @@ class V8_EXPORT BooleanObject : public Object {
|
||||
@@ -5336,6 +5375,8 @@ class V8_EXPORT BooleanObject : public Object {
|
||||
class V8_EXPORT StringObject : public Object {
|
||||
public:
|
||||
static Local<Value> New(Isolate* isolate, Local<String> value);
|
||||
|
@ -143,13 +143,12 @@ index 4a3b94897f01f7d770770abc26b030f54060d3de..26ac2cb01da36529e99dcd5cc8785236
|
|||
|
||||
Local<String> ValueOf() const;
|
||||
|
||||
@@ -10457,6 +10498,30 @@ template <class T> Value* Value::Cast(T* value) {
|
||||
@@ -10441,6 +10482,29 @@ template <class T> Value* Value::Cast(T* value) {
|
||||
}
|
||||
|
||||
|
||||
+Local<Boolean> Value::ToBoolean() const {
|
||||
+ return ToBoolean(Isolate::GetCurrent()->GetCurrentContext())
|
||||
+ .FromMaybe(Local<Boolean>());
|
||||
+ return ToBoolean(Isolate::GetCurrent());
|
||||
+}
|
||||
+
|
||||
+
|
||||
|
@ -175,7 +174,7 @@ index 4a3b94897f01f7d770770abc26b030f54060d3de..26ac2cb01da36529e99dcd5cc8785236
|
|||
#ifdef V8_ENABLE_CHECKS
|
||||
CheckCast(value);
|
||||
diff --git a/src/api.cc b/src/api.cc
|
||||
index 9124d03fa6195269eaf851591bb95125c2081e2f..a91a11b9dedf375b7d3950dfd6eab3f63b23e0ca 100644
|
||||
index c2fc1fc9827f896c521606a75baecef6c60e8f8a..679f7db6724976ae960182e838133d672c17f312 100644
|
||||
--- a/src/api.cc
|
||||
+++ b/src/api.cc
|
||||
@@ -2227,6 +2227,10 @@ int PrimitiveArray::Length() const {
|
||||
|
@ -211,13 +210,12 @@ index 9124d03fa6195269eaf851591bb95125c2081e2f..a91a11b9dedf375b7d3950dfd6eab3f6
|
|||
Local<StackFrame> StackTrace::GetFrame(Isolate* v8_isolate,
|
||||
uint32_t index) const {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
||||
@@ -3908,6 +3920,34 @@ void v8::RegExp::CheckCast(v8::Value* that) {
|
||||
"Could not convert to regular expression");
|
||||
@@ -3570,6 +3582,34 @@ MaybeLocal<BigInt> Value::ToBigInt(Local<Context> context) const {
|
||||
RETURN_ESCAPED(result);
|
||||
}
|
||||
|
||||
+bool Value::BooleanValue() const {
|
||||
+ return BooleanValue(Isolate::GetCurrent()->GetCurrentContext())
|
||||
+ .FromJust();
|
||||
+ return BooleanValue(Isolate::GetCurrent());
|
||||
+}
|
||||
+
|
||||
+
|
||||
|
@ -243,10 +241,11 @@ index 9124d03fa6195269eaf851591bb95125c2081e2f..a91a11b9dedf375b7d3950dfd6eab3f6
|
|||
+ return Int32Value(Isolate::GetCurrent()->GetCurrentContext())
|
||||
+ .FromMaybe(0);
|
||||
+}
|
||||
|
||||
Maybe<bool> Value::BooleanValue(Local<Context> context) const {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
|
||||
@@ -3997,6 +4037,12 @@ MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const {
|
||||
+
|
||||
bool Value::BooleanValue(Isolate* v8_isolate) const {
|
||||
return Utils::OpenHandle(this)->BooleanValue(
|
||||
reinterpret_cast<i::Isolate*>(v8_isolate));
|
||||
@@ -3956,6 +3996,12 @@ MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const {
|
||||
}
|
||||
|
||||
|
||||
|
@ -259,7 +258,7 @@ index 9124d03fa6195269eaf851591bb95125c2081e2f..a91a11b9dedf375b7d3950dfd6eab3f6
|
|||
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 +5321,10 @@ bool String::ContainsOnlyOneByte() const {
|
||||
@@ -5234,6 +5280,10 @@ bool String::ContainsOnlyOneByte() const {
|
||||
return helper.Check(*str);
|
||||
}
|
||||
|
||||
|
@ -270,7 +269,7 @@ index 9124d03fa6195269eaf851591bb95125c2081e2f..a91a11b9dedf375b7d3950dfd6eab3f6
|
|||
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 +5477,14 @@ static int WriteUtf8Impl(i::Vector<const Char> string, char* write_start,
|
||||
@@ -5386,6 +5436,14 @@ static int WriteUtf8Impl(i::Vector<const Char> string, char* write_start,
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
|
@ -285,7 +284,7 @@ index 9124d03fa6195269eaf851591bb95125c2081e2f..a91a11b9dedf375b7d3950dfd6eab3f6
|
|||
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 +5525,18 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string,
|
||||
@@ -5426,6 +5484,18 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string,
|
||||
}
|
||||
|
||||
|
||||
|
@ -304,7 +303,7 @@ index 9124d03fa6195269eaf851591bb95125c2081e2f..a91a11b9dedf375b7d3950dfd6eab3f6
|
|||
int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start,
|
||||
int length, int options) const {
|
||||
return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer,
|
||||
@@ -6434,6 +6504,11 @@ MaybeLocal<String> String::NewFromTwoByte(Isolate* isolate,
|
||||
@@ -6393,6 +6463,11 @@ MaybeLocal<String> String::NewFromTwoByte(Isolate* isolate,
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -316,7 +315,7 @@ index 9124d03fa6195269eaf851591bb95125c2081e2f..a91a11b9dedf375b7d3950dfd6eab3f6
|
|||
Local<String> v8::String::Concat(Isolate* v8_isolate, Local<String> left,
|
||||
Local<String> right) {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
||||
@@ -6716,6 +6791,11 @@ bool v8::BooleanObject::ValueOf() const {
|
||||
@@ -6675,6 +6750,11 @@ bool v8::BooleanObject::ValueOf() const {
|
||||
}
|
||||
|
||||
|
||||
|
@ -328,7 +327,7 @@ index 9124d03fa6195269eaf851591bb95125c2081e2f..a91a11b9dedf375b7d3950dfd6eab3f6
|
|||
Local<v8::Value> v8::StringObject::New(Isolate* v8_isolate,
|
||||
Local<String> value) {
|
||||
i::Handle<i::String> string = Utils::OpenHandle(*value);
|
||||
@@ -8998,6 +9078,9 @@ bool MicrotasksScope::IsRunningMicrotasks(Isolate* v8_isolate) {
|
||||
@@ -8957,6 +9037,9 @@ bool MicrotasksScope::IsRunningMicrotasks(Isolate* v8_isolate) {
|
||||
return microtask_queue->IsRunningMicrotasks();
|
||||
}
|
||||
|
||||
|
@ -338,7 +337,7 @@ index 9124d03fa6195269eaf851591bb95125c2081e2f..a91a11b9dedf375b7d3950dfd6eab3f6
|
|||
String::Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> obj)
|
||||
: str_(nullptr), length_(0) {
|
||||
if (obj.IsEmpty()) return;
|
||||
@@ -9017,6 +9100,9 @@ String::Utf8Value::~Utf8Value() {
|
||||
@@ -8976,6 +9059,9 @@ String::Utf8Value::~Utf8Value() {
|
||||
i::DeleteArray(str_);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,261 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <sattard@slack-corp.com>
|
||||
Date: Thu, 21 Mar 2019 22:29:55 -0700
|
||||
Subject: fixme: Revert "[heap,api] Remove deprecated APIs"
|
||||
|
||||
This reverts commit f4b860d9b81956fb9d6815932522f4043fef56fa.
|
||||
|
||||
This commit removes deprecated APIs that nan relies on, temporarily
|
||||
reverting but we need to solve this with nan upstream
|
||||
|
||||
diff --git a/include/v8-internal.h b/include/v8-internal.h
|
||||
index 8e700a4d4d401bb58cdc6128e3e96dbf2d791d5c..94a6e3c1932a06ef1eee1be403b031f50d0d7baf 100644
|
||||
--- a/include/v8-internal.h
|
||||
+++ b/include/v8-internal.h
|
||||
@@ -165,6 +165,7 @@ class Internals {
|
||||
static const int kNodeStateMask = 0x7;
|
||||
static const int kNodeStateIsWeakValue = 2;
|
||||
static const int kNodeStateIsPendingValue = 3;
|
||||
+ static const int kNodeStateIsNearDeathValue = 4;
|
||||
static const int kNodeIsIndependentShift = 3;
|
||||
static const int kNodeIsActiveShift = 4;
|
||||
|
||||
diff --git a/include/v8.h b/include/v8.h
|
||||
index c5e22bb14043ade00b4ecf73b6115e747d5232ad..b96cbdee06a305776e062f5b8362e1b17106e1dd 100644
|
||||
--- a/include/v8.h
|
||||
+++ b/include/v8.h
|
||||
@@ -577,6 +577,10 @@ template <class T> class PersistentBase {
|
||||
|
||||
V8_DEPRECATED("See MarkIndependent.", V8_INLINE bool IsIndependent() const);
|
||||
|
||||
+ /** Checks if the handle holds the only reference to an object. */
|
||||
+ V8_DEPRECATED("Garbage collection internal state should not be relied on.",
|
||||
+ V8_INLINE bool IsNearDeath() const);
|
||||
+
|
||||
/** Returns true if the handle's reference is weak. */
|
||||
V8_INLINE bool IsWeak() const;
|
||||
|
||||
@@ -8596,6 +8600,17 @@ class V8_EXPORT Isolate {
|
||||
*/
|
||||
void VisitHandlesWithClassIds(PersistentHandleVisitor* visitor);
|
||||
|
||||
+ /**
|
||||
+ * Iterates through all the persistent handles in the current isolate's heap
|
||||
+ * that have class_ids and are candidates to be marked as partially dependent
|
||||
+ * handles. This will visit handles to young objects created since the last
|
||||
+ * garbage collection but is free to visit an arbitrary superset of these
|
||||
+ * objects.
|
||||
+ */
|
||||
+ V8_DEPRECATED(
|
||||
+ "Use VisitHandlesWithClassIds",
|
||||
+ void VisitHandlesForPartialDependence(PersistentHandleVisitor* visitor));
|
||||
+
|
||||
/**
|
||||
* Iterates through all the persistent handles in the current isolate's heap
|
||||
* that have class_ids and are weak to be marked as inactive if there is no
|
||||
@@ -9867,6 +9882,17 @@ bool PersistentBase<T>::IsIndependent() const {
|
||||
I::kNodeIsIndependentShift);
|
||||
}
|
||||
|
||||
+template <class T>
|
||||
+bool PersistentBase<T>::IsNearDeath() const {
|
||||
+ typedef internal::Internals I;
|
||||
+ if (this->IsEmpty()) return false;
|
||||
+ uint8_t node_state =
|
||||
+ I::GetNodeState(reinterpret_cast<internal::Address*>(this->val_));
|
||||
+ return node_state == I::kNodeStateIsNearDeathValue ||
|
||||
+ node_state == I::kNodeStateIsPendingValue;
|
||||
+}
|
||||
+
|
||||
+
|
||||
template <class T>
|
||||
bool PersistentBase<T>::IsWeak() const {
|
||||
typedef internal::Internals I;
|
||||
diff --git a/src/api.cc b/src/api.cc
|
||||
index 2a2311454ba37e557b1c1f046f46e7f5881516b9..10553d5bc638ceb81f4dd14d5231df3e9ae887dc 100644
|
||||
--- a/src/api.cc
|
||||
+++ b/src/api.cc
|
||||
@@ -8989,6 +8989,15 @@ void Isolate::VisitHandlesWithClassIds(PersistentHandleVisitor* visitor) {
|
||||
isolate->global_handles()->IterateAllRootsWithClassIds(visitor);
|
||||
}
|
||||
|
||||
+
|
||||
+void Isolate::VisitHandlesForPartialDependence(
|
||||
+ PersistentHandleVisitor* visitor) {
|
||||
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
||||
+ i::DisallowHeapAllocation no_allocation;
|
||||
+ isolate->global_handles()->IterateAllYoungRootsWithClassIds(visitor);
|
||||
+}
|
||||
+
|
||||
+
|
||||
void Isolate::VisitWeakHandles(PersistentHandleVisitor* visitor) {
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
|
||||
i::DisallowHeapAllocation no_allocation;
|
||||
diff --git a/src/global-handles.cc b/src/global-handles.cc
|
||||
index 350380b23ce6f4fe89e628285d2e69fb1cac88ee..5eb3d93f142ea4d6ec88a4468b6390ec5387da84 100644
|
||||
--- a/src/global-handles.cc
|
||||
+++ b/src/global-handles.cc
|
||||
@@ -379,6 +379,7 @@ class GlobalHandles::Node final : public NodeBase<GlobalHandles::Node> {
|
||||
Internals::kNodeStateMask);
|
||||
STATIC_ASSERT(WEAK == Internals::kNodeStateIsWeakValue);
|
||||
STATIC_ASSERT(PENDING == Internals::kNodeStateIsPendingValue);
|
||||
+ STATIC_ASSERT(NEAR_DEATH == Internals::kNodeStateIsNearDeathValue);
|
||||
STATIC_ASSERT(static_cast<int>(IsIndependent::kShift) ==
|
||||
Internals::kNodeIsIndependentShift);
|
||||
STATIC_ASSERT(static_cast<int>(IsActive::kShift) ==
|
||||
@@ -426,6 +427,11 @@ class GlobalHandles::Node final : public NodeBase<GlobalHandles::Node> {
|
||||
flags_ = NodeWeaknessType::update(flags_, weakness_type);
|
||||
}
|
||||
|
||||
+ bool IsNearDeath() const {
|
||||
+ // Check for PENDING to ensure correct answer when processing callbacks.
|
||||
+ return state() == PENDING || state() == NEAR_DEATH;
|
||||
+ }
|
||||
+
|
||||
bool IsWeak() const { return state() == WEAK; }
|
||||
|
||||
bool IsInUse() const { return state() != FREE; }
|
||||
@@ -813,6 +819,10 @@ void GlobalHandles::AnnotateStrongRetainer(Address* location,
|
||||
Node::FromLocation(location)->AnnotateStrongRetainer(label);
|
||||
}
|
||||
|
||||
+bool GlobalHandles::IsNearDeath(Address* location) {
|
||||
+ return Node::FromLocation(location)->IsNearDeath();
|
||||
+}
|
||||
+
|
||||
bool GlobalHandles::IsWeak(Address* location) {
|
||||
return Node::FromLocation(location)->IsWeak();
|
||||
}
|
||||
diff --git a/src/global-handles.h b/src/global-handles.h
|
||||
index 6b8ca0c93fa344ed0155106fef3a0aabf13bdf44..f5f51bb00761f37b7182e0be5e8783831bff3217 100644
|
||||
--- a/src/global-handles.h
|
||||
+++ b/src/global-handles.h
|
||||
@@ -73,6 +73,9 @@ class V8_EXPORT_PRIVATE GlobalHandles final {
|
||||
// Clear the weakness of a global handle.
|
||||
static void* ClearWeakness(Address* location);
|
||||
|
||||
+ // Tells whether global handle is near death.
|
||||
+ static bool IsNearDeath(Address* location);
|
||||
+
|
||||
// Tells whether global handle is weak.
|
||||
static bool IsWeak(Address* location);
|
||||
|
||||
diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc
|
||||
index 4c791d128e6126ea67c3240ee48ac689a55fd29a..03d702487091c40f575e8028f97849d5f6e6c92f 100644
|
||||
--- a/test/cctest/heap/test-heap.cc
|
||||
+++ b/test/cctest/heap/test-heap.cc
|
||||
@@ -528,9 +528,14 @@ TEST(WeakGlobalHandlesScavenge) {
|
||||
|
||||
// Scavenge treats weak pointers as normal roots.
|
||||
CcTest::CollectGarbage(NEW_SPACE);
|
||||
+
|
||||
CHECK((*h1)->IsString());
|
||||
CHECK((*h2)->IsHeapNumber());
|
||||
+
|
||||
CHECK(!WeakPointerCleared);
|
||||
+ CHECK(!global_handles->IsNearDeath(h2.location()));
|
||||
+ CHECK(!global_handles->IsNearDeath(h1.location()));
|
||||
+
|
||||
GlobalHandles::Destroy(h1.location());
|
||||
GlobalHandles::Destroy(h2.location());
|
||||
}
|
||||
@@ -568,8 +573,11 @@ TEST(WeakGlobalUnmodifiedApiHandlesScavenge) {
|
||||
&TestWeakGlobalHandleCallback, v8::WeakCallbackType::kParameter);
|
||||
|
||||
CcTest::CollectGarbage(NEW_SPACE);
|
||||
+
|
||||
CHECK((*h1)->IsHeapNumber());
|
||||
CHECK(WeakPointerCleared);
|
||||
+ CHECK(!global_handles->IsNearDeath(h1.location()));
|
||||
+
|
||||
GlobalHandles::Destroy(h1.location());
|
||||
}
|
||||
|
||||
@@ -606,7 +614,10 @@ TEST(WeakGlobalApiHandleModifiedMapScavenge) {
|
||||
&TestWeakGlobalHandleCallback, v8::WeakCallbackType::kParameter);
|
||||
|
||||
CcTest::CollectGarbage(NEW_SPACE);
|
||||
+
|
||||
CHECK(!WeakPointerCleared);
|
||||
+ CHECK(!global_handles->IsNearDeath(h1.location()));
|
||||
+
|
||||
GlobalHandles::Destroy(h1.location());
|
||||
}
|
||||
|
||||
@@ -647,7 +658,10 @@ TEST(WeakGlobalApiHandleWithElementsScavenge) {
|
||||
&TestWeakGlobalHandleCallback, v8::WeakCallbackType::kParameter);
|
||||
|
||||
CcTest::CollectGarbage(NEW_SPACE);
|
||||
+
|
||||
CHECK(!WeakPointerCleared);
|
||||
+ CHECK(!global_handles->IsNearDeath(h1.location()));
|
||||
+
|
||||
GlobalHandles::Destroy(h1.location());
|
||||
}
|
||||
|
||||
@@ -682,11 +696,17 @@ TEST(WeakGlobalHandlesMark) {
|
||||
GlobalHandles::MakeWeak(
|
||||
h2.location(), reinterpret_cast<void*>(&handle_and_id),
|
||||
&TestWeakGlobalHandleCallback, v8::WeakCallbackType::kParameter);
|
||||
+ CHECK(!GlobalHandles::IsNearDeath(h1.location()));
|
||||
+ CHECK(!GlobalHandles::IsNearDeath(h2.location()));
|
||||
|
||||
// Incremental marking potentially marked handles before they turned weak.
|
||||
CcTest::CollectAllGarbage();
|
||||
+
|
||||
CHECK((*h1)->IsString());
|
||||
+
|
||||
CHECK(WeakPointerCleared);
|
||||
+ CHECK(!GlobalHandles::IsNearDeath(h1.location()));
|
||||
+
|
||||
GlobalHandles::Destroy(h1.location());
|
||||
}
|
||||
|
||||
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
||||
index 2e097336572cbd82e6d9dba69c8388904f8ecaee..ebcdab3c27e8fb0b4ccfae9e0aab7bb8a4f10ce2 100644
|
||||
--- a/test/cctest/test-api.cc
|
||||
+++ b/test/cctest/test-api.cc
|
||||
@@ -20472,6 +20472,43 @@ TEST(WrapperClassId) {
|
||||
object.Reset();
|
||||
}
|
||||
|
||||
+
|
||||
+TEST(PersistentHandleInNewSpaceVisitor) {
|
||||
+ LocalContext context;
|
||||
+ v8::Isolate* isolate = context->GetIsolate();
|
||||
+ v8::HandleScope scope(isolate);
|
||||
+ v8::Persistent<v8::Object> object1(isolate, v8::Object::New(isolate));
|
||||
+ CHECK_EQ(0, object1.WrapperClassId());
|
||||
+ object1.SetWrapperClassId(42);
|
||||
+ CHECK_EQ(42, object1.WrapperClassId());
|
||||
+
|
||||
+ CcTest::CollectAllGarbage();
|
||||
+ CcTest::CollectAllGarbage();
|
||||
+
|
||||
+ v8::Persistent<v8::Object> object2(isolate, v8::Object::New(isolate));
|
||||
+ CHECK_EQ(0, object2.WrapperClassId());
|
||||
+ object2.SetWrapperClassId(42);
|
||||
+ CHECK_EQ(42, object2.WrapperClassId());
|
||||
+
|
||||
+ Visitor42 visitor(&object2);
|
||||
+#if __clang__
|
||||
+#pragma clang diagnostic push
|
||||
+#pragma clang diagnostic ignored "-Wdeprecated"
|
||||
+#endif
|
||||
+ // VisitHandlesForPartialDependence is marked deprecated. This test will be
|
||||
+ // removed with the API method.
|
||||
+ isolate->VisitHandlesForPartialDependence(&visitor);
|
||||
+#if __clang__
|
||||
+#pragma clang diagnostic pop
|
||||
+#endif
|
||||
+
|
||||
+ CHECK_EQ(1, visitor.counter_);
|
||||
+
|
||||
+ object1.Reset();
|
||||
+ object2.Reset();
|
||||
+}
|
||||
+
|
||||
+
|
||||
TEST(RegExp) {
|
||||
LocalContext context;
|
||||
v8::HandleScope scope(context->GetIsolate());
|
|
@ -1,142 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Apthorp <nornagon@nornagon.net>
|
||||
Date: Mon, 29 Apr 2019 14:16:31 -0700
|
||||
Subject: Revert "[api] Remove deprecated conversion functions"
|
||||
|
||||
This reverts commit c76f377a990343b18953123c2726337b38c59812.
|
||||
|
||||
diff --git a/include/v8.h b/include/v8.h
|
||||
index 0e21793b1214c681770b72f64b9f0d6188c6a385..4a3b94897f01f7d770770abc26b030f54060d3de 100644
|
||||
--- a/include/v8.h
|
||||
+++ b/include/v8.h
|
||||
@@ -2489,6 +2489,9 @@ class V8_EXPORT Value : public Data {
|
||||
|
||||
V8_WARN_UNUSED_RESULT MaybeLocal<BigInt> ToBigInt(
|
||||
Local<Context> context) const;
|
||||
+ V8_DEPRECATED("ToBoolean can never throw. Use Local version.",
|
||||
+ V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean(
|
||||
+ Local<Context> context) const);
|
||||
V8_WARN_UNUSED_RESULT MaybeLocal<Number> ToNumber(
|
||||
Local<Context> context) const;
|
||||
V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
|
||||
@@ -2504,6 +2507,16 @@ class V8_EXPORT Value : public Data {
|
||||
V8_WARN_UNUSED_RESULT MaybeLocal<Int32> ToInt32(Local<Context> context) const;
|
||||
|
||||
Local<Boolean> ToBoolean(Isolate* isolate) const;
|
||||
+ V8_DEPRECATED("Use maybe version",
|
||||
+ Local<Number> ToNumber(Isolate* isolate) const);
|
||||
+ V8_DEPRECATED("Use maybe version",
|
||||
+ Local<String> ToString(Isolate* isolate) const);
|
||||
+ V8_DEPRECATED("Use maybe version",
|
||||
+ Local<Object> ToObject(Isolate* isolate) const);
|
||||
+ V8_DEPRECATED("Use maybe version",
|
||||
+ Local<Integer> ToInteger(Isolate* isolate) const);
|
||||
+ V8_DEPRECATED("Use maybe version",
|
||||
+ Local<Int32> ToInt32(Isolate* isolate) const);
|
||||
|
||||
/**
|
||||
* Attempts to convert a string to an array index.
|
||||
@@ -2514,6 +2527,9 @@ class V8_EXPORT Value : public Data {
|
||||
|
||||
bool BooleanValue(Isolate* isolate) const;
|
||||
|
||||
+ V8_DEPRECATED("BooleanValue can never throw. Use Isolate version.",
|
||||
+ V8_WARN_UNUSED_RESULT Maybe<bool> BooleanValue(
|
||||
+ Local<Context> context) const);
|
||||
V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
|
||||
V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
|
||||
Local<Context> context) const;
|
||||
diff --git a/src/api.cc b/src/api.cc
|
||||
index c2fc1fc9827f896c521606a75baecef6c60e8f8a..9124d03fa6195269eaf851591bb95125c2081e2f 100644
|
||||
--- a/src/api.cc
|
||||
+++ b/src/api.cc
|
||||
@@ -3537,6 +3537,12 @@ MaybeLocal<String> Value::ToString(Local<Context> context) const {
|
||||
RETURN_ESCAPED(result);
|
||||
}
|
||||
|
||||
+
|
||||
+Local<String> Value::ToString(Isolate* isolate) const {
|
||||
+ RETURN_TO_LOCAL_UNCHECKED(ToString(isolate->GetCurrentContext()), String);
|
||||
+}
|
||||
+
|
||||
+
|
||||
MaybeLocal<String> Value::ToDetailString(Local<Context> context) const {
|
||||
i::Handle<i::Object> obj = Utils::OpenHandle(this);
|
||||
if (obj->IsString()) return ToApiHandle<String>(obj);
|
||||
@@ -3559,6 +3565,11 @@ MaybeLocal<Object> Value::ToObject(Local<Context> context) const {
|
||||
RETURN_ESCAPED(result);
|
||||
}
|
||||
|
||||
+
|
||||
+Local<v8::Object> Value::ToObject(Isolate* isolate) const {
|
||||
+ RETURN_TO_LOCAL_UNCHECKED(ToObject(isolate->GetCurrentContext()), Object);
|
||||
+}
|
||||
+
|
||||
MaybeLocal<BigInt> Value::ToBigInt(Local<Context> context) const {
|
||||
i::Handle<i::Object> obj = Utils::OpenHandle(this);
|
||||
if (obj->IsBigInt()) return ToApiHandle<BigInt>(obj);
|
||||
@@ -3575,6 +3586,11 @@ bool Value::BooleanValue(Isolate* v8_isolate) const {
|
||||
reinterpret_cast<i::Isolate*>(v8_isolate));
|
||||
}
|
||||
|
||||
+MaybeLocal<Boolean> Value::ToBoolean(Local<Context> context) const {
|
||||
+ return ToBoolean(context->GetIsolate());
|
||||
+}
|
||||
+
|
||||
+
|
||||
Local<Boolean> Value::ToBoolean(Isolate* v8_isolate) const {
|
||||
auto isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
||||
return ToApiHandle<Boolean>(
|
||||
@@ -3593,6 +3609,12 @@ MaybeLocal<Number> Value::ToNumber(Local<Context> context) const {
|
||||
RETURN_ESCAPED(result);
|
||||
}
|
||||
|
||||
+
|
||||
+Local<Number> Value::ToNumber(Isolate* isolate) const {
|
||||
+ RETURN_TO_LOCAL_UNCHECKED(ToNumber(isolate->GetCurrentContext()), Number);
|
||||
+}
|
||||
+
|
||||
+
|
||||
MaybeLocal<Integer> Value::ToInteger(Local<Context> context) const {
|
||||
auto obj = Utils::OpenHandle(this);
|
||||
if (obj->IsSmi()) return ToApiHandle<Integer>(obj);
|
||||
@@ -3604,6 +3626,12 @@ MaybeLocal<Integer> Value::ToInteger(Local<Context> context) const {
|
||||
RETURN_ESCAPED(result);
|
||||
}
|
||||
|
||||
+
|
||||
+Local<Integer> Value::ToInteger(Isolate* isolate) const {
|
||||
+ RETURN_TO_LOCAL_UNCHECKED(ToInteger(isolate->GetCurrentContext()), Integer);
|
||||
+}
|
||||
+
|
||||
+
|
||||
MaybeLocal<Int32> Value::ToInt32(Local<Context> context) const {
|
||||
auto obj = Utils::OpenHandle(this);
|
||||
if (obj->IsSmi()) return ToApiHandle<Int32>(obj);
|
||||
@@ -3615,6 +3643,12 @@ MaybeLocal<Int32> Value::ToInt32(Local<Context> context) const {
|
||||
RETURN_ESCAPED(result);
|
||||
}
|
||||
|
||||
+
|
||||
+Local<Int32> Value::ToInt32(Isolate* isolate) const {
|
||||
+ RETURN_TO_LOCAL_UNCHECKED(ToInt32(isolate->GetCurrentContext()), Int32);
|
||||
+}
|
||||
+
|
||||
+
|
||||
MaybeLocal<Uint32> Value::ToUint32(Local<Context> context) const {
|
||||
auto obj = Utils::OpenHandle(this);
|
||||
if (obj->IsSmi()) return ToApiHandle<Uint32>(obj);
|
||||
@@ -3874,6 +3908,13 @@ void v8::RegExp::CheckCast(v8::Value* that) {
|
||||
"Could not convert to regular expression");
|
||||
}
|
||||
|
||||
+
|
||||
+Maybe<bool> Value::BooleanValue(Local<Context> context) const {
|
||||
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
|
||||
+ return Just(Utils::OpenHandle(this)->BooleanValue(isolate));
|
||||
+}
|
||||
+
|
||||
+
|
||||
Maybe<double> Value::NumberValue(Local<Context> context) const {
|
||||
auto obj = Utils::OpenHandle(this);
|
||||
if (obj->IsNumber()) return Just(obj->Number());
|
|
@ -6,7 +6,7 @@ Subject: Revert "[cctest] Add V8_EXPORT_PRIVATE to arm/arm64 ports"
|
|||
This reverts commit 1a7d847cfac9a7363c59c980e47a7b7ff416e6da.
|
||||
|
||||
diff --git a/src/arm/assembler-arm.h b/src/arm/assembler-arm.h
|
||||
index c62c6041775206a7f222febf2950d6829e0299b7..4528b8efb1712683adc9403e4cf74bcab5fb1bbe 100644
|
||||
index 852b983ac4a40c33d23dba77e9c2b48f653d1b4f..b78a7651d1e5c54e32e08ecb6483e7ad9a734ee7 100644
|
||||
--- a/src/arm/assembler-arm.h
|
||||
+++ b/src/arm/assembler-arm.h
|
||||
@@ -79,7 +79,7 @@ enum Coprocessor {
|
||||
|
@ -59,7 +59,7 @@ index c62c6041775206a7f222febf2950d6829e0299b7..4528b8efb1712683adc9403e4cf74bca
|
|||
explicit UseScratchRegisterScope(Assembler* assembler);
|
||||
~UseScratchRegisterScope();
|
||||
diff --git a/src/arm64/assembler-arm64.h b/src/arm64/assembler-arm64.h
|
||||
index 7dd97809e3e3d4a43f6595bb0fb9a5b7b916d8be..586eff1241fed0a5f6a6fbc9b858981058a75feb 100644
|
||||
index 8db1a571b7d198c03a6cb6f1a8ab04597bea2776..8614975a1dbe54fe655f5e050742ccc76faa21da 100644
|
||||
--- a/src/arm64/assembler-arm64.h
|
||||
+++ b/src/arm64/assembler-arm64.h
|
||||
@@ -49,7 +49,7 @@ class Immediate {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -12,7 +12,7 @@ By moving some functions out of the the arm64-assembler header file,
|
|||
this error no longer seems to happen.
|
||||
|
||||
diff --git a/src/arm64/assembler-arm64.cc b/src/arm64/assembler-arm64.cc
|
||||
index 5fd50f3643e8999423a77062ef353cd4eeeff0fd..ea907a59f7ad0c73287698a0600ce11a3629dafd 100644
|
||||
index eaafa2375b2746fb7a9f63a1fc6703660b2b123c..fa83830f21b068ff79872e5d9eb6031bffd84028 100644
|
||||
--- a/src/arm64/assembler-arm64.cc
|
||||
+++ b/src/arm64/assembler-arm64.cc
|
||||
@@ -4013,6 +4013,22 @@ void Assembler::MoveWide(const Register& rd, uint64_t imm, int shift,
|
||||
|
@ -39,10 +39,10 @@ index 5fd50f3643e8999423a77062ef353cd4eeeff0fd..ea907a59f7ad0c73287698a0600ce11a
|
|||
const Operand& operand, FlagsUpdate S, AddSubOp op) {
|
||||
DCHECK_EQ(rd.SizeInBits(), rn.SizeInBits());
|
||||
diff --git a/src/arm64/assembler-arm64.h b/src/arm64/assembler-arm64.h
|
||||
index 586eff1241fed0a5f6a6fbc9b858981058a75feb..30b8586f69c51c4a6bad82faf4e02f823838f15b 100644
|
||||
index 8614975a1dbe54fe655f5e050742ccc76faa21da..1e0379b851a062c580cb5884176c3d4833ae5ea8 100644
|
||||
--- a/src/arm64/assembler-arm64.h
|
||||
+++ b/src/arm64/assembler-arm64.h
|
||||
@@ -2232,11 +2232,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
|
||||
@@ -2234,11 +2234,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
|
||||
return rm.code() << Rm_offset;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ index 586eff1241fed0a5f6a6fbc9b858981058a75feb..30b8586f69c51c4a6bad82faf4e02f82
|
|||
|
||||
static Instr Ra(CPURegister ra) {
|
||||
DCHECK_NE(ra.code(), kSPRegInternalCode);
|
||||
@@ -2260,15 +2256,8 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
|
||||
@@ -2262,15 +2258,8 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
|
||||
|
||||
// These encoding functions allow the stack pointer to be encoded, and
|
||||
// disallow the zero register.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue