Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Issue 457: Added a EvalCache that caches eval'ed scripts and compiled function boilerpla... (Closed)

Created:
12 years, 3 months ago by Feng Qian
Modified:
9 years, 7 months ago
Reviewers:
Kasper Lund
CC:
v8-dev
Visibility:
Public.

Description

Added a EvalCache that caches eval'ed scripts and compiled function boilerplate. The cache is a hashtable that takes String as key and JSFunction as the value. Caches are cleared before mark-compact GC's. Currently I don't put caps on cache size, string size, etc. This cuts date-parse-totfe.js runtime by half. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=173

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+182 lines, -51 lines) Patch
M src/heap.h View 4 chunks +26 lines, -2 lines 6 comments Download
M src/heap.cc View 3 chunks +36 lines, -0 lines 0 comments Download
M src/objects.h View 9 chunks +43 lines, -29 lines 2 comments Download
M src/objects.cc View 11 chunks +48 lines, -17 lines 0 comments Download
M src/objects-inl.h View 2 chunks +8 lines, -0 lines 0 comments Download
M src/runtime.cc View 1 chunk +19 lines, -3 lines 2 comments Download
M src/v8-counters.h View 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Feng Qian
My old client with this change was lost due to svn update. I decide to ...
12 years, 3 months ago (2008-09-05 00:13:06 UTC) #1
Kasper Lund
This looks great. I think you should refactor it a bit and introduce a new ...
12 years, 3 months ago (2008-09-05 09:16:29 UTC) #2
Feng Qian
12 years, 3 months ago (2008-09-09 03:42:50 UTC) #3
http://codereview.chromium.org/457/diff/1/8
File src/heap.h (right):

http://codereview.chromium.org/457/diff/1/8#newcode538
Line 538: // EvalCache caches function boilerplates for compiled scripts
On 2008/09/05 09:16:29, Kasper Lund wrote:
> I would move this code out into a separate class with static operations;
> something like CompilationCache maybe?

Let's do that in our next step. Also I'd like to see the cache performance for
whole compilation.
Another thing is that we might be able to use 1 element cache since the cached
function has source code already.
Also we may want to cache shared function info instead of the function.

http://codereview.chromium.org/457/diff/1/8#newcode544
Line 544: // Caches are cleared before mark-compact GC's.
On 2008/09/05 09:16:29, Kasper Lund wrote:
> Isn't this really for all mark-sweep GCs - not just the compacting ones?
Both, but since we use the same name Heap::MarkCompact. I probably should say
'global GC'.

http://codereview.chromium.org/457/diff/1/8#newcode557
Line 557: static Object* PutInEvalCache(bool is_global_context,
On 2008/09/05 09:16:29, Kasper Lund wrote:
> Indentation of the arguments should align them below each other.

Done.

http://codereview.chromium.org/457/diff/1/5
File src/objects.h (right):

http://codereview.chromium.org/457/diff/1/5#newcode1821
Line 1821: // EvalCache for caching eval'ed string and function.
On 2008/09/05 09:16:29, Kasper Lund wrote:
> Rename to CompilationCacheTable?

Done.

http://codereview.chromium.org/457/diff/1/4
File src/runtime.cc (right):

http://codereview.chromium.org/457/diff/1/4#newcode3331
Line 3331: bool is_global_context = context->IsGlobalContext();
On 2008/09/05 09:16:29, Kasper Lund wrote:
> I think you should move this code to the Compiler and use it for scripts too.
It
> would be nice to be able to just put it in compiler.cc:MakeFunction but that
may
> be a little to late because the Compile, CompileLazy, CompileEval functions
> build script data structures and may do pre-parsing which should be avoided
too.
> You probably have to refactor it a bit.

Done.

Powered by Google App Engine
This is Rietveld 408576698