diff options
Diffstat (limited to 'deps/v8/src/compilation-cache.cc')
-rw-r--r-- | deps/v8/src/compilation-cache.cc | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/deps/v8/src/compilation-cache.cc b/deps/v8/src/compilation-cache.cc index 14252a589..7402e6857 100644 --- a/deps/v8/src/compilation-cache.cc +++ b/deps/v8/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); } } |