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

Unified Diff: src/compiler.cc

Issue 181543003: Proof of concept: API for doing only one parsing pass instead of first preparsing and then parsing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased -- this applies to r19832 Created 6 years, 9 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/compiler.h ('k') | src/parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 21f107a7750af0daadf95ccd4465002f77d20406..bb6ce2bdca828b02ea95f918ce9d57912503f1c8 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -115,7 +115,7 @@ void CompilationInfo::Initialize(Isolate* isolate,
scope_ = NULL;
global_scope_ = NULL;
extension_ = NULL;
- pre_parse_data_ = NULL;
+ cached_data_ = NULL;
zone_ = zone;
deferred_handles_ = NULL;
code_stub_ = NULL;
@@ -807,15 +807,18 @@ static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
ASSERT(info->is_eval() || info->is_global());
bool parse_allow_lazy =
- (info->pre_parse_data() != NULL ||
+ (info->cached_data() != NULL ||
String::cast(script->source())->length() > FLAG_min_preparse_length) &&
!DebuggerWantsEagerCompilation(info);
- if (!parse_allow_lazy && info->pre_parse_data() != NULL) {
- // We are going to parse eagerly, but we have preparse data produced by lazy
- // preparsing. We cannot use it, since it won't contain all the symbols we
- // need for eager parsing.
- info->SetPreParseData(NULL);
+ if (!parse_allow_lazy && info->cached_data() != NULL) {
+ // We are going to parse eagerly, but we either 1) have cached data produced
+ // by lazy parsing or 2) are asked to generate cached data. We cannot use
+ // the existing data, since it won't contain all the symbols we need for
+ // eager parsing. In addition, it doesn't make sense to generate the data
+ // when parsing eagerly. That data would contain all symbols, but no
+ // functions, so it couldn't be used to aid lazy parsing later.
+ info->SetCachedData(NULL);
}
Handle<SharedFunctionInfo> result;
@@ -943,7 +946,7 @@ Handle<SharedFunctionInfo> Compiler::CompileScript(Handle<String> source,
bool is_shared_cross_origin,
Handle<Context> context,
v8::Extension* extension,
- ScriptDataImpl* pre_data,
+ ScriptDataImpl** cached_data,
NativesFlag natives) {
Isolate* isolate = source->GetIsolate();
int source_length = source->length();
@@ -989,7 +992,7 @@ Handle<SharedFunctionInfo> Compiler::CompileScript(Handle<String> source,
CompilationInfoWithZone info(script);
info.MarkAsGlobal();
info.SetExtension(extension);
- info.SetPreParseData(pre_data);
+ info.SetCachedData(cached_data);
info.SetContext(context);
if (FLAG_use_strict) info.SetStrictMode(STRICT);
result = CompileToplevel(&info);
« no previous file with comments | « src/compiler.h ('k') | src/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698