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

Unified Diff: src/parser.h

Issue 908173003: Parsing: Make Parser not know about Isolate during background parsing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/background-parsing-task.cc ('k') | src/parser.cc » ('j') | src/parser.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.h
diff --git a/src/parser.h b/src/parser.h
index 19036e7739787108d49a4b3a6d215ab5aa17a0aa..5487abd00eee5a644ec32d2e632ef1203fc2aa2f 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -662,19 +662,19 @@ class Parser : public ParserBase<ParserTraits> {
info->isolate()->unicode_cache()};
Parser parser(info, &parse_info);
parser.set_allow_lazy(allow_lazy);
- if (parser.Parse()) {
+ if (parser.ParseOnMainThread(info)) {
info->SetLanguageMode(info->function()->language_mode());
return true;
}
return false;
}
- bool Parse();
- void ParseOnBackground();
+ bool ParseOnMainThread(CompilationInfo* info);
+ void ParseOnBackground(CompilationInfo* info);
// Handle errors detected during parsing, move statistics to Isolate,
// internalize strings (move them to the heap).
- void Internalize();
- void HandleSourceURLComments();
+ void Internalize(CompilationInfo* info);
+ void HandleSourceURLComments(CompilationInfo* info);
private:
friend class ParserTraits;
@@ -701,31 +701,28 @@ class Parser : public ParserBase<ParserTraits> {
};
// Returns NULL if parsing failed.
- FunctionLiteral* ParseProgram();
+ FunctionLiteral* ParseProgram(CompilationInfo* info);
- FunctionLiteral* ParseLazy();
- FunctionLiteral* ParseLazy(Utf16CharacterStream* source);
-
- Isolate* isolate() { return info_->isolate(); }
- CompilationInfo* info() const { return info_; }
- Handle<Script> script() const { return info_->script(); }
+ FunctionLiteral* ParseLazy(CompilationInfo* info);
+ FunctionLiteral* ParseLazy(CompilationInfo* info,
+ Utf16CharacterStream* source);
// Called by ParseProgram after setting up the scanner.
FunctionLiteral* DoParseProgram(CompilationInfo* info, Scope** scope,
Scope** ad_hoc_eval_scope);
- void SetCachedData();
+ void SetCachedData(CompilationInfo* info);
bool inside_with() const { return scope_->inside_with(); }
ScriptCompiler::CompileOptions compile_options() const {
- return info_->compile_options();
+ return compile_options_;
}
bool consume_cached_parse_data() const {
- return compile_options() == ScriptCompiler::kConsumeParserCache &&
+ return compile_options_ == ScriptCompiler::kConsumeParserCache &&
cached_parse_data_ != NULL;
}
bool produce_cached_parse_data() const {
- return compile_options() == ScriptCompiler::kProduceParserCache;
+ return compile_options_ == ScriptCompiler::kProduceParserCache;
}
Scope* DeclarationScope(VariableMode mode) {
return IsLexicalVariableMode(mode)
@@ -859,7 +856,7 @@ class Parser : public ParserBase<ParserTraits> {
const AstRawString* function_name, int pos, Variable* fvar,
Token::Value fvar_init_op, FunctionKind kind, bool* ok);
- void ThrowPendingError();
+ void ThrowPendingError(Isolate* isolate, Handle<Script> script);
TemplateLiteralState OpenTemplateLiteral(int pos);
void AddTemplateSpan(TemplateLiteralState* state, bool tail);
@@ -873,9 +870,9 @@ class Parser : public ParserBase<ParserTraits> {
PreParser* reusable_preparser_;
Scope* original_scope_; // for ES5 function declarations in sloppy eval
Target* target_stack_; // for break, continue statements
+ ScriptCompiler::CompileOptions compile_options_;
ParseData* cached_parse_data_;
- CompilationInfo* info_;
bool parsing_lazy_arrow_parameters_; // for lazily parsed arrow functions.
// Pending errors.
« no previous file with comments | « src/background-parsing-task.cc ('k') | src/parser.cc » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698