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

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: main thread check 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/compiler.cc ('k') | src/parser.cc » ('j') | no next file with comments »
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 c1b0361980d23bdc4c3de4bf2134210e4940abcf..87077479af0c0e73673677f538dce5af6754a0d1 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -647,14 +647,14 @@ class Parser : public ParserBase<ParserTraits> {
// Parses the source code represented by the compilation info and sets its
// function literal. Returns false (and deallocates any allocated AST
// nodes) if parsing failed.
- static bool Parse(CompilationInfo* info, bool allow_lazy = false);
- bool Parse();
- void ParseOnBackground();
+ static bool ParseStatic(CompilationInfo* info, bool allow_lazy = false);
+ bool Parse(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;
@@ -681,31 +681,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)
@@ -841,7 +838,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);
@@ -855,9 +852,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.
@@ -873,6 +870,8 @@ class Parser : public ParserBase<ParserTraits> {
int use_counts_[v8::Isolate::kUseCounterFeatureCount];
int total_preparse_skipped_;
HistogramTimer* pre_parse_timer_;
+
+ bool parsing_on_main_thread_;
};
« no previous file with comments | « src/compiler.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698