Hi Nathan,

> I understand chromium V8 engine compiling JS files into native code
> and then have native os executes the generated code.
> 1. Is there a lot of over head in writing the generated code to a file
> and have native os executes it?

the code is put in the JavaScript heap in a "code object".  These
objects are treated like every other piece of data in the heap.  It
does take time to write the code into the code object, but that time
is not significant to compared to the time it takes to figure out what
code to generate.

> 2. Is there a cache in chromium so that if there is a common js file
> used by different pages of same sites (e.g. some common js code done
> by a company) or different sites (e.g a common js library), chromium
> just pull the generated code from cache?

Yes, there is a compilation cache in V8 that keeps recently compiled
code alive.  In Google Chrome the cache can only be hit when you stay
within the same process.  Therefore, the cache can be hit when you
navigate by clicking links.  Navigating by typing a new URL into the
omnibox will change process which will give you a new instance of V8
with a clear cache.

> 3. If there is a cache liked that, does it shared across tabs? and/or
> does it shared across browser session (i.e. the cache is persistent in
> files?

The cache is only shared across tabs that are run in the same process.
 It is not shared across browser sessions.

-- Mads

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to