Help about v8 inline cache

77 views
Skip to first unread message

Deguo Meng

unread,
Nov 26, 2014, 8:11:18 AM11/26/14
to v8-u...@googlegroups.com
Hello ,
      Could anybody help me to explain the difference between  "Uninitialized" state & "Pre-monomorphic" state. I get a description as following :
  "
  1. Uninitialized: this is a generic stub.

    We're in this state when we've never seen any object at a property access site (which is just another way of saying: when this particular property access at this particular code location has never been exercised). This stub does a dynamic lookup; once that lookup is complete, this stub rewrites the call to the inline cache stub to be a call to a different stub, the pre-monomorphic one.

  2. Pre-monomorphic: this is a generic stub.

    This also performs a run-time lookup then rewrites the call to be to a different stub: a customized monomorphic one, which is written just in time. Why even bother with this state? Because in JS, lots of code is executed exactly once (setup, initialization). Don't want to go to the trouble of generating customized, optimized code (the monomorphic stub) for a property access if it only occurs once.
"

 "Uninitialized" do a dynamic look up & "Pre-monomorphic" do run-time lookup ? what's the difference ?  Could any body show some detailed information ?


BR 
Big thanks 

Ben Noordhuis

unread,
Nov 26, 2014, 9:31:02 AM11/26/14
to v8-u...@googlegroups.com
I don't believe there is a difference, they both do dynamic lookups.

This may have changed with the addition of TurboFan but in older V8
versions, the same code stub is used for uninitialized and
pre-monomorphic ICs. The pre-monomorphic case is simply to avoid
creating a "heavyweight" IC for code that executes only once because
that would be pointless.
Reply all
Reply to author
Forward
0 new messages