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

Unified Diff: src/compiler.cc

Issue 10990076: Short term JSON eval cache Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 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 | « src/compilation-cache.cc ('k') | src/flag-definitions.h » ('j') | src/v8.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
===================================================================
--- src/compiler.cc (revision 12582)
+++ src/compiler.cc (working copy)
@@ -425,6 +425,17 @@
#endif
+static bool IsCacheableJSONEval(FunctionLiteral* function) {
+ if (!FLAG_json_eval_cache ||
+ function->body()->length() != 1)
+ return false;
+ ExpressionStatement* body = function->body()->at(0)->AsExpressionStatement();
+ if (body == NULL) return false;
+ bool is_json = CompileTimeValue::IsCompileTimeValue(body->expression());
+ return is_json;
+}
+
+
static Handle<SharedFunctionInfo> MakeFunctionInfo(CompilationInfo* info) {
Isolate* isolate = info->isolate();
ZoneScope zone_scope(info->zone(), DELETE_ON_EXIT);
@@ -467,6 +478,7 @@
if (!ParserApi::Parse(info, flags)) {
return Handle<SharedFunctionInfo>::null();
}
+ bool is_json_eval = info->is_eval() && IsCacheableJSONEval(info->function());
// Measure how long it takes to do the compilation; only take the
// rest of the function into account to avoid overlap with the
@@ -492,6 +504,9 @@
lit->materialized_literal_count(),
info->code(),
ScopeInfo::Create(info->scope(), info->zone()));
+ if (is_json_eval) {
+ result->set_is_json_eval(true);
+ }
ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position());
Compiler::SetFunctionInfo(result, lit, true, script);
« no previous file with comments | « src/compilation-cache.cc ('k') | src/flag-definitions.h » ('j') | src/v8.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698