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

Unified Diff: src/compilation-cache.cc

Issue 1939: Fix issue 65 by making sure not to leak any of the cache... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 3 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 | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698