Okay. The error stack being constructed that early is odd, though. On Wed, Jan 11, 2017, 10:39 Boris Zbarsky <[email protected]> wrote:
> On 1/11/17 6:43 AM, Isiah Meadows wrote: > > Not if it's (likely) throwing from the `new Error`. > > It's not. The "stack" property in V8 quacks like a value property for > the most part, but the first access to it invokes some code that does > the (lazy) stack string construction. That process involves calling > Error.prepareStackTrace if such a thing exists. > > Specifically, as of today, see > > https://github.com/v8/v8/blob/d5a0860e87b5f8d88432cf628f4bbc0cc922317f/src/messages.cc#L927-L954 > which is called from > > https://github.com/v8/v8/blob/d5a0860e87b5f8d88432cf628f4bbc0cc922317f/src/accessors.cc#L1169 > > The whole setup is basically designed to have things that look like data > properties but actually involve executing code to compute the property > value (and possibly executing code when the "value" property is set). > > SpiderMonkey has similar things as well, though we've been getting rid > of them as much as possible. The obvious one that remains is .length on > Array objects. This allows Array objects to be non-exotic for practical > purposes in terms of their engine representation, and hence not suffer > the performance penalties exotic objects suffer. In spec terms, of > course, Array instances are just exotic objects. In an ideal world, the > implementation detail is just that and is not observable.... > > -Boris > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

