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

Unified Diff: src/parsing/parser.cc

Issue 2220463002: Hook up compiler dispatcher jobs to lazy parser. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 years, 4 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/parsing/parser.h ('k') | test/unittests/compiler-dispatcher/compiler-dispatcher-job-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index ecdcad4d3d56de1fba041b55ff1f28d73dc342bd..3876c7f7ed94753ca63bb4b0a95c02bcd172dde0 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -58,6 +58,7 @@ ParseInfo::ParseInfo(Zone* zone)
isolate_(nullptr),
cached_data_(nullptr),
ast_value_factory_(nullptr),
+ function_name_(nullptr),
literal_(nullptr) {}
ParseInfo::ParseInfo(Zone* zone, Handle<JSFunction> function)
@@ -1120,8 +1121,8 @@ FunctionLiteral* Parser::ParseLazy(Isolate* isolate, ParseInfo* info) {
source, shared_info->start_position(), shared_info->end_position()));
}
Handle<String> name(String::cast(shared_info->name()));
- result = DoParseLazy(isolate, info, ast_value_factory()->GetString(name),
- stream.get());
+ result =
+ DoParseLazy(info, ast_value_factory()->GetString(name), stream.get());
if (result != nullptr) {
Handle<String> inferred_name(shared_info->inferred_name());
result->set_inferred_name(inferred_name);
@@ -1148,7 +1149,7 @@ static FunctionLiteral::FunctionType ComputeFunctionType(ParseInfo* info) {
return FunctionLiteral::kAnonymousExpression;
}
-FunctionLiteral* Parser::DoParseLazy(Isolate* isolate, ParseInfo* info,
+FunctionLiteral* Parser::DoParseLazy(ParseInfo* info,
const AstRawString* raw_name,
Utf16CharacterStream* source) {
scanner_.Initialize(source);
@@ -5520,7 +5521,6 @@ void Parser::ParseOnBackground(ParseInfo* info) {
DCHECK(info->literal() == NULL);
FunctionLiteral* result = NULL;
- fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone());
CompleteParserRecorder recorder;
if (produce_cached_parse_data()) log_ = &recorder;
@@ -5536,7 +5536,6 @@ void Parser::ParseOnBackground(ParseInfo* info) {
info->source_stream_encoding()));
stream_ptr = stream.get();
}
- scanner_.Initialize(stream_ptr);
DCHECK(info->context().is_null() || info->context()->IsNativeContext());
DCHECK(original_scope_);
@@ -5547,7 +5546,13 @@ void Parser::ParseOnBackground(ParseInfo* info) {
// don't). We work around this by storing all the scopes which need their end
// position set at the end of the script (the top scope and possible eval
// scopes) and set their end position after we know the script length.
- result = DoParseProgram(info);
+ if (info->is_lazy()) {
+ result = DoParseLazy(info, info->function_name(), stream_ptr);
+ } else {
+ fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone());
+ scanner_.Initialize(stream_ptr);
+ result = DoParseProgram(info);
+ }
info->set_literal(result);
« no previous file with comments | « src/parsing/parser.h ('k') | test/unittests/compiler-dispatcher/compiler-dispatcher-job-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698