Index: src/parsing/parsing.cc |
diff --git a/src/parsing/parsing.cc b/src/parsing/parsing.cc |
index db07bde7c7a77977727ceb7909a7ade54fcdcaf4..ede13ac9953ec069f0053404a9612ffbc13d66c0 100644 |
--- a/src/parsing/parsing.cc |
+++ b/src/parsing/parsing.cc |
@@ -15,7 +15,7 @@ namespace v8 { |
namespace internal { |
namespace parsing { |
-bool ParseProgram(ParseInfo* info) { |
+bool ParseProgram(ParseInfo* info, bool internalize) { |
DCHECK(info->is_toplevel()); |
DCHECK_NULL(info->literal()); |
@@ -29,14 +29,19 @@ bool ParseProgram(ParseInfo* info) { |
parser.SetCachedData(info); |
result = parser.ParseProgram(isolate, info); |
info->set_literal(result); |
- parser.Internalize(isolate, info->script(), result == nullptr); |
- if (result != nullptr) { |
+ if (result == nullptr) { |
+ parser.ReportErrors(isolate, info->script()); |
+ } else { |
info->set_language_mode(info->literal()->language_mode()); |
} |
+ parser.UpdateStatistics(isolate, info->script()); |
+ if (internalize) { |
+ info->ast_value_factory()->Internalize(isolate); |
+ } |
return (result != nullptr); |
} |
-bool ParseFunction(ParseInfo* info) { |
+bool ParseFunction(ParseInfo* info, bool internalize) { |
DCHECK(!info->is_toplevel()); |
DCHECK_NULL(info->literal()); |
@@ -49,12 +54,19 @@ bool ParseFunction(ParseInfo* info) { |
result = parser.ParseFunction(isolate, info); |
info->set_literal(result); |
- parser.Internalize(isolate, info->script(), result == nullptr); |
+ if (result == nullptr) { |
+ parser.ReportErrors(isolate, info->script()); |
+ } |
+ parser.UpdateStatistics(isolate, info->script()); |
+ if (internalize) { |
+ info->ast_value_factory()->Internalize(isolate); |
+ } |
return (result != nullptr); |
} |
-bool ParseAny(ParseInfo* info) { |
- return info->is_toplevel() ? ParseProgram(info) : ParseFunction(info); |
+bool ParseAny(ParseInfo* info, bool internalize) { |
+ return info->is_toplevel() ? ParseProgram(info, internalize) |
+ : ParseFunction(info, internalize); |
} |
} // namespace parsing |