On 2010-08-31, at 1:09 , Maxime Chevalier-Boisvert wrote:
[...]
One issue, however, is that while this should work for JavaScript code, as far as I understand the ECMA spec (feel free to double check), we may still want to know which calls really are object constructions, because if we end up calling native C/C++ code (eg: browser DOM), it may expect us to tell it what is a constructor call, as opposed to a regular function call.
I'm not sure I understand your foreign code argument, but the principle of differentiating between the two types of call sounds useful to me even for the purpose of our optimizations down the road. The approach you're proposing sounds good to me.
The current solutions I have in mind are either:
- Keep the construct instruction separate from call, but have it take
an explicit this pointer, just like call.
- Get rid of the construct instruction, and instead have a flag (eg:
isConstruct) on the call instruction.
I'm personally more in favor of the first one, because it avoids special-casing the call instruction in various places. Which one would you guys vote for?
#1 also gets my vote, and mostly for the same reason.
Bruno