Skip to content

Commit

Permalink
deps: increase V8 deprecation levels
Browse files Browse the repository at this point in the history
Bump from `V8_DEPRECATE_SOON` to `V8_DEPRECATE` for APIs
that are removed in V8 7.0+. Also, provide the replacement APIs
in cases where they were absent on Node 10.

Refs: #23122
PR-URL: #23159
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information
addaleax committed Oct 7, 2018
1 parent 950ccee commit 46c7d0d
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 47 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.34',
'v8_embedder_string': '-node.35',

# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/include/libplatform/libplatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ V8_PLATFORM_EXPORT std::unique_ptr<v8::Platform> NewDefaultPlatform(
InProcessStackDumping::kDisabled,
std::unique_ptr<v8::TracingController> tracing_controller = {});

V8_PLATFORM_EXPORT V8_DEPRECATE_SOON(
V8_PLATFORM_EXPORT V8_DEPRECATED(
"Use NewDefaultPlatform instead",
v8::Platform* CreateDefaultPlatform(
int thread_pool_size = 0,
Expand Down
96 changes: 51 additions & 45 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -1019,8 +1019,12 @@ class V8_EXPORT PrimitiveArray {
public:
static Local<PrimitiveArray> New(Isolate* isolate, int length);
int Length() const;
void Set(int index, Local<Primitive> item);
Local<Primitive> Get(int index);
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);
};

/**
Expand Down Expand Up @@ -1735,8 +1739,8 @@ class V8_EXPORT StackTrace {
/**
* Returns a StackFrame at a particular index.
*/
V8_DEPRECATE_SOON("Use Isolate version",
Local<StackFrame> GetFrame(uint32_t index) const);
V8_DEPRECATED("Use Isolate version",
Local<StackFrame> GetFrame(uint32_t index) const);
Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;

/**
Expand Down Expand Up @@ -2432,25 +2436,25 @@ class V8_EXPORT Value : public Data {
Local<Context> context) const;
V8_WARN_UNUSED_RESULT MaybeLocal<Int32> ToInt32(Local<Context> context) const;

V8_DEPRECATE_SOON("Use maybe version",
Local<Boolean> ToBoolean(Isolate* isolate) const);
V8_DEPRECATE_SOON("Use maybe version",
Local<Number> ToNumber(Isolate* isolate) const);
V8_DEPRECATE_SOON("Use maybe version",
Local<String> ToString(Isolate* isolate) const);
V8_DEPRECATE_SOON("Use maybe version",
Local<Object> ToObject(Isolate* isolate) const);
V8_DEPRECATE_SOON("Use maybe version",
Local<Integer> ToInteger(Isolate* isolate) const);
V8_DEPRECATE_SOON("Use maybe version",
Local<Int32> ToInt32(Isolate* isolate) const);

inline V8_DEPRECATE_SOON("Use maybe version",
Local<Boolean> ToBoolean() const);
inline V8_DEPRECATE_SOON("Use maybe version", Local<String> ToString() const);
inline V8_DEPRECATE_SOON("Use maybe version", Local<Object> ToObject() const);
inline V8_DEPRECATE_SOON("Use maybe version",
Local<Integer> ToInteger() const);
V8_DEPRECATED("Use maybe version",
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);

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.
Expand All @@ -2467,14 +2471,14 @@ class V8_EXPORT Value : public Data {
Local<Context> context) const;
V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;

V8_DEPRECATE_SOON("Use maybe version", bool BooleanValue() const);
V8_DEPRECATE_SOON("Use maybe version", double NumberValue() const);
V8_DEPRECATE_SOON("Use maybe version", int64_t IntegerValue() const);
V8_DEPRECATE_SOON("Use maybe version", uint32_t Uint32Value() const);
V8_DEPRECATE_SOON("Use maybe version", int32_t Int32Value() 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_DEPRECATE_SOON("Use maybe version", bool Equals(Local<Value> that) const);
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;
Expand Down Expand Up @@ -2580,7 +2584,7 @@ class V8_EXPORT String : public Name {
* Returns the number of bytes in the UTF-8 encoded
* representation of this string.
*/
V8_DEPRECATE_SOON("Use Isolate version instead", int Utf8Length() const);
V8_DEPRECATED("Use Isolate version instead", int Utf8Length() const);

int Utf8Length(Isolate* isolate) const;

Expand Down Expand Up @@ -2638,23 +2642,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_DEPRECATE_SOON("Use Isolate* version",
int Write(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_DEPRECATE_SOON("Use Isolate* version",
int WriteOneByte(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 = NULL, int options = NO_OPTIONS) const;
V8_DEPRECATE_SOON("Use Isolate* version",
int WriteUtf8(char* buffer, int length = -1,
int* nchars_ref = NULL,
int options = NO_OPTIONS) const);
V8_DEPRECATED("Use Isolate* version",
int WriteUtf8(char* buffer, int length = -1,
int* nchars_ref = NULL,
int options = NO_OPTIONS) const);

/**
* A zero length string.
Expand Down Expand Up @@ -2818,9 +2822,9 @@ class V8_EXPORT String : public Name {
*/
static Local<String> Concat(Isolate* isolate, Local<String> left,
Local<String> right);
static V8_DEPRECATE_SOON("Use Isolate* version",
Local<String> Concat(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
Expand Down Expand Up @@ -5044,7 +5048,9 @@ class V8_EXPORT BooleanObject : public Object {
*/
class V8_EXPORT StringObject : public Object {
public:
static Local<Value> New(Local<String> value);
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;

Expand Down
13 changes: 13 additions & 0 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2227,6 +2227,10 @@ int PrimitiveArray::Length() const {
return array->length();
}

void PrimitiveArray::Set(Isolate* isolate, int index, Local<Primitive> item) {
return Set(index, item);
}

void PrimitiveArray::Set(int index, Local<Primitive> item) {
i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
i::Isolate* isolate = array->GetIsolate();
Expand All @@ -2239,6 +2243,10 @@ void PrimitiveArray::Set(int index, Local<Primitive> item) {
array->set(index, *i_item);
}

Local<Primitive> PrimitiveArray::Get(Isolate* isolate, int index) {
return Get(index);
}

Local<Primitive> PrimitiveArray::Get(int index) {
i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
i::Isolate* isolate = array->GetIsolate();
Expand Down Expand Up @@ -6880,6 +6888,11 @@ bool v8::BooleanObject::ValueOf() const {
}


Local<v8::Value> v8::StringObject::New(Isolate* isolate, Local<String> value) {
return New(value);
}


Local<v8::Value> v8::StringObject::New(Local<String> value) {
i::Handle<i::String> string = Utils::OpenHandle(*value);
i::Isolate* isolate = string->GetIsolate();
Expand Down

0 comments on commit 46c7d0d

Please sign in to comment.