aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/compilation-cache.cc
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-09-08 17:14:42 -0700
committerRyan Dahl <ry@tinyclouds.org>2010-09-08 17:14:42 -0700
commit8796ed22783bbbb9d286463e27db275325106fed (patch)
treec4d13c9a6dc9196925489392ffe589f4d43d8939 /deps/v8/src/compilation-cache.cc
parent512016fd7441d8919c29f369a38622ab1dd01942 (diff)
downloadandroid-node-v8-8796ed22783bbbb9d286463e27db275325106fed.tar.gz
android-node-v8-8796ed22783bbbb9d286463e27db275325106fed.tar.bz2
android-node-v8-8796ed22783bbbb9d286463e27db275325106fed.zip
Upgrade V8 to 2.4.2
Diffstat (limited to 'deps/v8/src/compilation-cache.cc')
-rw-r--r--deps/v8/src/compilation-cache.cc45
1 files changed, 17 insertions, 28 deletions
diff --git a/deps/v8/src/compilation-cache.cc b/deps/v8/src/compilation-cache.cc
index 14252a5892..7402e6857d 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);
}
}