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

src,deps: add isolate parameter to String::Concat #22521

Closed
wants to merge 1 commit into from

Conversation

targos
Copy link
Member

@targos targos commented Aug 25, 2018

Partially backport an upstream commit that deprecates String::Concat
without the isolate parameter. This overload has already been removed
in V8 7.0.

Refs: v8/v8@8a011b5

/cc @nodejs/v8-update

I'd like your opinion on this proactive approach about V8 deprecations. If everyone is fine with it, I'm ready to open other PRs for StackTrace::GetFrame, String::Write, etc.
I would like to do this because it can be backported to v10.x.

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

Partially backport an upstream commit that deprecates String::Concat
without the isolate parameter. This overload has already been removed
in V8 7.0.

Refs: v8/v8@8a011b5
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Aug 25, 2018
@BridgeAR
Copy link
Member

@targos I think it's actually a good idea to be proactive about it. Having dealt with the issue early on always sounds good to me.

Copy link
Contributor

@ryzokuken ryzokuken left a comment

Choose a reason for hiding this comment

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

LGTM overall, with a single comment down below and a minor concern:

The signature of WinapiErrnoException and ErrnoException aren't changed, so the isolate arg had been there all along, right?
Why did we just shift from env()->isolate to isolate then? (Like, I agree that we should, but shouldn't it have been done already?)

@@ -6663,6 +6663,11 @@ Local<String> v8::String::Concat(Local<String> left, Local<String> right) {
return Utils::ToLocal(result);
}

Local<String> v8::String::Concat(Local<String> left, Local<String> right) {
i::Handle<i::String> left_string = Utils::OpenHandle(*left);
Copy link
Contributor

Choose a reason for hiding this comment

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

A bit hacky (opening a handle just to fetch the isolate), but idk if there's a better way. @addaleax do you?

Perhaps one could get the current env and extract the associated isolate? Idk how different the result would be, but it's certainly less hacky IMO.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's just copied from the V8 source code (see the Refs link)

Copy link
Contributor

Choose a reason for hiding this comment

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

I get it. It works so it shouldn't be a problem anyway.

@targos
Copy link
Member Author

targos commented Aug 25, 2018

The signature of WinapiErrnoException and ErrnoException aren't changed, so the isolate arg had been there all along, right?
Why did we just shift from env()->isolate to isolate then? (Like, I agree that we should, but shouldn't it have been done already?)

Yes, WinapiErrnoException and ErrnoException already receive the isolate as a parameter. Unless I'm missing something, we can and should be using it instead of getting the pointer from the environment.

@ryzokuken
Copy link
Contributor

As I said, I agree that we should just directly use it, I just had been wondering why it wasn't being used before this patch if the parameter always existed.

@refack
Copy link
Contributor

refack commented Aug 25, 2018

IMHO it's better to review, and to track if this is done in two commits. Quick look at the code seems like it's possible.

@targos
Copy link
Member Author

targos commented Aug 26, 2018

@refack yeah, sorry. I thought the changeset was small enough to not be a problem. I'll do multiple commits for the next PR.

@targos
Copy link
Member Author

targos commented Aug 26, 2018

@targos targos added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Aug 26, 2018
@targos
Copy link
Member Author

targos commented Aug 28, 2018

Landed in 08aad66

@targos targos closed this Aug 28, 2018
@targos targos deleted the v8-isolate-concat branch August 28, 2018 12:13
@targos targos added v8 engine Issues and PRs related to the V8 dependency. and removed author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Aug 28, 2018
targos added a commit that referenced this pull request Aug 28, 2018
Partially backport an upstream commit that deprecates String::Concat
without the isolate parameter. This overload has already been removed
in V8 7.0.

PR-URL: #22521
Refs: v8/v8@8a011b5
Reviewed-By: Ujjwal Sharma <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
@addaleax
Copy link
Member

@targos This would need a backport for v10.x :)

@targos
Copy link
Member Author

targos commented Aug 28, 2018

Oops, looks like we are working on the same thing :)
It's normal that the embedder string is off by one in v10.x compared to master. There is one commit that could not be backported because of ABI compatibility.

@addaleax
Copy link
Member

@targos If you were on IRC I’d have asked you whether you’re going to do a 10.x this week. 😄

I haven’t done any backporting attempts myself, but if the embedder string is one off, would it make sense to just bump it to the master level?

@targos
Copy link
Member Author

targos commented Aug 28, 2018

@addaleax I'm on IRC now. I'm not really preparing the release btw, just keeping the branch up-to-date.

if the embedder string is one off, would it make sense to just bump it to the master level?

Good idea. I'll open a PR to do that.

targos added a commit that referenced this pull request Aug 28, 2018
Partially backport an upstream commit that deprecates String::Concat
without the isolate parameter. This overload has already been removed
in V8 7.0.

PR-URL: #22521
Refs: v8/v8@8a011b5
Reviewed-By: Ujjwal Sharma <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
targos added a commit that referenced this pull request Sep 3, 2018
Partially backport an upstream commit that deprecates String::Concat
without the isolate parameter. This overload has already been removed
in V8 7.0.

PR-URL: #22521
Refs: v8/v8@8a011b5
Reviewed-By: Ujjwal Sharma <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
targos added a commit that referenced this pull request Sep 6, 2018
Partially backport an upstream commit that deprecates String::Concat
without the isolate parameter. This overload has already been removed
in V8 7.0.

PR-URL: #22521
Refs: v8/v8@8a011b5
Reviewed-By: Ujjwal Sharma <[email protected]>
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants