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

(vee-eight-4.9) Replace more deprecated V8 API usage #5204

Closed
wants to merge 4 commits into from

Conversation

ofrobots
Copy link
Contributor

Continuing from #5159, this PR replaces deprecated uses of SetAccessor and most uses of SetWeak on the vee-eight-4.9 branch.

The use of SetWeak in src/node_buffer.cc is more involved because it expects to get a handle to the weak object in the weak callback. I need to understand the buffer code a bit more before attempting to change that.

EDIT: the original change for SetWeak usage in node_contextify was flawed. I have removed that.

Remaining work:

See also: #4869
R=@bnoordhuis , @targos
/cc @nodejs/v8

@ofrobots ofrobots added the v8 engine Issues and PRs related to the V8 dependency. label Feb 12, 2016
Dynamic checks that CallbackInfo holds an ArrayBuffer handle can be
converted into compiler enforced checks. Removed unused code, and
other minor cleanup.
if (object->ByteLength() != 0)
CHECK_NE(data, nullptr);

object->SetAlignedPointerInInternalField(0, data);
Copy link
Member

Choose a reason for hiding this comment

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

It would be nicer to make the field index a class constant.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we maybe make a comment in the header that the first internal field is reserved by node? Since switching to using array buffer I've been writing experimental modules that also make use of these fields.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. In the light of wanting a comment in the header, I chose to make it a header constant rather than class constant. 8be49858fab.

@bnoordhuis
Copy link
Member

LGTM with a suggestion.

@indutny
Copy link
Member

indutny commented Feb 21, 2016

LGTM

@ofrobots
Copy link
Contributor Author

CI: https://ci.nodejs.org/job/node-test-pull-request/1721/

Updating the use of SetWeak in node_contextify.cc might be a non-trivial amount of work. Let's do it in a follow-on PR. I haven't looked at NewExternal in string_bytes.cc yet.

Old style SetWeak is now deprecated, and weakness now works like
phantom references. This means we no longer have a reference to the
object in the weak callback. We use a kInternalFields style weak
callback which provides us with the contents of 2 internal fields
where we can squirrel away the native buffer pointer.

We can no longer neuter the buffer in the weak callback, but that
should be unnecessary as the object is going to be GC'd during the
current gc cycle.
@ofrobots
Copy link
Contributor Author

Second CI (also includes follow-on #5392): https://ci.nodejs.org/job/node-test-pull-request/1749/

ofrobots added a commit that referenced this pull request Feb 25, 2016
PR-URL: #5204
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Reviewed-By: indutny - Fedor Indutny <[email protected]>
ofrobots added a commit that referenced this pull request Feb 25, 2016
PR-URL: #5204
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Reviewed-By: indutny - Fedor Indutny <[email protected]>
ofrobots added a commit that referenced this pull request Feb 25, 2016
Dynamic checks that CallbackInfo holds an ArrayBuffer handle can be
converted into compiler enforced checks. Removed unused code, and
other minor cleanup.

PR-URL: #5204
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Reviewed-By: indutny - Fedor Indutny <[email protected]>
ofrobots added a commit that referenced this pull request Feb 25, 2016
Old style SetWeak is now deprecated, and weakness now works like
phantom references. This means we no longer have a reference to the
object in the weak callback. We use a kInternalFields style weak
callback which provides us with the contents of 2 internal fields
where we can squirrel away the native buffer pointer.

We can no longer neuter the buffer in the weak callback, but that
should be unnecessary as the object is going to be GC'd during the
current gc cycle.

PR-URL: #5204
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Reviewed-By: indutny - Fedor Indutny <[email protected]>
@ofrobots
Copy link
Contributor Author

Landed as d47a982...7a863af.

@ofrobots ofrobots closed this Feb 25, 2016
ofrobots added a commit to ofrobots/node that referenced this pull request Mar 1, 2016
PR-URL: nodejs#5204
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Reviewed-By: indutny - Fedor Indutny <[email protected]>
ofrobots added a commit to ofrobots/node that referenced this pull request Mar 1, 2016
PR-URL: nodejs#5204
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Reviewed-By: indutny - Fedor Indutny <[email protected]>
ofrobots added a commit to ofrobots/node that referenced this pull request Mar 3, 2016
PR-URL: nodejs#5204
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Reviewed-By: indutny - Fedor Indutny <[email protected]>
ofrobots added a commit to ofrobots/node that referenced this pull request Mar 3, 2016
PR-URL: nodejs#5204
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Reviewed-By: indutny - Fedor Indutny <[email protected]>
ofrobots added a commit to ofrobots/node that referenced this pull request Mar 3, 2016
Dynamic checks that CallbackInfo holds an ArrayBuffer handle can be
converted into compiler enforced checks. Removed unused code, and
other minor cleanup.

PR-URL: nodejs#5204
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Reviewed-By: indutny - Fedor Indutny <[email protected]>
ofrobots added a commit to ofrobots/node that referenced this pull request Mar 3, 2016
Old style SetWeak is now deprecated, and weakness now works like
phantom references. This means we no longer have a reference to the
object in the weak callback. We use a kInternalFields style weak
callback which provides us with the contents of 2 internal fields
where we can squirrel away the native buffer pointer.

We can no longer neuter the buffer in the weak callback, but that
should be unnecessary as the object is going to be GC'd during the
current gc cycle.

PR-URL: nodejs#5204
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Reviewed-By: indutny - Fedor Indutny <[email protected]>
ofrobots added a commit that referenced this pull request Mar 4, 2016
PR-URL: #5204
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Reviewed-By: indutny - Fedor Indutny <[email protected]>
ofrobots added a commit that referenced this pull request Mar 4, 2016
PR-URL: #5204
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Reviewed-By: indutny - Fedor Indutny <[email protected]>
ofrobots added a commit that referenced this pull request Mar 4, 2016
Dynamic checks that CallbackInfo holds an ArrayBuffer handle can be
converted into compiler enforced checks. Removed unused code, and
other minor cleanup.

PR-URL: #5204
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Reviewed-By: indutny - Fedor Indutny <[email protected]>
ofrobots added a commit that referenced this pull request Mar 4, 2016
Old style SetWeak is now deprecated, and weakness now works like
phantom references. This means we no longer have a reference to the
object in the weak callback. We use a kInternalFields style weak
callback which provides us with the contents of 2 internal fields
where we can squirrel away the native buffer pointer.

We can no longer neuter the buffer in the weak callback, but that
should be unnecessary as the object is going to be GC'd during the
current gc cycle.

PR-URL: #5204
Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
Reviewed-By: indutny - Fedor Indutny <[email protected]>
addaleax added a commit to addaleax/node that referenced this pull request Jan 13, 2019
This call was introduced in 827ee49 to avoid a crash in a
later `Neuter()` call that has later been removed in ebbbc5a,
rendering the original call unnecessary.

Refs: nodejs#3624
Refs: nodejs#5204
addaleax added a commit that referenced this pull request Jan 21, 2019
This call was introduced in 827ee49 to avoid a crash in a
later `Neuter()` call that has later been removed in ebbbc5a,
rendering the original call unnecessary.

Refs: #3624
Refs: #5204

PR-URL: #25479
Reviewed-By: Anatoli Papirovski <[email protected]>
targos pushed a commit that referenced this pull request Jan 24, 2019
This call was introduced in 827ee49 to avoid a crash in a
later `Neuter()` call that has later been removed in ebbbc5a,
rendering the original call unnecessary.

Refs: #3624
Refs: #5204

PR-URL: #25479
Reviewed-By: Anatoli Papirovski <[email protected]>
BethGriggs pushed a commit that referenced this pull request Apr 29, 2019
This call was introduced in 827ee49 to avoid a crash in a
later `Neuter()` call that has later been removed in ebbbc5a,
rendering the original call unnecessary.

Refs: #3624
Refs: #5204

PR-URL: #25479
Reviewed-By: Anatoli Papirovski <[email protected]>
BethGriggs pushed a commit that referenced this pull request May 10, 2019
This call was introduced in 827ee49 to avoid a crash in a
later `Neuter()` call that has later been removed in ebbbc5a,
rendering the original call unnecessary.

Refs: #3624
Refs: #5204

PR-URL: #25479
Reviewed-By: Anatoli Papirovski <[email protected]>
MylesBorins pushed a commit that referenced this pull request May 16, 2019
This call was introduced in 827ee49 to avoid a crash in a
later `Neuter()` call that has later been removed in ebbbc5a,
rendering the original call unnecessary.

Refs: #3624
Refs: #5204

PR-URL: #25479
Reviewed-By: Anatoli Papirovski <[email protected]>
deepak1556 pushed a commit to electron/node that referenced this pull request Jul 10, 2019
This call was introduced in 827ee49 to avoid a crash in a
later `Neuter()` call that has later been removed in ebbbc5a,
rendering the original call unnecessary.

Refs: nodejs/node#3624
Refs: nodejs/node#5204

PR-URL: nodejs/node#25479
Reviewed-By: Anatoli Papirovski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants