Description
This is an idea I thought of whilst looking at #6341
Throughout the internal JS library in ChakraCore a method GetAndAssertIsConstructorSuperCall
is used within all constructors to see if they are being called as supers or potentially have a newTarget set. All of these checks:
a) have a small but pervasive performance impact AND
b) make some of the code rather messy (there have been various bugs relating to mishandling this in the past)
In all cases the caller of the constructor ought to be able to establish this and provide it - therefore these calls could be eliminated AND additionally to prevent the branching that's currently done all of these constructors could be converted into template bool functions.
This would be a reasonably large refactor (and may involve refactoring lowering of constructor calls in the JIT - not sure on that, would need to check) but it would be a good opportunity for someone to get a look at a large portion of the codebase and it should be beneficial in the long run, any takers?