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

Unified Diff: src/compilation-cache.cc

Issue 2632003: Flushing of code from functions that we expect not to use again.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 6 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/compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compilation-cache.cc
===================================================================
--- src/compilation-cache.cc (revision 4799)
+++ src/compilation-cache.cc (working copy)
@@ -79,6 +79,8 @@
// young generation.
void Age();
+ bool HasFunction(SharedFunctionInfo* function_info);
+
// GC support.
void Iterate(ObjectVisitor* v);
@@ -204,6 +206,27 @@
}
+bool CompilationSubCache::HasFunction(SharedFunctionInfo* function_info) {
+ if (function_info->script()->IsUndefined() ||
+ Script::cast(function_info->script())->source()->IsUndefined()) {
+ return false;
+ }
+
+ String* source =
+ String::cast(Script::cast(function_info->script())->source());
+ // Check all generations.
+ for (int generation = 0; generation < generations(); generation++) {
+ if (tables_[generation]->IsUndefined()) continue;
+
+ CompilationCacheTable* table =
+ CompilationCacheTable::cast(tables_[generation]);
+ Object* object = table->Lookup(source);
+ if (object->IsSharedFunctionInfo()) return true;
+ }
+ return false;
+}
+
+
void CompilationSubCache::Age() {
// Age the generations implicitly killing off the oldest.
for (int i = generations_ - 1; i > 0; i--) {
@@ -506,6 +529,11 @@
}
+bool CompilationCache::HasFunction(SharedFunctionInfo* function_info) {
+ return script.HasFunction(function_info);
+}
+
+
void CompilationCache::Iterate(ObjectVisitor* v) {
for (int i = 0; i < kSubCacheCount; i++) {
subcaches[i]->Iterate(v);
« no previous file with comments | « src/compilation-cache.h ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698