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

Unified Diff: src/runtime.cc

Issue 1933: Generalized the EvalCache into a CompilationCache and enabled... (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
Index: src/runtime.cc
===================================================================
--- src/runtime.cc (revision 268)
+++ src/runtime.cc (working copy)
@@ -3364,6 +3364,7 @@
static Object* Runtime_CompileString(Arguments args) {
HandleScope scope;
ASSERT(args.length() == 2);
+ CONVERT_ARG_CHECKED(String, source, 0);
bool contextual = args[1]->IsTrue();
RUNTIME_ASSERT(contextual || args[1]->IsFalse());
@@ -3380,27 +3381,12 @@
context = Handle<Context>(Top::context()->global_context());
}
- // Compile eval() source.
- bool is_global_context = context->IsGlobalContext();
- Handle<String> source(String::cast(args[0]));
- Object* obj = Heap::LookupEvalCache(is_global_context, *source);
- if (obj->IsFailure()) return obj;
- Handle<JSFunction> boilerplate;
- if (!obj->IsJSFunction()) {
- Counters::eval_cache_misses.Increment();
- boilerplate = Compiler::CompileEval(is_global_context, source);
- if (boilerplate.is_null()) return Failure::Exception();
-
- Object* obj =
- Heap::PutInEvalCache(is_global_context, *source, *boilerplate);
- if (obj->IsFailure()) return obj;
-
- } else {
- Counters::eval_cache_hits.Increment();
- boilerplate = Handle<JSFunction>(JSFunction::cast(obj));
- }
-
+ // Compile source string.
+ bool is_global = context->IsGlobalContext();
+ Handle<JSFunction> boilerplate =
+ Compiler::CompileEval(is_global, source);
+ if (boilerplate.is_null()) return Failure::Exception();
Handle<JSFunction> fun =
Factory::NewFunctionFromBoilerplate(boilerplate, context);
return *fun;
« src/compilation-cache.h ('K') | « src/objects-inl.h ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698