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

Unified Diff: src/parser.h

Issue 527763002: Refactor Parser to make it usable on a background thread. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: whitespace Created 6 years, 3 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 | « no previous file | 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 e2ccd0370b75f684dbc2a58fba8763c0f7295473..c975471eccf8ef67bb5d835860336e3bdd53b8cb 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -597,7 +597,16 @@ class ParserTraits {
class Parser : public ParserBase<ParserTraits> {
public:
- explicit Parser(CompilationInfo* info);
+ // Note that the hash seed in ParseInfo must be the hash seed from the
+ // Isolate's heap, otherwise the heap will be in an inconsistent state once
+ // the strings created by the Parser are internalized.
+ struct ParseInfo {
+ uintptr_t stack_limit;
+ uint32_t hash_seed;
+ UnicodeCache* unicode_cache;
+ };
+
+ Parser(CompilationInfo* info, ParseInfo* parse_info);
~Parser() {
delete reusable_preparser_;
reusable_preparser_ = NULL;
@@ -610,7 +619,10 @@ class Parser : public ParserBase<ParserTraits> {
// nodes) if parsing failed.
static bool Parse(CompilationInfo* info,
bool allow_lazy = false) {
- Parser parser(info);
+ 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);
return parser.Parse();
}
@@ -797,7 +809,9 @@ class Parser : public ParserBase<ParserTraits> {
void ThrowPendingError();
- void InternalizeUseCounts();
+ // Handle errors detected during parsing, move statistics to Isolate,
+ // internalize strings (move them to the heap).
+ void Internalize();
Isolate* isolate_;
@@ -819,7 +833,11 @@ class Parser : public ParserBase<ParserTraits> {
const char* pending_error_char_arg_;
bool pending_error_is_reference_error_;
+ // Other information which will be stored in Parser and moved to Isolate after
+ // parsing.
int use_counts_[v8::Isolate::kUseCounterFeatureCount];
+ int total_preparse_skipped_;
+ HistogramTimer* pre_parse_timer_;
};
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698