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

Unified Diff: src/parser.cc

Issue 172753002: Re-enable Parser::symbol_cache_ (after a long time!) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: adding safeguards Created 6 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 | « no previous file | src/preparser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 902fcac81b501fedc75fc3e0d4d9c474c4c5de7e..68823e6c1f708a84cbba432187eac0972c397b43 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -207,12 +207,12 @@ void RegExpBuilder::AddQuantifierToAtom(
Handle<String> Parser::LookupSymbol(int symbol_id) {
- // Length of symbol cache is the number of identified symbols.
- // If we are larger than that, or negative, it's not a cached symbol.
- // This might also happen if there is no preparser symbol data, even
- // if there is some preparser data.
- if (static_cast<unsigned>(symbol_id)
- >= static_cast<unsigned>(symbol_cache_.length())) {
+ // If there is no preparser symbol data, a negative number will be passed. In
+ // that case, we'll just read the literal from Scanner. This also guards
+ // against corrupt preparse data where the symbol id is larger than the symbol
+ // count.
+ if (symbol_id < 0 ||
+ (pre_parse_data_ && symbol_id >= pre_parse_data_->symbol_count())) {
if (scanner()->is_literal_ascii()) {
return isolate()->factory()->InternalizeOneByteString(
Vector<const uint8_t>::cast(scanner()->literal_ascii_string()));
« no previous file with comments | « no previous file | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698