Skip to content

Commit ef85f08

Browse files
addaleaxjasnell
authored andcommitted
deps: revert 9136dd8088a9 from upstream V8
Reverting this enables us to provide slower, but longer-lasting replacements for the deprecated APIs. Original commit message: Put back deleted V8_DEPRECATE_SOON methods This partially reverts https://chromium-review.googlesource.com/c/v8/v8/+/1177861, which deleted many V8_DEPRECATE_SOON methods rather than moving them to V8_DEPRECATED first. This puts them back and marks them V8_DEPRECATED. Note V8_DEPRECATED that were deleted in the same CL stay deleted. NOTRY=true NOPRESUBMIT=true NOTREECHECKS=true Bug: v8:7786, v8:8240 Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng Change-Id: I00330036d957f98dab403465b25e30d8382aac22 Reviewed-on: https://chromium-review.googlesource.com/1251422 Commit-Queue: Dan Elphick <delphick@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Michael Hablich <hablich@chromium.org> Cr-Commit-Position: refs/branch-heads/7.0@{#49} Cr-Branched-From: 6e2adae6f7f8e891cfd01f3280482b20590427a6-refs/heads/7.0.276@{#1} Cr-Branched-From: bc08a8624cbbea7a2d30071472bc73ad9544eadf-refs/heads/master@{#55424} Refs: v8/v8@9136dd8 Refs: #23122 PR-URL: #23158 Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent d25646b commit ef85f08

File tree

2 files changed

+0
-175
lines changed

2 files changed

+0
-175
lines changed

deps/v8/include/v8.h

-55
Original file line numberDiff line numberDiff line change
@@ -1125,10 +1125,6 @@ class V8_EXPORT PrimitiveArray {
11251125
int Length() const;
11261126
void Set(Isolate* isolate, int index, Local<Primitive> item);
11271127
Local<Primitive> Get(Isolate* isolate, int index);
1128-
1129-
V8_DEPRECATED("Use Isolate version",
1130-
void Set(int index, Local<Primitive> item));
1131-
V8_DEPRECATED("Use Isolate version", Local<Primitive> Get(int index));
11321128
};
11331129

11341130
/**
@@ -1833,8 +1829,6 @@ class V8_EXPORT StackTrace {
18331829
/**
18341830
* Returns a StackFrame at a particular index.
18351831
*/
1836-
V8_DEPRECATED("Use Isolate version",
1837-
Local<StackFrame> GetFrame(uint32_t index) const);
18381832
Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;
18391833

18401834
/**
@@ -2543,11 +2537,6 @@ class V8_EXPORT Value : public Data {
25432537
V8_DEPRECATE_SOON("Use maybe version",
25442538
Local<Int32> ToInt32(Isolate* isolate) const);
25452539

2546-
inline V8_DEPRECATED("Use maybe version", Local<Boolean> ToBoolean() const);
2547-
inline V8_DEPRECATED("Use maybe version", Local<String> ToString() const);
2548-
inline V8_DEPRECATED("Use maybe version", Local<Object> ToObject() const);
2549-
inline V8_DEPRECATED("Use maybe version", Local<Integer> ToInteger() const);
2550-
25512540
/**
25522541
* Attempts to convert a string to an array index.
25532542
* Returns an empty handle if the conversion fails.
@@ -2563,14 +2552,7 @@ class V8_EXPORT Value : public Data {
25632552
Local<Context> context) const;
25642553
V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
25652554

2566-
V8_DEPRECATED("Use maybe version", bool BooleanValue() const);
2567-
V8_DEPRECATED("Use maybe version", double NumberValue() const);
2568-
V8_DEPRECATED("Use maybe version", int64_t IntegerValue() const);
2569-
V8_DEPRECATED("Use maybe version", uint32_t Uint32Value() const);
2570-
V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
2571-
25722555
/** JS == */
2573-
V8_DEPRECATED("Use maybe version", bool Equals(Local<Value> that) const);
25742556
V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context,
25752557
Local<Value> that) const;
25762558
bool StrictEquals(Local<Value> that) const;
@@ -2677,8 +2659,6 @@ class V8_EXPORT String : public Name {
26772659
* Returns the number of bytes in the UTF-8 encoded
26782660
* representation of this string.
26792661
*/
2680-
V8_DEPRECATED("Use Isolate version instead", int Utf8Length() const);
2681-
26822662
int Utf8Length(Isolate* isolate) const;
26832663

26842664
/**
@@ -2735,23 +2715,12 @@ class V8_EXPORT String : public Name {
27352715
// 16-bit character codes.
27362716
int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1,
27372717
int options = NO_OPTIONS) const;
2738-
V8_DEPRECATED("Use Isolate* version",
2739-
int Write(uint16_t* buffer, int start = 0, int length = -1,
2740-
int options = NO_OPTIONS) const);
27412718
// One byte characters.
27422719
int WriteOneByte(Isolate* isolate, uint8_t* buffer, int start = 0,
27432720
int length = -1, int options = NO_OPTIONS) const;
2744-
V8_DEPRECATED("Use Isolate* version",
2745-
int WriteOneByte(uint8_t* buffer, int start = 0,
2746-
int length = -1, int options = NO_OPTIONS)
2747-
const);
27482721
// UTF-8 encoded characters.
27492722
int WriteUtf8(Isolate* isolate, char* buffer, int length = -1,
27502723
int* nchars_ref = NULL, int options = NO_OPTIONS) const;
2751-
V8_DEPRECATED("Use Isolate* version",
2752-
int WriteUtf8(char* buffer, int length = -1,
2753-
int* nchars_ref = NULL, int options = NO_OPTIONS)
2754-
const);
27552724

27562725
/**
27572726
* A zero length string.
@@ -2915,9 +2884,6 @@ class V8_EXPORT String : public Name {
29152884
*/
29162885
static Local<String> Concat(Isolate* isolate, Local<String> left,
29172886
Local<String> right);
2918-
static V8_DEPRECATED("Use Isolate* version",
2919-
Local<String> Concat(Local<String> left,
2920-
Local<String> right));
29212887

29222888
/**
29232889
* Creates a new external string using the data defined in the given
@@ -5251,8 +5217,6 @@ class V8_EXPORT BooleanObject : public Object {
52515217
class V8_EXPORT StringObject : public Object {
52525218
public:
52535219
static Local<Value> New(Isolate* isolate, Local<String> value);
5254-
static V8_DEPRECATED("Use Isolate* version",
5255-
Local<Value> New(Local<String> value));
52565220

52575221
Local<String> ValueOf() const;
52585222

@@ -10251,25 +10215,6 @@ template <class T> Value* Value::Cast(T* value) {
1025110215
return static_cast<Value*>(value);
1025210216
}
1025310217

10254-
Local<Boolean> Value::ToBoolean() const {
10255-
return ToBoolean(Isolate::GetCurrent()->GetCurrentContext())
10256-
.FromMaybe(Local<Boolean>());
10257-
}
10258-
10259-
Local<String> Value::ToString() const {
10260-
return ToString(Isolate::GetCurrent()->GetCurrentContext())
10261-
.FromMaybe(Local<String>());
10262-
}
10263-
10264-
Local<Object> Value::ToObject() const {
10265-
return ToObject(Isolate::GetCurrent()->GetCurrentContext())
10266-
.FromMaybe(Local<Object>());
10267-
}
10268-
10269-
Local<Integer> Value::ToInteger() const {
10270-
return ToInteger(Isolate::GetCurrent()->GetCurrentContext())
10271-
.FromMaybe(Local<Integer>());
10272-
}
1027310218

1027410219
Boolean* Boolean::Cast(v8::Value* value) {
1027510220
#ifdef V8_ENABLE_CHECKS

deps/v8/src/api.cc

-120
Original file line numberDiff line numberDiff line change
@@ -219,28 +219,6 @@ Local<Context> ContextFromNeverReadOnlySpaceObject(
219219
return reinterpret_cast<v8::Isolate*>(obj->GetIsolate())->GetCurrentContext();
220220
}
221221

222-
// TODO(delphick): Remove this completely when the deprecated functions that use
223-
// it are removed.
224-
// DO NOT USE THIS IN NEW CODE!
225-
i::Isolate* UnsafeIsolateFromHeapObject(i::Handle<i::HeapObject> obj) {
226-
// Use MemoryChunk directly instead of Isolate::FromWritableHeapObject to
227-
// temporarily allow isolate access from read-only space objects.
228-
i::MemoryChunk* chunk = i::MemoryChunk::FromHeapObject(*obj);
229-
return chunk->heap()->isolate();
230-
}
231-
232-
// TODO(delphick): Remove this completely when the deprecated functions that use
233-
// it are removed.
234-
// DO NOT USE THIS IN NEW CODE!
235-
Local<Context> UnsafeContextFromHeapObject(i::Handle<i::Object> obj) {
236-
// Use MemoryChunk directly instead of Isolate::FromWritableHeapObject to
237-
// temporarily allow isolate access from read-only space objects.
238-
i::MemoryChunk* chunk =
239-
i::MemoryChunk::FromHeapObject(i::HeapObject::cast(*obj));
240-
return reinterpret_cast<Isolate*>(chunk->heap()->isolate())
241-
->GetCurrentContext();
242-
}
243-
244222
class InternalEscapableScope : public v8::EscapableHandleScope {
245223
public:
246224
explicit inline InternalEscapableScope(i::Isolate* isolate)
@@ -2192,12 +2170,6 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index,
21922170
array->set(index, *i_item);
21932171
}
21942172

2195-
void PrimitiveArray::Set(int index, Local<Primitive> item) {
2196-
i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
2197-
i::Isolate* isolate = UnsafeIsolateFromHeapObject(array);
2198-
Set(reinterpret_cast<Isolate*>(isolate), index, item);
2199-
}
2200-
22012173
Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) {
22022174
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
22032175
i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
@@ -2210,12 +2182,6 @@ Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) {
22102182
return ToApiHandle<Primitive>(i_item);
22112183
}
22122184

2213-
Local<Primitive> PrimitiveArray::Get(int index) {
2214-
i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
2215-
i::Isolate* isolate = UnsafeIsolateFromHeapObject(array);
2216-
return Get(reinterpret_cast<Isolate*>(isolate), index);
2217-
}
2218-
22192185
Module::Status Module::GetStatus() const {
22202186
i::Handle<i::Module> self = Utils::OpenHandle(this);
22212187
switch (self->status()) {
@@ -2944,11 +2910,6 @@ Local<StackFrame> StackTrace::GetFrame(Isolate* v8_isolate,
29442910
return scope.Escape(Utils::StackFrameToLocal(info));
29452911
}
29462912

2947-
Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
2948-
i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this));
2949-
return GetFrame(reinterpret_cast<Isolate*>(isolate), index);
2950-
}
2951-
29522913
int StackTrace::GetFrameCount() const {
29532914
return Utils::OpenHandle(this)->length();
29542915
}
@@ -3920,14 +3881,6 @@ Maybe<bool> Value::BooleanValue(Local<Context> context) const {
39203881
return Just(Utils::OpenHandle(this)->BooleanValue(isolate));
39213882
}
39223883

3923-
bool Value::BooleanValue() const {
3924-
auto obj = Utils::OpenHandle(this);
3925-
if (obj->IsSmi()) return *obj != i::Smi::kZero;
3926-
DCHECK(obj->IsHeapObject());
3927-
i::Isolate* isolate =
3928-
UnsafeIsolateFromHeapObject(i::Handle<i::HeapObject>::cast(obj));
3929-
return obj->BooleanValue(isolate);
3930-
}
39313884

39323885
Maybe<double> Value::NumberValue(Local<Context> context) const {
39333886
auto obj = Utils::OpenHandle(this);
@@ -3941,12 +3894,6 @@ Maybe<double> Value::NumberValue(Local<Context> context) const {
39413894
return Just(num->Number());
39423895
}
39433896

3944-
double Value::NumberValue() const {
3945-
auto obj = Utils::OpenHandle(this);
3946-
if (obj->IsNumber()) return obj->Number();
3947-
return NumberValue(UnsafeContextFromHeapObject(obj))
3948-
.FromMaybe(std::numeric_limits<double>::quiet_NaN());
3949-
}
39503897

39513898
Maybe<int64_t> Value::IntegerValue(Local<Context> context) const {
39523899
auto obj = Utils::OpenHandle(this);
@@ -3962,17 +3909,6 @@ Maybe<int64_t> Value::IntegerValue(Local<Context> context) const {
39623909
return Just(NumberToInt64(*num));
39633910
}
39643911

3965-
int64_t Value::IntegerValue() const {
3966-
auto obj = Utils::OpenHandle(this);
3967-
if (obj->IsNumber()) {
3968-
if (obj->IsSmi()) {
3969-
return i::Smi::ToInt(*obj);
3970-
} else {
3971-
return static_cast<int64_t>(obj->Number());
3972-
}
3973-
}
3974-
return IntegerValue(UnsafeContextFromHeapObject(obj)).FromMaybe(0);
3975-
}
39763912

39773913
Maybe<int32_t> Value::Int32Value(Local<Context> context) const {
39783914
auto obj = Utils::OpenHandle(this);
@@ -3987,11 +3923,6 @@ Maybe<int32_t> Value::Int32Value(Local<Context> context) const {
39873923
: static_cast<int32_t>(num->Number()));
39883924
}
39893925

3990-
int32_t Value::Int32Value() const {
3991-
auto obj = Utils::OpenHandle(this);
3992-
if (obj->IsNumber()) return NumberToInt32(*obj);
3993-
return Int32Value(UnsafeContextFromHeapObject(obj)).FromMaybe(0);
3994-
}
39953926

39963927
Maybe<uint32_t> Value::Uint32Value(Local<Context> context) const {
39973928
auto obj = Utils::OpenHandle(this);
@@ -4006,11 +3937,6 @@ Maybe<uint32_t> Value::Uint32Value(Local<Context> context) const {
40063937
: static_cast<uint32_t>(num->Number()));
40073938
}
40083939

4009-
uint32_t Value::Uint32Value() const {
4010-
auto obj = Utils::OpenHandle(this);
4011-
if (obj->IsNumber()) return NumberToUint32(*obj);
4012-
return Uint32Value(UnsafeContextFromHeapObject(obj)).FromMaybe(0);
4013-
}
40143940

40153941
MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const {
40163942
auto self = Utils::OpenHandle(this);
@@ -4045,19 +3971,6 @@ Maybe<bool> Value::Equals(Local<Context> context, Local<Value> that) const {
40453971
return i::Object::Equals(isolate, self, other);
40463972
}
40473973

4048-
bool Value::Equals(Local<Value> that) const {
4049-
auto self = Utils::OpenHandle(this);
4050-
auto other = Utils::OpenHandle(*that);
4051-
if (self->IsSmi() && other->IsSmi()) {
4052-
return self->Number() == other->Number();
4053-
}
4054-
if (self->IsJSObject() && other->IsJSObject()) {
4055-
return *self == *other;
4056-
}
4057-
auto heap_object = self->IsSmi() ? other : self;
4058-
auto context = UnsafeContextFromHeapObject(heap_object);
4059-
return Equals(context, that).FromMaybe(false);
4060-
}
40613974

40623975
bool Value::StrictEquals(Local<Value> that) const {
40633976
auto self = Utils::OpenHandle(this);
@@ -5382,11 +5295,6 @@ bool String::ContainsOnlyOneByte() const {
53825295
return helper.Check(*str);
53835296
}
53845297

5385-
int String::Utf8Length() const {
5386-
i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this));
5387-
return Utf8Length(reinterpret_cast<Isolate*>(isolate));
5388-
}
5389-
53905298
int String::Utf8Length(Isolate* isolate) const {
53915299
i::Handle<i::String> str = Utils::OpenHandle(this);
53925300
str = i::String::Flatten(reinterpret_cast<i::Isolate*>(isolate), str);
@@ -5655,14 +5563,6 @@ int String::WriteUtf8(Isolate* v8_isolate, char* buffer, int capacity,
56555563
return writer.CompleteWrite(write_null, nchars_ref);
56565564
}
56575565

5658-
int String::WriteUtf8(char* buffer, int capacity, int* nchars_ref,
5659-
int options) const {
5660-
i::Handle<i::String> str = Utils::OpenHandle(this);
5661-
i::Isolate* isolate = UnsafeIsolateFromHeapObject(str);
5662-
return WriteUtf8(reinterpret_cast<Isolate*>(isolate), buffer, capacity,
5663-
nchars_ref, options);
5664-
}
5665-
56665566
template <typename CharType>
56675567
static inline int WriteHelper(i::Isolate* isolate, const String* string,
56685568
CharType* buffer, int start, int length,
@@ -5684,22 +5584,13 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string,
56845584
return end - start;
56855585
}
56865586

5687-
int String::WriteOneByte(uint8_t* buffer, int start, int length,
5688-
int options) const {
5689-
i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this));
5690-
return WriteHelper(isolate, this, buffer, start, length, options);
5691-
}
56925587

56935588
int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start,
56945589
int length, int options) const {
56955590
return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer,
56965591
start, length, options);
56975592
}
56985593

5699-
int String::Write(uint16_t* buffer, int start, int length, int options) const {
5700-
i::Isolate* isolate = UnsafeIsolateFromHeapObject(Utils::OpenHandle(this));
5701-
return WriteHelper(isolate, this, buffer, start, length, options);
5702-
}
57035594

57045595
int String::Write(Isolate* isolate, uint16_t* buffer, int start, int length,
57055596
int options) const {
@@ -6658,12 +6549,6 @@ Local<String> v8::String::Concat(Isolate* v8_isolate, Local<String> left,
66586549
return Utils::ToLocal(result);
66596550
}
66606551

6661-
Local<String> v8::String::Concat(Local<String> left, Local<String> right) {
6662-
i::Handle<i::String> left_string = Utils::OpenHandle(*left);
6663-
i::Isolate* isolate = UnsafeIsolateFromHeapObject(left_string);
6664-
return Concat(reinterpret_cast<Isolate*>(isolate), left, right);
6665-
}
6666-
66676552
MaybeLocal<String> v8::String::NewExternalTwoByte(
66686553
Isolate* isolate, v8::String::ExternalStringResource* resource) {
66696554
CHECK(resource && resource->data());
@@ -6872,11 +6757,6 @@ bool v8::BooleanObject::ValueOf() const {
68726757
return jsvalue->value()->IsTrue(isolate);
68736758
}
68746759

6875-
Local<v8::Value> v8::StringObject::New(Local<String> value) {
6876-
i::Handle<i::String> string = Utils::OpenHandle(*value);
6877-
i::Isolate* isolate = UnsafeIsolateFromHeapObject(string);
6878-
return New(reinterpret_cast<Isolate*>(isolate), value);
6879-
}
68806760

68816761
Local<v8::Value> v8::StringObject::New(Isolate* v8_isolate,
68826762
Local<String> value) {

0 commit comments

Comments
 (0)