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

deps: provide more V8 backwards compatibility #23158

Closed
wants to merge 4 commits into from

Conversation

addaleax
Copy link
Member

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: #23122

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. v8 engine Issues and PRs related to the V8 dependency. labels Sep 29, 2018
Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

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

LGTM. Worth doing a CITGM run?

@targos
Copy link
Member

targos commented Sep 29, 2018

/cc @nodejs/v8-update

@targos
Copy link
Member

targos commented Sep 29, 2018

@addaleax
Copy link
Member Author

addaleax commented Sep 29, 2018

CITGM looks a lot nicer now – still a bunch of failures, but nothing related to the V8 changes.

CI: https://ci.nodejs.org/job/node-test-pull-request/17506/ (:heavy_check_mark:)

@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 29, 2018
@refack
Copy link
Contributor

refack commented Sep 29, 2018

I think we can simply turn on all the V8_DEPRECATE_SOON to produce deprecation warnings
by setting 'v8_imminent_deprecation_warnings': 1, in common.gypi

['v8_imminent_deprecation_warnings==1', {
'defines': ['V8_IMMINENT_DEPRECATION_WARNINGS',],
}],

// A macro (V8_DEPRECATE_SOON) to make it easier to see what will be deprecated.
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS) && \
V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
#define V8_DEPRECATE_SOON(message, declarator) \
declarator __attribute__((deprecated(message)))
#elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
#define V8_DEPRECATE_SOON(message, declarator) \
declarator __attribute__((deprecated))
#elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
#define V8_DEPRECATE_SOON(message, declarator) __declspec(deprecated) declarator
#else
#define V8_DEPRECATE_SOON(message, declarator) declarator
#endif

edit

Need to explicitly add 'V8_IMMINENT_DEPRECATION_WARNINGS=1' to defines in:

'defines': [ 'DEBUG', '_DEBUG', 'V8_ENABLE_CHECKS' ],

and
'defines': [ 'V8_IMMINENT_DEPRECATION_WARNINGS=1' ], somewhere in

node/common.gypi

Lines 164 to 168 in a21af5b

'Release': {
'variables': {
'v8_enable_handle_zapping': 0,
},
'cflags': [ '-O3' ],

@addaleax
Copy link
Member Author

I think setting v8_imminent_deprecation_warnings would probably be too noisy for now? Feel free to open a PR with it if you think otherwise, but it seems independent of this PR.

@refack
Copy link
Contributor

refack commented Sep 30, 2018

but it seems independent of this PR.

Discussion in #23167

@addaleax addaleax removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 3, 2018
@addaleax
Copy link
Member Author

addaleax commented Oct 3, 2018

(please make sure the discussion in #23122 about conflicting with V8 updates is resolved before landing this)

@jasnell
Copy link
Member

jasnell commented Oct 3, 2018

Does this need to be on the 11.0.0 milestone?

@addaleax
Copy link
Member Author

addaleax commented Oct 3, 2018

@jasnell Yes – it unbreaks a large number of native add-ons, and in particular makes CITGM return more meaningful results again.

@addaleax addaleax added this to the 11.0.0 milestone Oct 3, 2018
Copy link
Contributor

@thefourtheye thefourtheye left a comment

Choose a reason for hiding this comment

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

I am no expert in this area, but the reason we are doing this and the changes are straight forward. So LGTM.

targos and others added 3 commits October 4, 2018 14:38
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@{nodejs#49}
    Cr-Branched-From: 6e2adae6f7f8e891cfd01f3280482b20590427a6-refs/heads/7.0.276@{#1}
    Cr-Branched-From: bc08a8624cbbea7a2d30071472bc73ad9544eadf-refs/heads/master@{#55424}

Refs: v8/v8@9136dd8
Refs: nodejs#23122
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: nodejs#23122
@addaleax
Copy link
Member Author

addaleax commented Oct 4, 2018

@hashseed @targos I’ve updated this – does this solution seem okay to you?

CI: https://ci.nodejs.org/job/node-test-pull-request/17637/
V8 CI: https://ci.nodejs.org/job/node-test-commit-v8-linux/1730/

@@ -3876,6 +3888,36 @@ void v8::RegExp::CheckCast(v8::Value* that) {
}


bool Value::BooleanValue() const {
return BooleanValue(Isolate::GetCurrent()->GetCurrentContext())
.FromMaybe(false);
Copy link
Member

Choose a reason for hiding this comment

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

Depending on what behavior you prefer, you may want to use FromJust() here to cause a crash rather than failing silently.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done – this is currently only theoretical, right?

Copy link
Member

Choose a reason for hiding this comment

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

Ah. Sorry. I actually meant all the other uses of FromMaybe, like in Value::IntegerValue. BooleanValue can actually never throw, so in newer V8 we restored this API already, without the Maybe return value.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, I understand – that would at least technically be a breaking change, I guess, and we’re past the cut-off date for that for Node 11

@addaleax
Copy link
Member Author

addaleax commented Oct 6, 2018

Landed in 2ba19ff...48d1335

@addaleax addaleax closed this Oct 6, 2018
@addaleax addaleax deleted the v8-dep-back branch October 6, 2018 00:14
addaleax pushed a commit that referenced this pull request Oct 6, 2018
Refs: v8/v8@7.0.276.22...7.0.276.24

PR-URL: #23158
Refs: #23122
Reviewed-By: Yang Guo <yangguo@chromium.org>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
addaleax added a commit that referenced this pull request Oct 6, 2018
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>
addaleax added a commit that referenced this pull request Oct 6, 2018
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: #23122

PR-URL: #23158
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Yang Guo <yangguo@chromium.org>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
@addaleax addaleax added the notable-change PRs with changes that should be highlighted in changelogs. label Oct 6, 2018
jasnell pushed a commit that referenced this pull request Oct 17, 2018
Refs: v8/v8@7.0.276.22...7.0.276.24

PR-URL: #23158
Refs: #23122
Reviewed-By: Yang Guo <yangguo@chromium.org>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
jasnell pushed a commit that referenced this pull request Oct 17, 2018
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>
jasnell pushed a commit that referenced this pull request Oct 17, 2018
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: #23122

PR-URL: #23158
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Yang Guo <yangguo@chromium.org>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
addaleax added a commit to addaleax/node that referenced this pull request Oct 26, 2018
This was introduced in 48d1335. Previously, values such as
`undefined` would not be coerced properly because `NumberValue()`
returns `NaN` for them.

Refs: nodejs#23158
addaleax added a commit that referenced this pull request Oct 27, 2018
This was introduced in 48d1335. Previously, values such as
`undefined` would not be coerced properly because `NumberValue()`
returns `NaN` for them.

Refs: #23158

PR-URL: #23898
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Oct 27, 2018
This was introduced in 48d1335. Previously, values such as
`undefined` would not be coerced properly because `NumberValue()`
returns `NaN` for them.

Refs: #23158

PR-URL: #23898
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Nov 1, 2018
This was introduced in 48d1335. Previously, values such as
`undefined` would not be coerced properly because `NumberValue()`
returns `NaN` for them.

Refs: #23158

PR-URL: #23898
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
wuzhiming pushed a commit to wuzhiming/v8 that referenced this pull request May 17, 2019
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: nodejs/node#23122

PR-URL: nodejs/node#23158
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Yang Guo <yangguo@chromium.org>
Reviewed-By: Michaël Zasso <targos@protonmail.com>

Patch-Filename: deps_provide_more_v8_backwards_compatibility.patch
wuzhiming pushed a commit to wuzhiming/v8 that referenced this pull request Aug 7, 2019
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: nodejs/node#23122

PR-URL: nodejs/node#23158
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Yang Guo <yangguo@chromium.org>
Reviewed-By: Michaël Zasso <targos@protonmail.com>

Patch-Filename: deps_provide_more_v8_backwards_compatibility.patch
wuzhiming pushed a commit to wuzhiming/v8 that referenced this pull request Aug 9, 2019
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: nodejs/node#23122

PR-URL: nodejs/node#23158
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Yang Guo <yangguo@chromium.org>
Reviewed-By: Michaël Zasso <targos@protonmail.com>

Patch-Filename: deps_provide_more_v8_backwards_compatibility.patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. notable-change PRs with changes that should be highlighted in changelogs. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants