Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v10.x] deps: increase V8 deprecation levels #23159

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
!.mailmap
!.nycrc
!.travis.yml
!.eslintrc.yaml

core
vgcore.*
Expand All @@ -38,14 +39,15 @@ icu_config.gypi
.eslintcache
node_trace.*.log
coverage/
!**/node_modules/**/coverage

/out

# various stuff that VC++ produces/uses
Debug/
!**/node_modules/debug/
!deps/v8/src/debug/
Release/
!**/node_modules/**/release
!doc/blog/**
*.sln
!nodemsi.sln
Expand All @@ -64,7 +66,6 @@ ipch/
*.VC.opendb
.vs/
.vscode/
/deps/v8/src/debug/obj
/*.exe

/config.mk
Expand Down Expand Up @@ -98,6 +99,7 @@ deps/openssl/openssl.xml
deps/openssl/openssl.target.mk
deps/zlib/zlib.target.mk

!deps/npm/node_modules
# not needed and causes issues for distro packagers
deps/npm/node_modules/.bin/

Expand Down Expand Up @@ -130,8 +132,4 @@ deps/uv/docs/src/guide/
# ignore VS compiler output unhandled by V8's .gitignore
deps/v8/gypfiles/Debug/
deps/v8/gypfiles/Release/
deps/v8/src/Debug/
deps/v8/src/Release/
deps/v8/src/inspector/Debug/
deps/v8/src/inspector/Release/
deps/v8/third_party/eu-strip/
8 changes: 4 additions & 4 deletions COLLABORATOR_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ agenda.
### Waiting for Approvals

Before landing pull requests, sufficient time should be left for input
from other Collaborators. In general, leave at least 48 hours during the
week and 72 hours over weekends to account for international time
differences and work schedules. However, certain types of pull requests
can be fast-tracked and may be landed after a shorter delay. For example:
from other Collaborators. In general, leave at least 72 hours to account for
international time differences and work schedules. However, certain types of
pull requests can be fast-tracked and may be landed after a shorter delay. For
example:

* Focused changes that affect only documentation and/or the test suite:
* `code-and-learn` tasks typically fall into this category.
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1181,19 +1181,25 @@ else
@echo "To install (requires internet access) run: $ make format-cpp-build"
endif

ifeq ($(V),1)
CPPLINT_QUIET =
else
CPPLINT_QUIET = --quiet
endif
.PHONY: lint-cpp
# Lints the C++ code with cpplint.py and check-imports.py.
lint-cpp: tools/.cpplintstamp

tools/.cpplintstamp: $(LINT_CPP_FILES)
@echo "Running C++ linter..."
@$(PYTHON) tools/cpplint.py --quiet $?
@$(PYTHON) tools/cpplint.py $(CPPLINT_QUIET) $?
@$(PYTHON) tools/check-imports.py
@touch $@

lint-addon-docs: test/addons/.docbuildstamp
@echo "Running C++ linter on addon docs..."
@$(PYTHON) tools/cpplint.py --filter=$(ADDON_DOC_LINT_FLAGS) $(LINT_CPP_ADDON_DOC_FILES_GLOB)
@$(PYTHON) tools/cpplint.py $(CPPLINT_QUIET) --filter=$(ADDON_DOC_LINT_FLAGS) \
$(LINT_CPP_ADDON_DOC_FILES_GLOB)

cpplint: lint-cpp
@echo "Please use lint-cpp instead of cpplint"
Expand Down
2 changes: 2 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
'library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
'component%': 'static_library', # NB. these names match with what V8 expects
'msvs_multi_core_compile': '0', # we do enable multicore compiles, but not using the V8 way
'enable_pgo_generate%': '0',
'enable_pgo_use%': '0',
'python%': 'python',

'node_shared%': 'false',
Expand Down
1 change: 0 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,6 @@ def configure_static(o):


def write(filename, data):
filename = filename
print_verbose('creating %s' % filename)
with open(filename, 'w+') as f:
f.write(data)
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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is problematic because it means prebuilt add-ons that call these methods won't work with older Node.js v10.x releases that don't have them. The options I see:

  1. Don't warn.
  2. Don't care.

There probably aren't too many users of these methods, possibly none at all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is problematic because it means prebuilt add-ons that call these methods won't work with older Node.js v10.x releases that don't have them.

I mean, that’s a general issue with semver-minor patches for the C++ API, right? I’m not too worried here. If you think we should do something, I guess we could include the Node.js version number in the warning message?

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
50 changes: 38 additions & 12 deletions doc/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -1555,18 +1555,6 @@ An attempt was made to operate on an already closed socket.

A call was made and the UDP subsystem was not running.

<a id="ERR_STDERR_CLOSE"></a>
### ERR_STDERR_CLOSE

An attempt was made to close the `process.stderr` stream. By design, Node.js
does not allow `stdout` or `stderr` streams to be closed by user code.

<a id="ERR_STDOUT_CLOSE"></a>
### ERR_STDOUT_CLOSE

An attempt was made to close the `process.stdout` stream. By design, Node.js
does not allow `stdout` or `stderr` streams to be closed by user code.

<a id="ERR_STREAM_CANNOT_PIPE"></a>
### ERR_STREAM_CANNOT_PIPE

Expand Down Expand Up @@ -1952,6 +1940,37 @@ removed: v10.0.0

The `repl` module was unable to parse data from the REPL history file.


<a id="ERR_STDERR_CLOSE"></a>
### ERR_STDERR_CLOSE
<!-- YAML
removed: REPLACEME
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/23053
description: Rather than emitting an error, `process.stderr.end()` now
only closes the stream side but not the underlying resource,
making this error obsolete.
-->

An attempt was made to close the `process.stderr` stream. By design, Node.js
does not allow `stdout` or `stderr` streams to be closed by user code.

<a id="ERR_STDOUT_CLOSE"></a>
### ERR_STDOUT_CLOSE
<!-- YAML
removed: REPLACEME
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/23053
description: Rather than emitting an error, `process.stderr.end()` now
only closes the stream side but not the underlying resource,
making this error obsolete.
-->

An attempt was made to close the `process.stdout` stream. By design, Node.js
does not allow `stdout` or `stderr` streams to be closed by user code.

<a id="ERR_STREAM_READ_NOT_IMPLEMENTED"></a>
### ERR_STREAM_READ_NOT_IMPLEMENTED
<!-- YAML
Expand Down Expand Up @@ -2059,6 +2078,13 @@ instance.setEncoding('utf8');
An attempt has been made to create a string larger than the maximum allowed
size.

<a id="ERR_TTY_WRITABLE_NOT_READABLE"></a>
#### ERR_TTY_WRITABLE_NOT_READABLE

This `Error` is thrown when a read is attempted on a TTY `WriteStream`,
such as `process.stdout.on('data')`.


[`--force-fips`]: cli.html#cli_force_fips
[`'uncaughtException'`]: process.html#process_event_uncaughtexception
[`child_process`]: child_process.html
Expand Down
Loading