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

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: rebased 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 19036e7739787108d49a4b3a6d215ab5aa17a0aa..1fd7e2ed6551785943fdc92dcd67400dd4120f8e 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -655,26 +655,25 @@ 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) {
+ static bool ParseStatic(CompilationInfo* info, bool allow_lazy = false) {
ParseInfo parse_info = {info->isolate()->stack_guard()->real_climit(),
info->isolate()->heap()->HashSeed(),
info->isolate()->unicode_cache()};
Parser parser(info, &parse_info);
parser.set_allow_lazy(allow_lazy);
- if (parser.Parse()) {
+ if (parser.Parse(info)) {
info->SetLanguageMode(info->function()->language_mode());
return true;
}
return false;
}
- bool Parse();
- void ParseOnBackground();
+ bool Parse(CompilationInfo* info);
titzer 2015/02/12 10:06:34 What about renaming this ParseSynchronous() and th
+ 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 +700,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 +855,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 +869,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/compiler.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698