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

Unified Diff: src/compilation-cache.cc

Issue 675013004: Changing the aging mechanism for script and eval caches. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compilation-cache.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compilation-cache.cc
diff --git a/src/compilation-cache.cc b/src/compilation-cache.cc
index aab2fe5b2e0a5f48e3c9caf60c671fe0ee111939..6c9f95a9854a30cbd842346b41965722e2651455 100644
--- a/src/compilation-cache.cc
+++ b/src/compilation-cache.cc
@@ -13,11 +13,6 @@ namespace internal {
// The number of generations for each sub cache.
-// The number of ScriptGenerations is carefully chosen based on histograms.
-// See issue 458: http://code.google.com/p/v8/issues/detail?id=458
-static const int kScriptGenerations = 5;
-static const int kEvalGlobalGenerations = 2;
-static const int kEvalContextualGenerations = 2;
static const int kRegExpGenerations = 2;
// Initial size of each compilation cache table allocated.
@@ -26,9 +21,9 @@ static const int kInitialCacheSize = 64;
CompilationCache::CompilationCache(Isolate* isolate)
: isolate_(isolate),
- script_(isolate, kScriptGenerations),
- eval_global_(isolate, kEvalGlobalGenerations),
- eval_contextual_(isolate, kEvalContextualGenerations),
+ script_(isolate, 1),
+ eval_global_(isolate, 1),
+ eval_contextual_(isolate, 1),
reg_exp_(isolate, kRegExpGenerations),
enabled_(true) {
CompilationSubCache* subcaches[kSubCacheCount] =
@@ -58,6 +53,14 @@ Handle<CompilationCacheTable> CompilationSubCache::GetTable(int generation) {
void CompilationSubCache::Age() {
+ // Don't directly age single-generation caches.
+ if (generations_ == 1) {
+ if (tables_[0] != isolate()->heap()->undefined_value()) {
+ CompilationCacheTable::cast(tables_[0])->Age();
+ }
+ return;
+ }
+
// Age the generations implicitly killing off the oldest.
for (int i = generations_ - 1; i > 0; i--) {
tables_[i] = tables_[i - 1];
@@ -102,9 +105,7 @@ void CompilationSubCache::Remove(Handle<SharedFunctionInfo> function_info) {
CompilationCacheScript::CompilationCacheScript(Isolate* isolate,
int generations)
- : CompilationSubCache(isolate, generations),
- script_histogram_(NULL),
- script_histogram_initialized_(false) { }
+ : CompilationSubCache(isolate, generations) {}
// We only re-use a cached function for some script source code if the
@@ -173,20 +174,6 @@ Handle<SharedFunctionInfo> CompilationCacheScript::Lookup(
}
}
- if (!script_histogram_initialized_) {
- script_histogram_ = isolate()->stats_table()->CreateHistogram(
- "V8.ScriptCache",
- 0,
- kScriptGenerations,
- kScriptGenerations + 1);
- script_histogram_initialized_ = true;
- }
-
- if (script_histogram_ != NULL) {
- // The level NUMBER_OF_SCRIPT_GENERATIONS is equivalent to a cache miss.
- isolate()->stats_table()->AddHistogramSample(script_histogram_, generation);
- }
-
// Once outside the manacles of the handle scope, we need to recheck
// to see if we actually found a cached script. If so, we return a
// handle created in the caller's handle scope.
« no previous file with comments | « src/compilation-cache.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698