~ubuntu-branches/ubuntu/precise/nodejs/precise

« back to all changes in this revision

Viewing changes to deps/v8/src/compilation-cache.cc

  • Committer: Bazaar Package Importer
  • Author(s): Jérémy Lal
  • Date: 2010-08-20 11:49:04 UTC
  • mfrom: (7.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100820114904-lz22w6fkth7yh179
Tags: 0.2.0-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
  // young generation.
80
80
  void Age();
81
81
 
 
82
  bool HasFunction(SharedFunctionInfo* function_info);
 
83
 
82
84
  // GC support.
83
85
  void Iterate(ObjectVisitor* v);
84
86
 
204
206
}
205
207
 
206
208
 
 
209
bool CompilationSubCache::HasFunction(SharedFunctionInfo* function_info) {
 
210
  if (function_info->script()->IsUndefined() ||
 
211
      Script::cast(function_info->script())->source()->IsUndefined()) {
 
212
    return false;
 
213
  }
 
214
 
 
215
  String* source =
 
216
      String::cast(Script::cast(function_info->script())->source());
 
217
  // Check all generations.
 
218
  for (int generation = 0; generation < generations(); generation++) {
 
219
    if (tables_[generation]->IsUndefined()) continue;
 
220
 
 
221
    CompilationCacheTable* table =
 
222
        CompilationCacheTable::cast(tables_[generation]);
 
223
    Object* object = table->Lookup(source);
 
224
    if (object->IsSharedFunctionInfo()) return true;
 
225
  }
 
226
  return false;
 
227
}
 
228
 
 
229
 
207
230
void CompilationSubCache::Age() {
208
231
  // Age the generations implicitly killing off the oldest.
209
232
  for (int i = generations_ - 1; i > 0; i--) {
506
529
}
507
530
 
508
531
 
 
532
bool CompilationCache::HasFunction(SharedFunctionInfo* function_info) {
 
533
  return script.HasFunction(function_info);
 
534
}
 
535
 
 
536
 
509
537
void CompilationCache::Iterate(ObjectVisitor* v) {
510
538
  for (int i = 0; i < kSubCacheCount; i++) {
511
539
    subcaches[i]->Iterate(v);