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

Unified Diff: src/compilation-cache.cc

Issue 3135026: Merge flush code phase into marking phase. (Closed)
Patch Set: returned checked casts Created 10 years, 4 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
diff --git a/src/compilation-cache.cc b/src/compilation-cache.cc
index 14252a589262640cc15f58b938e40062d84205e9..7402e6857d756cd04d1f53247eb27886a1b361a0 100644
--- a/src/compilation-cache.cc
+++ b/src/compilation-cache.cc
@@ -79,10 +79,9 @@ class CompilationSubCache {
// young generation.
void Age();
- bool HasFunction(SharedFunctionInfo* function_info);
-
// GC support.
void Iterate(ObjectVisitor* v);
+ void IterateFunctions(ObjectVisitor* v);
// Clear this sub-cache evicting all its content.
void Clear();
@@ -206,27 +205,6 @@ Handle<CompilationCacheTable> CompilationSubCache::GetTable(int generation) {
}
-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--) {
@@ -238,6 +216,16 @@ void CompilationSubCache::Age() {
}
+void CompilationSubCache::IterateFunctions(ObjectVisitor* v) {
+ Object* undefined = Heap::raw_unchecked_undefined_value();
+ for (int i = 0; i < generations_; i++) {
+ if (tables_[i] != undefined) {
+ reinterpret_cast<CompilationCacheTable*>(tables_[i])->IterateElements(v);
+ }
+ }
+}
+
+
void CompilationSubCache::Iterate(ObjectVisitor* v) {
v->VisitPointers(&tables_[0], &tables_[generations_]);
}
@@ -528,15 +516,16 @@ void CompilationCache::Clear() {
}
}
-
-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);
+ }
}
-void CompilationCache::Iterate(ObjectVisitor* v) {
+void CompilationCache::IterateFunctions(ObjectVisitor* v) {
for (int i = 0; i < kSubCacheCount; i++) {
- subcaches[i]->Iterate(v);
+ subcaches[i]->IterateFunctions(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