Jakob, here is a reproducible example (
https://github.com/hulbert/bookshelf-sample-v8). I’m running this with node
5.6.0 on OS X (10.10.4).
git clone [email protected]:hulbert/bookshelf-sample-v8.git
npm install
node --trace-opt index.js | grep ‘getVirtuals'
outputs:
[marking 0x185d96391a91 <JS Function getVirtuals (SharedFunctionInfo
0x185d96347581)> for recompilation, reason: small function, ICs with
typeinfo: 2/4 (50%), generic ICs: 0/4 (0%)]
[compiling method 0x185d96391a91 <JS Function getVirtuals
(SharedFunctionInfo 0x185d96347581)> using Crankshaft]
[aborted optimizing 0x185d96391a91 <JS Function getVirtuals
(SharedFunctionInfo 0x185d96347581)> because: Unsupported phi use of const
variable]
[disabled optimization for 0x185d96347581 <SharedFunctionInfo
getVirtuals>, reason: Unsupported phi use of const variable]
> Also, is this actually a performance problem for you? Crankshaft aborts
compilation in some cases by design, often there's no need to worry about
it.
This code is part of serialization in a web app and we’re trying to eek
some extra performance out of it when serializing really large numbers of
objects populated by an ORM. There are a couple other cases like this (for
example I believe `_toJSON` in my example isn’t optimized because of the
same issue), but `getVirtuals` is the most isolated case IMO.
I am also hoping to get a better understanding of the "Unsupported phi use
of const variable” reason as there is very little information about it
available on the web. I’d like to contribute details to the list of V8
bailout reasons (https://github.com/vhf/v8-bailout-reasons).
Thanks,
Scott Hulbert
On Mon, Feb 29, 2016 at 4:23 AM, Jakob Kummerow <[email protected]>
wrote:
> This is indeed surprising.
> Crankshaft predates ES6, so this has nothing to do with ES6 const. That
> said, I don't see why this function would bail out; and in a quick repro
> attempt it doesn't. Do you have an example I can run that reproduces this
> behavior?
>
> Also, is this actually a performance problem for you? Crankshaft aborts
> compilation in some cases by design, often there's no need to worry about
> it.
>
> On Mon, Feb 29, 2016 at 9:30 AM, Scott Hulbert <[email protected]>
> wrote:
>
>> I am seeing lines such as:
>>
>> [compiling method 0x39790c6f2379 <JS Function getVirtuals
>> (SharedFunctionInfo 0x2e54cd11ffa9)> using Crankshaft]
>> [aborted optimizing 0x39790c6f2379 <JS Function getVirtuals
>> (SharedFunctionInfo 0x2e54cd11ffa9)> because: Unsupported phi use of const
>> variable]
>>
>> In spite of this code not using `const` declarations (nor the method that
>> invokes it). I even tried replacing `const` with `var` in all
>> `node_modules` files on a smaller project and saw the same issue.
>>
>> This leads me to believe the explanation is inaccurate and the aborted
>> optimization is not directly related to use of ES6 const?
>>
>> Here's the above function that won't optimize, though it's technically
>> already copied into our codebase and I've tried rewriting it a few
>> different ways:
>> https://github.com/tgriesser/bookshelf/blob/ca08ec0850f758ec5610e3c543db5a276026624e/plugins/virtuals.js#L92-L100
>>
>> Thanks,
>>
>> Scott Hulbert
>>
>> --
>> --
>> v8-users mailing list
>> [email protected]
>> http://groups.google.com/group/v8-users
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "v8-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/v8-users/hsUrt4I2D98/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.