Index: src/compilation-cache.cc |
=================================================================== |
--- src/compilation-cache.cc (revision 276) |
+++ src/compilation-cache.cc (working copy) |
@@ -86,8 +86,14 @@ |
static Handle<JSFunction> Lookup(Handle<String> source, |
CompilationCache::Entry entry) { |
- Handle<CompilationCacheTable> table = GetTable(entry); |
- Object* result = table->Lookup(*source); |
+ // Make sure not to leak the table into the surrounding handle |
+ // scope. Otherwise, we risk keeping old tables around even after |
+ // having cleared the cache. |
+ Object* result; |
+ { HandleScope scope; |
+ Handle<CompilationCacheTable> table = GetTable(entry); |
+ result = table->Lookup(*source); |
+ } |
if (result->IsJSFunction()) { |
return Handle<JSFunction>(JSFunction::cast(result)); |
} else { |
@@ -129,6 +135,7 @@ |
void CompilationCache::Associate(Handle<String> source, |
Entry entry, |
Handle<JSFunction> boilerplate) { |
+ HandleScope scope; |
ASSERT(boilerplate->IsBoilerplate()); |
Handle<CompilationCacheTable> table = GetTable(entry); |
CALL_HEAP_FUNCTION_VOID(table->Put(*source, *boilerplate)); |