Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

chakrashim: fixing ObjectTemplate implementation #439

Merged
merged 1 commit into from
Nov 30, 2017

Conversation

kfarnung
Copy link
Contributor

@kfarnung kfarnung commented Nov 30, 2017

It's possible to create an object template with a constructor in V8,
but we didn't support it. It's a little weird (even in V8) since
objects constructed this way will never trigger the CallHandler of the
FunctionTemplate object, it just inherits the prototype from it.

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

chakrashim

@obastemur
Copy link
Contributor

@kfarnung this was broken by design? What we gain by implementing? ie perf/memory effect? How to test it?

@kfarnung
Copy link
Contributor Author

I don't think this was broken by design, it looks like this is just an edge case implementation detail that wasn't implemented previously. This behavior is required in the latest http2 changes from upstream. I tried to minimize the impact and have a local test suite that I'm using to validate the behavior against V8.

}
}
}

if (!prototype.IsEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason you chose not to make this an else?

I'd also like to see a comment here explaining the scenario this is supporting; it's something that I could easily see being broken if it is forgotten.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason is that the previous conditional is just an alternate way to get the prototype. It could have already been provided directly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I'd missed that it was setting prototype

@kfarnung
Copy link
Contributor Author

It's possible to create an object template with a constructor in V8,
but we didn't support it.  It's a little weird (even in V8) since
objects constructed this way will never trigger the CallHandler of the
FunctionTemplate object, it just inherits the prototype from it.

PR-URL: nodejs#439
Reviewed-By: Jimmy Thomson <jithomso@microsoft.com>
@kfarnung kfarnung merged commit ca720a3 into nodejs:master Nov 30, 2017
@kfarnung kfarnung deleted the objtemplate branch November 30, 2017 23:42
kfarnung added a commit to kfarnung/node-chakracore that referenced this pull request Jan 10, 2018
It's possible to create an object template with a constructor in V8,
but we didn't support it.  It's a little weird (even in V8) since
objects constructed this way will never trigger the CallHandler of the
FunctionTemplate object, it just inherits the prototype from it.

PR-URL: nodejs#439
Reviewed-By: Jimmy Thomson <jithomso@microsoft.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants