Every time you write obj.x you get a new inline cache. The IC in test is used twice, and so can transition further from 0 through . to 1. The other 2 are used only once and hence only get to . from 0.
Iirc for global references within the same straight-line code we reuse the cache, which is why the load for test and obj themselves do manage to get to 1 even though they are supposedly independent loads. Regards, Toon On Mon, Jan 18, 2016, 03:03 Yong Wang <[email protected]> wrote: > Hi v8-dev, > I test some code like that: > > function test(obj) > { > return obj.x; > } > > var obj = {x:1}; > test(obj); > test(obj); > > obj.x; > obj.x; > > and add --trace-ic, v8 output inline log: > > [LoadIC in ~+116 at test.js:7 (0->.) #test] > [LoadIC in ~+140 at test.js:7 (0->.) #obj] > [LoadIC in ~test+38 at test.js:3 (0->.) #x] > [LoadIC in ~+179 at test.js:8 (.->1) #test] > [LoadIC in ~+203 at test.js:8 (.->1) #obj] > [LoadIC in ~test+38 at test.js:3 (.->1) #x] > [LoadIC in ~+259 at test.js:10 (0->.) #x] > [LoadIC in ~+294 at test.js:11 (0->.) #x] > > it seems that direct call 'obj.x', inline stat always is '0'. > but in function test, it will change to (0->.->1); > > so what's different between this? > > Thanks in advance. > > > > -- > -- > 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 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.
