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

Unified Diff: src/compilation-cache.cc

Issue 28027: Speed up access to global variables from eval scopes. Traverse the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 10 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
Index: src/compilation-cache.cc
===================================================================
--- src/compilation-cache.cc (revision 1344)
+++ src/compilation-cache.cc (working copy)
@@ -102,6 +102,25 @@
}
+static Handle<JSFunction> Lookup(Handle<String> source,
+ Handle<Context> context,
+ CompilationCache::Entry entry) {
+ // 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->LookupEval(*source, *context);
+ }
+ if (result->IsJSFunction()) {
+ return Handle<JSFunction>(JSFunction::cast(result));
+ } else {
+ return Handle<JSFunction>::null();
+ }
+}
+
+
Handle<JSFunction> CompilationCache::LookupScript(Handle<String> source,
Handle<Object> name,
int line_offset,
@@ -120,9 +139,10 @@
Handle<JSFunction> CompilationCache::LookupEval(Handle<String> source,
+ Handle<Context> context,
Entry entry) {
ASSERT(entry == EVAL_GLOBAL || entry == EVAL_CONTEXTUAL);
- Handle<JSFunction> result = Lookup(source, entry);
+ Handle<JSFunction> result = Lookup(source, context, entry);
if (result.is_null()) {
Counters::compilation_cache_misses.Increment();
} else {
@@ -142,6 +162,17 @@
}
+void CompilationCache::PutEvalFunction(Handle<String> source,
+ Handle<Context> context,
+ Entry entry,
+ Handle<JSFunction> boilerplate) {
+ HandleScope scope;
+ ASSERT(boilerplate->IsBoilerplate());
+ Handle<CompilationCacheTable> table = GetTable(entry);
+ CALL_HEAP_FUNCTION_VOID(table->PutEval(*source, *context, *boilerplate));
+}
+
+
Handle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source,
JSRegExp::Flags flags) {
Handle<CompilationCacheTable> table = GetTable(REGEXP);

Powered by Google App Engine
This is Rietveld 408576698